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 | |
import numpy as np | |
import vtk | |
from vtk.util import numpy_support | |
import pyvistaqt | |
raw = mne.io.read_raw_fif( | |
mne.datasets.sample.data_path() + '/MEG/sample/sample_audvis_raw.fif') | |
data, times = raw[:, :] | |
n_points = 1000 |
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 sys | |
import mne | |
import numpy as np | |
from PyQt5.QtWidgets import QApplication | |
from PyQt5.QtCore import Qt | |
from qwt import QwtPlot, QwtLegend, QwtPlotCurve, QwtAbstractScaleDraw | |
raw = mne.io.read_raw_fif( | |
mne.datasets.sample.data_path() + '/MEG/sample/sample_audvis_raw.fif') | |
data, times = raw[:, :] # preload |
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
# convert MGZ->NII | |
# | |
# $ bet T1.nii stripped.nii.gz -n -A -v -e | |
# | |
import numpy as np | |
import nibabel as nib | |
import pyvista as pv | |
import mne | |
img = nib.load('T1.mgz') |
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
function HomerOfflineConverter(pathname) | |
%This function converts recorded NIRx datasets into Homer2 format (*.nirs) | |
%Please provide as input the root path, within all datasets are located | |
%If no probeInfo file can be found, it is necessary to choose it manually | |
% | |
%Note: to account for the original inter-optode distances, a few functions | |
%are added to properly import the 2D coordinates and convert them to 3D | |
% | |
%By: NIRx Medical Technologies | |
%Contact: [email protected] |
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
#!/usr/bin/env python3 | |
""" | |
mailmanToMBox.py: Inserts line feeds to create mbox format from Mailman Gzip'd | |
Text archives decompressed | |
Usage: ./to-mbox.py dir | |
Where dir is a directory containing .txt files pulled from mailman Gzip'd Text and decompressed | |
Adapted from https://gist.github.com/corydolphin/1728592#gistcomment-2583599 | |
""" | |
import sys |
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 numpy as np | |
import mne | |
from mne.time_frequency import csd_morlet | |
from mne.beamformer import make_dics, apply_dics_csd | |
# Simulate bilateral auditory data | |
subject = 'sample' | |
data_path = mne.datasets.testing.data_path() | |
fname_raw = op.join(data_path, 'MEG', 'sample', 'sample_audvis_trunc_raw.fif') |
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 scipy import stats | |
import mne | |
import matplotlib.pyplot as plt | |
# 1. Load data | |
raw = mne.io.read_raw_fif('CC_CP004_PN_L_RUN01_tsss.fif') | |
other = mne.io.read_raw_egi('CC_CP004_PN_L_Run01_20201016_110457.mff') | |
# 2. Get times for both instances that should match | |
t_raw = (mne.find_events(raw)[:, 0] - raw.first_samp) / raw.info['sfreq'] |
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.io.constants import FIFF | |
subjects = ('ANTS3-0Months3T', 'ANTS6-0Months3T', 'ANTS12-0Months3T') | |
subjects_dir = '.' | |
for subject in subjects: | |
subject_dir = op.join(subjects_dir, subject) | |
assert op.isdir(subject_dir), subject_dir |
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 | |
raws = list() | |
# kiloword | |
epo = mne.read_epochs( | |
mne.datasets.kiloword.data_path() + '/kword_metadata-epo.fif') | |
epo.pick_types(meg=False, eeg=True) | |
# XXX this / 1000. is a bug with kiloword, should be in meters! |
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 | |
def output_lens(len_h, in_len, up, down): | |
in_len_copy = in_len + (len_h + (-len_h % up)) // up - 1 | |
nt = in_len_copy * up | |
need = nt // down | |
if nt % down > 0: | |
need += 1 | |
# need2 = int(np.ceil((in_len * up + len_h - 1) / down)) |