Skip to content

Commit

Permalink
[MRG] Conversion of somato data to BIDS (mne-tools#6414)
Browse files Browse the repository at this point in the history
* adjust freq tut

* adjust dics exp

* adjust global field power exp

* temporarily change hash and url for somato

* make more use of subj variable

* use v2 of somato bids set

* ignore long lines due to links in rst

* fix typo

* add somato url from MNE osf repo

* fix sphinx rst links

* update examples for new formatting, no new data yet

* update to most recent somato data

* update

* fix path

* fix rst link

* subj --> subject
  • Loading branch information
sappelhoff authored and jasmainak committed Jul 29, 2019
1 parent 988653c commit 3acb8dc
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 22 deletions.
1 change: 1 addition & 0 deletions doc/manual/datasets_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ The recordings were made using the BCI2000 system. To load a subject, do::

* :ref:`ex-decoding-csp-eeg`

.. _somato-dataset:

Somatosensory
=============
Expand Down
21 changes: 14 additions & 7 deletions examples/inverse/plot_dics_source_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
Compute a Dynamic Imaging of Coherent Sources (DICS) [1]_ filter from
single-trial activity to estimate source power across a frequency band. This
example demonstrates how to source localize the event-related synchronization
(ERS) of beta band activity in the "somato" dataset.
(ERS) of beta band activity in this dataset: :ref:`somato-dataset`
References
----------
Expand All @@ -19,8 +18,11 @@
# Author: Marijn van Vliet <[email protected]>
# Roman Goj <[email protected]>
# Denis Engemann <[email protected]>
# Stefan Appelhoff <[email protected]>
#
# License: BSD (3-clause)
import os.path as op

import numpy as np
import mne
from mne.datasets import somato
Expand All @@ -32,9 +34,10 @@
###############################################################################
# Reading the raw data and creating epochs:
data_path = somato.data_path()
raw_fname = data_path + '/MEG/somato/sef_raw_sss.fif'
fname_fwd = data_path + '/MEG/somato/somato-meg-oct-6-fwd.fif'
subjects_dir = data_path + '/subjects'
subject = '01'
task = 'somato'
raw_fname = op.join(data_path, 'sub-{}'.format(subject), 'meg',
'sub-{}_task-{}_meg.fif'.format(subject, task))

raw = mne.io.read_raw_fif(raw_fname)

Expand All @@ -46,7 +49,11 @@
epochs = mne.Epochs(raw, events, event_id=1, tmin=-1.5, tmax=2, picks=picks,
preload=True)

# Read forward operator
# Read forward operator and point to freesurfer subject directory
fname_fwd = op.join(data_path, 'derivatives', 'sub-{}'.format(subject),
'sub-{}_task-{}-fwd.fif'.format(subject, task))
subjects_dir = op.join(data_path, 'derivatives', 'freesurfer', 'subjects')

fwd = mne.read_forward_solution(fname_fwd)

###############################################################################
Expand Down Expand Up @@ -79,4 +86,4 @@
stc = beta_source_power / baseline_source_power
message = 'DICS source power in the 12-30 Hz frequency band'
brain = stc.plot(hemi='both', views='par', subjects_dir=subjects_dir,
time_label=message)
subject=subject, time_label=message)
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
importantly, the clear-cut comparability of the spectral decomposition (the
same type of filter is used across all bands).
We will use this dataset: :ref:`somato-dataset`
References
----------
Expand All @@ -38,10 +40,12 @@
vol. 108, 328-342, NeuroImage.
.. [3] Efron B. and Hastie T. Computer Age Statistical Inference (2016).
Cambrdige University Press, Chapter 11.2.
"""
""" # noqa: E501
# Authors: Denis A. Engemann <[email protected]>
# Stefan Appelhoff <[email protected]>
#
# License: BSD (3-clause)
import os.path as op

import numpy as np
import matplotlib.pyplot as plt
Expand All @@ -54,7 +58,10 @@
###############################################################################
# Set parameters
data_path = somato.data_path()
raw_fname = data_path + '/MEG/somato/sef_raw_sss.fif'
subject = '01'
task = 'somato'
raw_fname = op.join(data_path, 'sub-{}'.format(subject), 'meg',
'sub-{}_task-{}_meg.fif'.format(subject, task))

# let's explore some frequency bands
iter_freqs = [
Expand Down
17 changes: 9 additions & 8 deletions mne/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Martin Luessi <[email protected]>
# Eric Larson <[email protected]>
# Denis Egnemann <[email protected]>
# Stefan Appelhoff <[email protected]>
# License: BSD Style.

from collections import OrderedDict
Expand Down Expand Up @@ -237,10 +238,10 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
# To update the testing or misc dataset, push commits, then make a new
# release on GitHub. Then update the "releases" variable:
releases = dict(testing='0.67', misc='0.3')
# And also update the "hashes['testing']" variable below.
# And also update the "md5_hashes['testing']" variable below.

# To update any other dataset, update the data archive itself (upload
# an updated version) and update the hash.
# an updated version) and update the md5 hash.

# try to match url->archive_name->folder_name
urls = dict( # the URLs to use
Expand All @@ -254,8 +255,8 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
'datasets/foo.tgz',
misc='https://codeload.github.com/mne-tools/mne-misc-data/'
'tar.gz/%s' % releases['misc'],
sample="https://osf.io/86qa2/download?version=4",
somato='https://osf.io/tp4sg/download?version=2',
sample='https://osf.io/86qa2/download?version=4',
somato='https://osf.io/tp4sg/download?version=5',
spm='https://osf.io/je4s8/download?version=2',
testing='https://codeload.github.com/mne-tools/mne-testing-data/'
'tar.gz/%s' % releases['testing'],
Expand Down Expand Up @@ -306,7 +307,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
fieldtrip_cmc='MNE-fieldtrip_cmc-data',
phantom_4dbti='MNE-phantom-4DBTi',
)
hashes = dict(
md5_hashes = dict(
brainstorm=dict(
bst_auditory='fa371a889a5688258896bfa29dd1700b',
bst_phantom_ctf='80819cb7f5b92d1a5289db3fb6acb33c',
Expand All @@ -316,7 +317,7 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
fake='3194e9f7b46039bb050a74f3e1ae9908',
misc='d822a720ef94302467cb6ad1d320b669',
sample='fc2d5b9eb0a144b1d6ba84dc3b983602',
somato='77a7601948c9e38d2da52446e2eab10f',
somato='f08f17924e23c57a751b3bed4a05fe02',
spm='9f43f67150e3b694b523a21eb929ea75',
testing='9bc5543854737f32d426629b31ea85d7',
multimodal='26ec847ae9ab80f58f204d09e2c08367',
Expand All @@ -328,9 +329,9 @@ def _data_path(path=None, force_update=False, update_path=True, download=True,
fieldtrip_cmc='6f9fd6520f9a66e20994423808d2528c',
phantom_4dbti='f1d96f81d46480d0cc52a7ba4f125367'
)
assert set(hashes.keys()) == set(urls.keys())
assert set(md5_hashes.keys()) == set(urls.keys())
url = urls[name]
hash_ = hashes[name]
hash_ = md5_hashes[name]
folder_orig = folder_origs.get(name, None)
if name == 'brainstorm':
assert archive_name is not None
Expand Down
17 changes: 12 additions & 5 deletions tutorials/time-freq/plot_sensors_time_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
The objective is to show you how to explore the spectral content
of your data (frequency and time-frequency). Here we'll work on Epochs.
We will use the somatosensory dataset that contains so-called
event related synchronizations (ERS) / desynchronizations (ERD) in
the beta band.
"""
We will use this dataset: :ref:`somato-dataset`. It contains so-called event
related synchronizations (ERS) / desynchronizations (ERD) in the beta band.
""" # noqa: E501
# Authors: Alexandre Gramfort <[email protected]>
# Stefan Appelhoff <[email protected]>
#
# License: BSD (3-clause)
import os.path as op

import numpy as np
import matplotlib.pyplot as plt
Expand All @@ -23,7 +27,10 @@
###############################################################################
# Set parameters
data_path = somato.data_path()
raw_fname = data_path + '/MEG/somato/sef_raw_sss.fif'
subject = '01'
task = 'somato'
raw_fname = op.join(data_path, 'sub-{}'.format(subject), 'meg',
'sub-{}_task-{}_meg.fif'.format(subject, task))

# Setup for reading the raw data
raw = mne.io.read_raw_fif(raw_fname)
Expand Down

0 comments on commit 3acb8dc

Please sign in to comment.