Skip to content

Instantly share code, notes, and snippets.

View drammock's full-sized avatar

Daniel McCloy drammock

View GitHub Profile
@drammock
drammock / ptfce.py
Last active June 28, 2021 15:03
WIP pTFCE
import os
from functools import partial
from time import perf_counter
from contextlib import contextmanager
import numpy as np
from scipy.integrate import trapezoid # quad
# from scipy.interpolate import interp1d
from scipy.stats import norm, gaussian_kde
import matplotlib.pyplot as plt
import mne
@drammock
drammock / cluster-prob-simulations.py
Last active May 28, 2021 14:46
Testing to see if we recover the expected covariance from simulated noise signals
import os
from collections import namedtuple
import numpy as np
from scipy.stats import norm, zscore
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import mne
n_jobs = 4
from pyrankvote import Ballot, Candidate, instant_runoff_voting
votes = dict(tri=(10, 8, 2, 3, 4),
kaj=(1, 9, 10),
dan=(2, 10, 4, 5),
gus=(5, 3, 7),
mer=(5, 1, 4),
ori=(6, 2, 10, 4),
jai=(4, 1, 10, 5),
ch_=(4, 7, 10, 9)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Daniel McCloy
Load SSVEP epochs and plot PSDs, phases, etc.
data at https://dan.mccloy.info/data/prek_1964-pre_camp-pskt-epo.fif
"""
@drammock
drammock / assess-dim-reduction.R
Last active April 26, 2020 17:46
WIP assessment of the dim reduction results
#!/usr/bin/env Rscript
library(dplyr, warn.conflicts=FALSE)
# load phoible data (to get feat. col. names)
"~/Documents/academics/research/phoible/dev/data" -> data_dir
load(file.path(data_dir, "phoible.RData"))
# get feature column names
phoible %>%
select(tone:click) %>%
@drammock
drammock / config.json
Created April 9, 2020 19:36
fontello config file
{
"name": "",
"css_prefix_text": "icon-",
"css_use_suffix": false,
"hinting": true,
"units_per_em": 1000,
"ascent": 850,
"glyphs": [
{
"uid": "ea4ad928c87154ed3eb2ec50daea01cc",
@drammock
drammock / heog_veog_reject_example.py
Last active March 19, 2020 00:22
example showing how to have different rejection thresholds for HEOG and VEOG
import os
import mne
# load sample data
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False).crop(tmax=60)
events = mne.find_events(raw, stim_channel='STI 014')
#!/usr/bin/env python
import tracemalloc
tracemalloc.start()
import os
from mayavi import mlab
import mne
mlab.options.offscreen = True
@drammock
drammock / voach.R
Last active September 17, 2020 13:18
quick-and-dirty implementation to find the overlap area of the convex hulls of vowel measurements
library(phonR) # convexHullArea
library(sp) # SpatialPolygons, etc
library(rgeos) # gIntersection
data(indoVowels)
female_two <- indo[indo$subj == "F02",]
by_vowel <- split(female_two, female_two$vowel)
hull_indices <- sapply(by_vowel, function(df) with(df, chull(f1, f2)))
hulls <- sapply(names(by_vowel), function(v) by_vowel[[v]][hull_indices[[v]],],
simplify=FALSE)
matrices <- sapply(hulls, function(df) as.matrix(df[,c("f1", "f2")]))
@drammock
drammock / refactor-epochs-branch.ipynb
Last active July 9, 2019 22:39
test cases for plot_epochs_image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.