<commit_before>.. _mne_python_tutorial:

=========================================================
Tutorial: MEG and EEG data processing with MNE and Python
=========================================================

MNE-Python reimplements most of MNE-C's (the original MNE command line utils) functionality and offers transparent scripting.
On top of that it extends MNE-C's functionality considerably (customize events, compute
contrasts, group statistics, time-frequency analysis, EEG-sensor space analyses, etc.)
It uses the same files as standard MNE unix commands:
no need to convert your files to a new system or database.

What you can do with MNE Python
-------------------------------

    - **Raw data visualization** to visualize recordings, can also use *mne_browse_raw* for extended functionality (see :ref:`ch_browse`)
    - **Epoching**: Define epochs, baseline correction, handle conditions etc.
    - **Averaging** to get Evoked data
    - **Compute SSP pojectors** to remove ECG and EOG artifacts
    - **Compute ICA** to remove artifacts or select latent sources.
    - **Forward modeling**: BEM computation and mesh creation (see :ref:`ch_forward`)
    - **Linear inverse solvers** (dSPM, sLORETA, MNE, LCMV, DICS)
    - **Sparse inverse solvers** (L1/L2 mixed norm MxNE, Gamma Map, Time-Frequency MxNE)
    - **Connectivity estimation** in sensor and source space
    - **Visualization of sensor and source space data**
    - **Time-frequency** analysis with Morlet wavelets (induced power, intertrial coherence, phase lock value) also in the source space
    - **Spectrum estimation** using multi-taper method
    - **Mixed Source Models** combining cortical and subcortical structures
    - **Dipole Fitting**
    - **Decoding** multivariate pattern analyis of M/EEG topographies
    - **Compute contrasts** between conditions, between sensors, across subjects etc.
    - **Non-parametric statistics** in time, space and frequency (including cluster-level)
    - **Scripting** (batch and parallel computing)

What you're not supposed to do with MNE Python
----------------------------------------------

    - **Boundary Element Modeling** use MNE and Freesurfer.


.. note:: Package based on the FIF file format from Neuromag. It can read and convert CTF, BTI/4D, KIT and various EEG formats to FIF.


Installation of the required materials
---------------------------------------

See :ref:`getting_started` with Python.


.. note:: The expected location for the MNE-sample data is my-path-to/mne-python/examples.
    If you downloaded data and an example asks you whether to download it again, make sure
    the data reside in the examples directory and you run the script from its current directory.

    From IPython e.g. say::

        cd examples/preprocessing


    %run plot_find_ecg_artifacts.py


From raw data to evoked data
----------------------------
<commit_msg>DOC: Update doc [ci skip]<commit_after>.. _mne_python_tutorial:

=========================================================
Tutorial: MEG and EEG data processing with MNE and Python
=========================================================

MNE-Python reimplements most of MNE-C's (the original MNE command line utils) functionality and offers transparent scripting.
On top of that it extends MNE-C's functionality considerably (customize events, compute
contrasts, group statistics, time-frequency analysis, EEG-sensor space analyses, etc.)
It uses the same files as standard MNE unix commands:
no need to convert your files to a new system or database.

What you can do with MNE Python
-------------------------------

    - **Raw data visualization** to visualize recordings, can also use *mne_browse_raw* for extended functionality (see :ref:`ch_browse`)
    - **Epoching**: Define epochs, baseline correction, handle conditions etc.
    - **Averaging** to get Evoked data
    - **Compute SSP pojectors** to remove ECG and EOG artifacts
    - **Compute ICA** to remove artifacts or select latent sources.
    - **Boundary Element Modeling**: single and three-layer BEM model creation and solution computation.
    - **Forward modeling**: BEM computation and mesh creation (see :ref:`ch_forward`)
    - **Linear inverse solvers** (dSPM, sLORETA, MNE, LCMV, DICS)
    - **Sparse inverse solvers** (L1/L2 mixed norm MxNE, Gamma Map, Time-Frequency MxNE)
    - **Connectivity estimation** in sensor and source space
    - **Visualization of sensor and source space data**
    - **Time-frequency** analysis with Morlet wavelets (induced power, intertrial coherence, phase lock value) also in the source space
    - **Spectrum estimation** using multi-taper method
    - **Mixed Source Models** combining cortical and subcortical structures
    - **Dipole Fitting**
    - **Decoding** multivariate pattern analyis of M/EEG topographies
    - **Compute contrasts** between conditions, between sensors, across subjects etc.
    - **Non-parametric statistics** in time, space and frequency (including cluster-level)
    - **Scripting** (batch and parallel computing)

What you're not supposed to do with MNE Python
----------------------------------------------

    - **Brain and head surface segmentation** for use with BEM models -- use Freesurfer.

.. note:: Package based on the FIF file format from Neuromag. It can read and convert CTF, BTI/4D, KIT and various EEG formats to FIF.


Installation of the required materials
---------------------------------------

See :ref:`getting_started` with Python.


.. note:: The expected location for the MNE-sample data is my-path-to/mne-python/examples.
    If you downloaded data and an example asks you whether to download it again, make sure
    the data reside in the examples directory and you run the script from its current directory.

    From IPython e.g. say::

        cd examples/preprocessing


    %run plot_find_ecg_artifacts.py


From raw data to evoked data
----------------------------

{'fraction_non_alphanumeric': 0.1588502269288956, 'fraction_numerical': 0.0010085728693898135, 'mean_word_length': 3.256080114449213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1053208', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1466, 'n_words': 687}