This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In fsaverage/mri ran: | |
# | |
# $ mri_aparc2aseg --s fsaverage --volmask --annot HCPMMP1 | |
# $ mri_aparc2aseg --s fsaverage --volmask --annot HCPMMP1_combined | |
# | |
# Then this script can be used to create the lookup table for atlas_ids. | |
import os.path as op | |
import numpy as np | |
import mne |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
from datetime import datetime, timezone, timedelta | |
import mne | |
import numpy as np | |
import h5py | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.path as op | |
import mne | |
from mne import compute_rank | |
from mne.beamformer import make_lcmv | |
data_path = mne.datasets.testing.data_path() | |
fname_raw = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc_raw.fif') | |
fname_fwd = op.join(data_path, 'MEG', 'sample', | |
'sample_audvis_trunc-meg-eeg-oct-4-fwd.fif') | |
raw = mne.io.read_raw_fif(fname_raw).fix_mag_coil_types() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
============================ | |
Plot a cortical parcellation | |
============================ | |
In this example, we download the HCP-MMP1.0 parcellation [1]_ and show it | |
on ``fsaverage``. | |
We will also download the customized 448-label aparc parcellation from [2]_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Some utility functions.""" | |
# Authors: Alexandre Gramfort <[email protected]> | |
# | |
# License: BSD (3-clause) | |
from collections.abc import Iterable | |
import time | |
import logging | |
import tempfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
############################################################################### | |
# Optimized SVD | |
def _check_transpose(x): | |
if x.shape[-2] < x.shape[-1]: | |
x = x.swapaxes(-2, -1) | |
transpose = True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_atlas_roi_mask(stc, roi, atlas='IXI', atlas_subject=None, | |
subjects_dir=None): | |
"""Get ROI mask for a given subject/atlas. | |
Parameters | |
---------- | |
stc : instance of mne.SourceEstimate or mne.VectorSourceEstimate | |
The source estimate. | |
roi : str | |
The ROI to obtain a mask for. | |
atlas : str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
export MRI=/mnt/bakraid/larsoner/mri/Infants/Sources/BEM/AVG7-5Months3T_segmented_BEM4.nii.gz | |
mri_binarize --i $MRI --o inner_skull.mgz --min 1 --max 2 | |
mri_binarize --i $MRI --o outer_skull.mgz --min 1 --max 3 | |
mri_binarize --i $MRI --o outer_skin.mgz --min 1 --max 4 | |
mri_tessellate inner_skull.mgz 1 lh.inner_skull_dense | |
mri_tessellate outer_skull.mgz 1 lh.outer_skull_dense | |
mri_tessellate outer_skin.mgz 1 lh.outer_skin_dense | |
mris_extract_main_component lh.inner_skull_dense lh.inner_skull_dense | |
mris_extract_main_component lh.outer_skull_dense lh.outer_skull_dense |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
rng = np.random.RandomState(0) | |
groups = ('TD', 'ASD') | |
conditions = ('space', 'both', 'pitch') | |
data = dict( # create some fake data that will plot trends nicely | |
TD=rng.rand(10, 3) + np.array([0, -0.5, 0.5]) + 1, | |
ASD=rng.rand(12, 3) + np.array([0, 0.5, 0.]) + 1, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import mne | |
data_path = mne.datasets.testing.data_path() | |
subjects_dir = data_path + '/subjects' | |
evoked = mne.read_evokeds( | |
data_path + '/MEG/sample/sample_audvis-ave.fif')[0] | |
evoked.apply_baseline((None, 0)) |