Skip to content

Commit

Permalink
fix according to MNE 1.x.x (#128)
Browse files Browse the repository at this point in the history
* fix according to MNE 1.x.x

* workshop practicalmeeg

* update doc
  • Loading branch information
annapasca authored Dec 11, 2022
1 parent b66ab55 commit fe81548
Show file tree
Hide file tree
Showing 39 changed files with 1,318 additions and 311 deletions.
8 changes: 6 additions & 2 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ Pipelines (:py:mod:`ephypype.pipelines`):

Nodes (:py:mod:`ephypype.nodes`):

.. currentmodule:: ephypype.pipelines
.. currentmodule:: ephypype.interfaces.mne

.. autosummary::
:toctree: generated/

LFComputation
NoiseCovariance
InverseSolution


CLI commands (:py:mod:`ephypype.commands.neuropycon`):

Expand Down Expand Up @@ -53,4 +58,3 @@ Utils (:py:mod:`ephypype.nodes`):

create_iterator
create_datagrabber
Reference
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

# generate autosummary even if no references
autosummary_generate = True
numpydoc_show_class_members = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -90,7 +91,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
Binary file added doc/img/dspm-contrast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/graph_FS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 18 additions & 8 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,9 @@ The ephypype package provides the following **pipelines**:
Installation
=============

ephypype works with **python3**
To install the ephypype package, we recommend you first install MNE python by following the |installation instructions|.

* mne>0.19
* nipype
* h5py

These dependencies are automatically installed during ephypype installation.

We also recommend to install MNE python by following the |installation instructions|.
The dependencies (mne, nipype, h5py) are automatically installed during ephypype installation.

.. |installation instructions| raw:: html

Expand All @@ -109,12 +103,28 @@ We also recommend to install MNE python by following the |installation instructi

Install ephypype
^^^^^^^^^^^^^^^^
Then, to install ephypype package, you can use the Pypi version

.. code-block:: bash
$ pip install ephypype
$ pip install jupyter
or alternatively, you can download from |github| the last version and install it:

.. code-block:: bash
$ git clone https://github.com/neuropycon/ephypype.git
$ cd ephypype
$ python setup.py develop
.. |github| raw:: html

<a href="https://github.com/neuropycon/ephypype" target="_blank">github</a>



.. note:: ephypype works with **python3**

Freesurfer
^^^^^^^^^^
Expand Down
19 changes: 10 additions & 9 deletions doc/tutorials/howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ the list of subjects and sessions, ...)
Now we define some variables specific for the pipelines we use (frequency band of interest, method to compute the PSD, ...).
in a :download:`json <https://github.com/neuropycon/ephypype/blob/master/examples/params_power.json>` file and load it in the script.
in a :download:`json <https://github.com/neuropycon/ephypype/blob/master/examples/params.json>` file and load it in the script.

.. code-block:: python
:emphasize-lines: 1
data = json.load(open("params_power.json"))
params = json.load(open("params.json"))
freq_band_names = data['freq_band_names']
freq_bands = data['freq_bands']
is_epoched = data['is_epoched']
fmin = data['fmin']
fmax = data['fmax']
power_method = data['method']
freq_band_names = params["power"]['freq_band_names']
freq_bands = params["power"]['freq_bands']
is_epoched = params["power"]['is_epoched']
fmin = params["power"]['fmin']
fmax = params["power"]['fmax']
power_method = params["power"]['method']
Specify Nodes
-------------
Expand Down Expand Up @@ -176,7 +176,7 @@ Each pipeline provided by NeuroPycon requires two different kind of inputs:
* inputs of the pipeline
* **inputnode**: these particular inputs are defined after the creation of the pipeline; an inputnode of a pipeline is defined by an output of a previous Node

For example, looking at the definition of `create_pipeline_power <https://neuropycon.github.io/ephypype/generated/ephypype.pipelines.create_pipeline_power.html#ephypype.pipelines.create_pipeline_power>`_ module
For example, looking at the definition of `create_pipeline_power <https://neuropycon.github.io/ephypype/generated/ephypype.pipelines.create_pipeline_power.html#ephypype.pipelines.create_pipeline_power>`_
``main_path``, ``freq_bands`` are inputs of the pipeline while ``fif_file`` is an inputnode. In the next section :ref:`workflow` we'll see how to specify this inputnode.

To create the pipeline node we pass the input to the ``create_pipeline_power`` function:
Expand Down Expand Up @@ -215,6 +215,7 @@ Then, we connect the nodes two at a time. First, we connect the two outputs (su
So, these two nodes taken together can grab data.

.. code-block:: python
:emphasize-lines: 1-2
main_workflow.connect(infosource, 'subject_id', datasource, 'subject_id')
main_workflow.connect(infosource, 'session_id', datasource, 'session_id')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
01. Freesurfer anatomical pipeline
==================================
This workflow runs the `Nipype <http://nipype.readthedocs.io/en/latest/#>`_
Interface wrapping the `recon-all <https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all>`_
command of Freesurfer.
The solution of MEG inverse problem requires knowledge of the lead field
matrix. A cortical segmentation of the anatomical MRI is necessary to generate
the source space, where the neural activity will be estimated.
Expand All @@ -16,10 +20,18 @@
Freesurfer. The output of :ref:`reconallnode` node is used as input of another node that
creates the BEM surfaces using the FreeSurfer watershed algorithm.
The workflow generates an HTML report displaying the BEM surfaces as
colored contours overlaid on the T1 MRI images to verify that the surfaces do not intersect.
.. warning:: Make sure that Freesurfer is properly configured before
running this script.
"""

# Authors: Annalisa Pascarella <[email protected]>
# License: BSD (3-clause)

# sphinx_gallery_thumbnail_number = 1

###############################################################################
# Import modules
# ^^^^^^^^^^^^^^
Expand All @@ -41,8 +53,10 @@
# Let us specify the variables that are specific for the data analysis (the
# main directories where the data are stored, the list of subjects and
# sessions, ...) and the variable specific for the particular pipeline
# (MRI path, Freesurfer fir, ...) in a
# :download:`json <https://github.com/neuropycon/ephypype/tree/master/doc/workshop/meg/params.json>` file
# (MRI path, Freesurfer fir, ...) in a |params.json| file
#
# .. |params.json| replace::
# :download:`json <https://github.com/neuropycon/ephypype/tree/master/doc/workshop/01_meg/params.json>`

# Read experiment params as json
params = json.load(open("params.json"))
Expand All @@ -61,7 +75,7 @@
if not os.environ.get('FREESURFER_HOME'):
raise RuntimeError('FREESURFER_HOME environment variable not set')
os.environ["SUBJECTS_DIR"] = subjects_dir
print('SUBJECTS_DIR %s ' % os.environ["SUBJECTS_DIR"])
print(f'SUBJECTS_DIR {os.environ["SUBJECTS_DIR"]} ')


###############################################################################
Expand Down Expand Up @@ -158,4 +172,12 @@
# ^^^^^^^
# The output of this workflow is the cortical segmentation of the
# structural data that we find in the ``subjects_dir`` and will be used in
# :ref:`plot_events_inverse`
# :ref:`plot_events_inverse`
#
# .. note:: The main advantage to use this workflow lies in the parallel
# processing provided by nipype engine, that allows segmenting the 19 MRI
# data in less than two days while processing a single MRI generally
# takes one day.
# .. image:: ../../img/graph_FS.png
# :width: 50%
# :align: center
35 changes: 18 additions & 17 deletions doc/workshop/meg/README.rst → doc/workshop/01_meg/README.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
.. _facedataset:


FACE dataset
^^^^^^^^^^^^




FACE dataset
^^^^^^^^^^^^

These examples demonstrate how to process 1 participant of the |FACE| dataset from |Wakeman_Henson|. The data consist of simultaneous MEG/EEG recordings
from 19 healthy participants performing a visual recognition task. Subjects were presented images of famous, unfamiliar and scrambled faces.
Each subject participated in 6 runs, each 7.5 min in duration.

.. |FACE| raw:: html

<a href="https://openneuro.org/datasets/ds000117/versions/1.0.4" target="_blank">FACE</a>

.. |Wakeman_Henson| raw:: html

<a href="https://www.nature.com/articles/sdata20151" target="_blank">Wakeman and Henson (2015)</a>

Here, we focus only on MEG data and use :func:`~ephypype.pipelines.create_pipeline_preproc_meeg` to preprocess the MEG raw data and :func:`~ephypype.pipelines.create_pipeline_source_reconstruction` to perform source reconstruction of time-locked event-related fields.
Each subject participated in 6 runs, each 7.5 min in duration.

.. |FACE| raw:: html

<a href="https://openneuro.org/datasets/ds000117/versions/1.0.4" target="_blank">FACE</a>

.. |Wakeman_Henson| raw:: html

<a href="https://www.nature.com/articles/sdata20151" target="_blank">Wakeman and
Henson (2015)</a>

Here, we focus only on MEG data and use :func:`~ephypype.pipelines.create_pipeline_preproc_meeg` to preprocess the MEG raw data and :func:`~ephypype.pipelines.create_pipeline_source_reconstruction` to perform source reconstruction of time-locked event-related fields.
Loading

0 comments on commit fe81548

Please sign in to comment.