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 sklearn.discriminant_analysis import LinearDiscriminantAnalysis, _class_cov, _class_means, \ | |
| linalg | |
| from sklearn.base import BaseEstimator | |
| from scipy.spatial.distance import euclidean, correlation | |
| class Euclidean2(BaseEstimator): | |
| _estimator_type = 'distance' |
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 matplotlib.pyplot as plt | |
| import mne | |
| import numpy as np | |
| from scipy import sparse | |
| # We will operate on the fsaverage source space. Fetch it first. | |
| subjects_dir = mne.datasets.sample.data_path() / "subjects" | |
| mne.datasets.fetch_fsaverage(subjects_dir) | |
| # Load the source space. |
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
| """Virtually move around head position.""" | |
| import os | |
| from copy import deepcopy | |
| from subprocess import run | |
| import mne | |
| import numpy as np | |
| from move_head import move_head |
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 neurodsp | |
| import neurodsp.aperiodic | |
| import neurodsp.plts | |
| import neurodsp.sim | |
| import neurodsp.spectral | |
| import numpy as np | |
| from pyrasa.irasa import irasa | |
| n_seconds = 10 | |
| fs = 500 # sampling rate in Hz |
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 pickle | |
| class MyClass: | |
| """Example class to pickle. Version 2.""" | |
| def __init__(self, a, b, c, d=4): | |
| """New field `d` with default value, so no problems right?""" | |
| self.a = a | |
| self.b = b |
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
| """Interface between python and the MEG hardware at Aalto's MEG core. | |
| This is intended to be used in combination with PsychoPy to perform classic experiments | |
| involving simple events and responses. | |
| Example that presents a visual stimulus, sends a trigger code to the MEG and waits for a | |
| button response with one of the response pads: | |
| >>> from psychopy import core, visual | |
| >>> from aalto_meg import AaltoMEG |
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
| #!/bin/bash | |
| # Start tmux | |
| tmux new -d -s "slurm$SLURM_JOB_ID" | |
| # Make job wait for user to connect | |
| sleep 8h |
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
| """Plot a cluster. | |
| Plot the spatial extend of a cluster (as those returned from the cluster-based | |
| permutation stats) on a brain. | |
| Author: Marijn van Vliet <w.m.vanvliet@gmail.com> | |
| """ | |
| import mne | |
| import numpy as np |
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
| """ | |
| Plot the spatial extent of a cluster (as those returned from the cluster-based | |
| permutation stats) on a brain. | |
| Author: Marijn van Vliet <w.m.vanvliet@gmail.com> | |
| """ | |
| import mne | |
| import numpy as np |
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
| """ | |
| Obtain head -> MRI transform for the MOUS dataset for use with MNE-Python. | |
| If you want to analyze the "Mother of all unification studies" dataset with | |
| FreeSurfer and MNE-Python, you will need the MRI->HEAD coordinate | |
| transformations. In the original dataset, the T1w_space_CTF.nii files contain | |
| this information, but it takes some doing to distill this into a transform | |
| object as used by MNE-Python. | |
| This script assumes you have ran FreeSurfer on the T1w.nii files of all the |
NewerOlder