This file contains 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 python | |
# -*- coding: utf-8 -*- | |
"""Computes the distance correlation between two matrices. | |
https://en.wikipedia.org/wiki/Distance_correlation | |
""" | |
import numpy as np | |
from scipy.spatial.distance import pdist, squareform |
This file contains 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 scipy.spatial.distance import pdist, squareform | |
import numpy as np | |
import random | |
import copy | |
def distcorr(Xval, Yval, pval=True, nruns=500): | |
""" Compute the distance correlation function, returning the p-value. | |
Based on Satra/distcorr.py (gist aa3d19a12b74e9ab7941) |
This file contains 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 os | |
import numpy as np | |
import os.path as op | |
from mne.datasets import sample | |
from nose.tools import assert_equal | |
data_path = sample.data_path() |
This file contains 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 itertools | |
import matplotlib.pyplot as plt | |
from matplotlib.patches import Rectangle | |
from matplotlib.collections import PatchCollection | |
import numpy as np | |
def main(): | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='polar') | |
x = np.radians(np.arange(0, 360, 10)) |
This file contains 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 pyimpress | |
import mne | |
import numpy as np | |
from mne import create_info | |
from mne.io import RawArray | |
mff_fname='/cluster/transcend/sheraz/data/MEG_EEG/EEG/taskforce_1_vis_20160310_063855.mff' | |
# mff is the class supporting mff io |
This file contains 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 sol = apply_inverse_raw(fname_raw,fname_inv,tmin, tmax, sel, nave,dSPM,pickNormal) | |
if ~exist('pickNormal','var') | |
pickNormal=0; | |
end | |
if ~exist('dSPM','var') |
This file contains 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
# Load 'pwr' package | |
library(pwr) | |
# 80% power | |
# Small effect size | |
small80p <- pwr.t.test(sig.level = 0.05, d = 0.2, | |
power = 0.8, type="two.sample", alternative="two.sided") | |
small80p |
This file contains 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 plot_brainstorm_data() | |
% ============================ | |
% Brainstorm tutorial datasets | |
% ============================ | |
% | |
% Here we compute the evoked from raw for the Brainstorm | |
% tutorial dataset. For comparison, see [1]_ and: | |
% | |
% http://neuroimage.usc.edu/brainstorm/Tutorials/MedianNerveCtf | |
% |
This file contains 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 | |
def labels2stc(labels,labels_data,stc): | |
stc_new = stc.copy() | |
stc_new.data.fill(0) | |
for index,label in enumerate(labels): | |
if labels_data.ndim==1: | |
if isinstance(label, str): | |
temp = stc.in_label(mne.read_label(label)) |
This file contains 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 [cortex] = raw_cortex(data,fname_inv,nave,dSPM,pickNormal) | |
% data : 3D Matrix Channels x times x epochs | |
% fname_inv : Inverse operator file name | |
% nave : number of trials (for single trial should be one) | |
% dSPM : 0 or 1 | |
% pickNormal : 0 (loose) or 1 (fixed) | |
if ~exist('pickNormal','var') | |
pickNormal=0; |
OlderNewer