Skip to content

Instantly share code, notes, and snippets.

View rmarkello's full-sized avatar

Ross Markello rmarkello

View GitHub Profile
@rmarkello
rmarkello / distbox_plot.py
Created April 9, 2020 14:46
Pseudo-box/violinplot, where data distribution are plotted as a rectangular color gradient
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.patches as mpatch
import matplotlib.pyplot as plt
from scipy import stats
import seaborn as sns
def distbox_plot(data, groups=None, bw='scott', cut=3, gridsize=100,
@rmarkello
rmarkello / smith.py
Last active April 9, 2020 14:47
Python implementation of HCP behavioral preprocessing code from Smith et al., (2015, Nat Neuro)
# -*- coding: utf-8 -*-
"""
Implementation of the pre-processing code used by Smith et al., 2015, Nature
Neuroscience (available at https://www.fmrib.ox.ac.uk/datasets/HCP-CCA/).
Assumes you have access to both the unrestricted AND restricted behavioral data
from HCP. And can load it into a dataframe + re-order it according to
instructions at the above link (see `smith_cols.csv` for up-to-date column
names that work with the S1200 release of HCP.
@rmarkello
rmarkello / permcca.py
Last active February 26, 2022 17:30
Python implementation of PermCCA (https://github.com/andersonwinkler/PermCCA)
# -*- coding: utf-8 -*-
"""
Python implementation of PermCCA (https://github.com/andersonwinkler/PermCCA),
licensed under GPLv3 (https://www.gnu.org/licenses/gpl-3.0.en.html) as a
derivative of the original MATLAB code.
Since the Schur decomposition is non-unique there are numerical differences
betwen the MATLAB code and this implementation.
This is a rough translation so there are likely a few bugs, but it generates