Skip to content

Instantly share code, notes, and snippets.

View drammock's full-sized avatar

Daniel McCloy drammock

View GitHub Profile
@drammock
drammock / vowel-plot-log-scale-ellipse.R
Last active February 7, 2022 13:52
Regarding ellipses on log-scaled axes
library(phonR)
data(indoVowels)
indo$f1log <- log10(indo$f1)
indo$f2log <- log10(indo$f2)
f1hz <- seq(200, 1200, 100) # chosen based on range(indo$f1)
f2hz <- seq(500, 3500, 500) # chosen based on range(indo$f2)
png("log-scale-ellipses.png")
with(indo, plotVowels(f1log, f2log, vowel, var.col.by=vowel, pretty=TRUE,
@drammock
drammock / cloudSettings
Last active October 5, 2021 19:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-10-05T19:11:12.950Z","extensionVersion":"v3.4.3"}
@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
@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")]))
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)
@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) %>%
#!/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 / 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')