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 mne | |
from mne.datasets import sample | |
from mne.inverse_sparse import make_stc_from_dipoles, mixed_norm | |
from mne.minimum_norm import apply_inverse, make_inverse_operator | |
from mne.viz import ( | |
plot_dipole_amplitudes, | |
plot_dipole_locations, | |
plot_sparse_source_estimates, |
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
.PHONY: all clean openmeeg_wrap.cxx _example.so test1 test2 test3 test4 test5 | |
all : clean example_wrap.cxx _example.so test1 test2 test3 test4 test5 | |
clean: | |
rm -f *.o | |
rm -f *.so | |
rm -f *wrap*.c* | |
rm -f *wrapper.py | |
rm -Rf build | |
rm -Rf __pycache__ |
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 mne | |
data_path = mne.datasets.sample.data_path() | |
sample_data_raw_file = data_path / "MEG" / "sample" / "sample_audvis_raw.fif" | |
subjects_dir = data_path / "subjects" | |
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=60) | |
events = mne.find_events(raw, stim_channel="STI 014") | |
epochs = mne.Epochs(raw, events, event_id = {"auditory/left": 1}, tmin=-0.3, tmax=0.7)[:10] | |
inverse_operator_file = data_path / "MEG" / "sample" / "sample_audvis-meg-oct-6-meg-inv.fif" | |
inv_operator = mne.minimum_norm.read_inverse_operator(inverse_operator_file) | |
stcs = mne.minimum_norm.apply_inverse_epochs(epochs, inv_operator, lambda2=1/3, pick_ori=None) |
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
"""BIDSify and trim the KIT phantom data.""" | |
from pathlib import Path | |
import numpy as np | |
from scipy.signal import find_peaks | |
import matplotlib.pyplot as plt | |
import mne | |
import mne_bids | |
from mne.io.constants import FIFF |
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
"""Attempt to build a mne.viz.Brain-like GUI using magicgui.""" | |
from magicgui import widgets, use_app | |
import numpy as np | |
import re | |
import mne | |
from matplotlib.figure import Figure | |
import pyvista | |
import pyvista.plotting |
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
# Check 1-tailed t-test bias when selecting ROIs using different methods | |
import numpy as np | |
from scipy.stats import ttest_ind | |
rng = np.random.default_rng(0) | |
n_subjects = 20 # number of subjects to simulate | |
n_sensors = 100 # number of "sensors" (could be source points, etc.) | |
n_run = 5000 # number of times to simulate (n_subjects, n_sensors) values | |
prop_false = np.zeros((n_run, 3, 2)) # proportion of false alarms |

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 | |
from datetime import datetime | |
from tqdm.auto import tqdm | |
from pytz import timezone | |
from peloton import PelotonWorkout | |
my_tz = timezone('US/Eastern') | |
print('Getting workout list...') | |
workouts = PelotonWorkout.list() |
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
# Minimal script to test the iEEG GUI | |
import os.path as op | |
import numpy as np | |
import nibabel as nib | |
import mne | |
misc_path = mne.datasets.misc.data_path(verbose=True) | |
raw = mne.io.read_raw(op.join(misc_path, 'seeg', 'sample_seeg_ieeg.fif')) | |
subj_trans = mne.coreg.estimate_head_mri_t( | |
'sample_seeg', op.join(misc_path, 'seeg')) |
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
from ctypes import CDLL, c_int, byref | |
import faulthandler | |
import vtk as _vtk | |
faulthandler.enable() | |
renderWindow = _vtk.vtkRenderWindow() | |
logger = _vtk.vtkLogger | |
logger.Init() | |
logger.SetStderrVerbosity(_vtk.vtkLogger.VERBOSITY_MAX) | |
renderWindow.DebugOn() | |
renderWindow.SetOffScreenRendering(True) |
NewerOlder