Skip to content

Instantly share code, notes, and snippets.

View matt-erhart's full-sized avatar

Matt Erhart matt-erhart

View GitHub Profile
@matt-erhart
matt-erhart / cloudSettings
Last active May 3, 2019 19:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-04-29T20:44:07.294Z","extensionVersion":"v3.2.9"}
@matt-erhart
matt-erhart / typescriptReact.tsx
Last active April 8, 2019 19:13
define types from defaults and return values for typescript react redux
const SomeComponentDefaults = {
props: {
exampleProp: '' // start with '' and only allow strings. ts will prevent e.g. numbers being passed in as props
},
state: {
exampleObjArray: [] as { source: ""; target: ""; id: "" }[], // use 'as' when your default is empty/undefined so ts knows what will be there
exampleNoDefault: undefined as number | string, // ideally we should have something as a default because undefined can cause errors
exampleNumber: 0 //is a number now, will be a number always. don't need 'as',
exampleUser: {name: '', email: '', age: 0} // each type will stay the same so don't need 'as'
}
// @ts-check
interface nodeID { string }
interface tagID { string }
interface edgeID { string }
interface meta {
created?: string; //date time
description?: string;
label?: string;
}
var webpack = require('webpack');
var path = require('path');
// variables
var isProduction = process.argv.indexOf('-p') >= 0;
var sourcePath = path.join(__dirname, './src');
var outPath = path.join(__dirname, './dist');
// plugins
var HtmlWebpackPlugin = require('html-webpack-plugin');
@matt-erhart
matt-erhart / .block
Last active February 3, 2017 19:01
Horizontal Bar Chart v4
license: mit
@matt-erhart
matt-erhart / .block
Last active December 11, 2016 00:19
click
license: mit
@matt-erhart
matt-erhart / .block
Last active December 9, 2016 20:12
Chained Transitions
license: mit
import os.path as op
import numpy as np
import mne
from mne import spatial_tris_connectivity, grade_to_tris
from mne.datasets import sample
from sklearn import cluster
from collections import Counter
from surfer import Brain, TimeViewer
#%% import ####################################################################
import mne
import numpy as np
import os
#%% load group avg data #######################################################
os.environ["SUBJECTS_DIR"] = \
"/freesurfer/RH4-x86_64-R530/subjects"
src_path = \
'/MNE-sample-data/subjects/fsaverage/bem/fsaverage-ico-5-src.fif';
aparc_label_name = 'G_oc-temp_med-Lingual'
stc_mean = stc.copy().crop(tmin, tmax).mean()
# use the stc_mean to generate a functional label
# region growing is halted at 60% of the peak value within the
# anatomical label / ROI specified by aparc_label_name
label = mne.labels_from_parc('fsaverage', parc='aparc.a2009s',
regexp=aparc_label_name)
stc_mean_label = stc_mean.in_label(label[0][1])
data = np.abs(stc_mean_label.data)