Skip to content

Instantly share code, notes, and snippets.

@mwaskom
mwaskom / lineplot.ipynb
Last active October 22, 2017 21:54
Various development examples of `seaborn.lineplot` functionality
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / film_gls.py
Last active March 3, 2023 19:44
Python implementation of FILM GLS algorithm
"""Python implementation of FILM GLS algorithm.
Plans for development:
We will need the following functionality:
GLS fit for 4D timeseries (i, j, k, t), with smoothing in volume or on surface
GLS for for 2D array (time x vox) array, with single prewhitening matrix
We'll call the first "local" and the latter "regional" prewhitening
@mwaskom
mwaskom / bias_field_dilation.ipynb
Created July 11, 2017 17:31
Dilate and smooth estimated B1- bias field to cover full FOV
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mwaskom
mwaskom / improve_labels.py
Created July 6, 2017 14:59
Draft function to improve the string representation of axes labels
def improve_labels(fig=None, ax=None):
def improve_text(text):
return text.replace("_", " ").capitalize()
if fig is None and ax is None:
axes = plt.gcf().axes
elif fig is not None:
axes = fig.axes
"""Heatmap visualization of an fMRI time series for quality control.
Based on approach developed by Jonathan Power and explained here:
https://www.ncbi.nlm.nih.gov/pubmed/27510328
Python implementation by Michael Waskom <mwaskom@nyu.edu>
Released under Revised BSD license.
"""
@mwaskom
mwaskom / colormaps.md
Last active November 9, 2022 18:41
Four perceptually uniform colormaps in .jscm format

Sequential

  • rocket
  • mako

Diverging

  • icefire
  • vlag
@mwaskom
mwaskom / prisma_preproc.py
Last active June 16, 2017 16:25
Initial translation of Prisma multiband EPI preprocessing to a Nipype workflow
import os
import argparse
import nipype
from nipype import Workflow, Node, MapNode, SelectFiles, DataSink
from nipype.interfaces import fsl, freesurfer as fs, utility
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("-subj", help="Freesurfer subject ID")
@mwaskom
mwaskom / prisma_preproc_beta.sh
Last active June 15, 2017 20:40
Initial attempt at a preprocessing script for data from the CBI Prisma
#! /bin/bash
# Beta version of a script to preprocess SMS-EPI data from the Prisma scanner
# Written by Michael Waskom | Last updated June 15, 2017
if [ "$#" -ne 6 ]; then
echo '
USAGE: prisma_preproc.sh <subj> <ts> <sbref> <se> <se_rev> <wd>
Parameter Information:
@mwaskom
mwaskom / make_wang_atlas_annot.py
Last active May 17, 2017 14:48
Create a subject-specific Wang 2015 visual field atlas annotation.
""""Create a subject-specific Wang 2015 visual field atlas annotation.
Convert the Wang atlas in subject-space (as created by Noah Benson's
template mapping scripts) from segmentation format to annotation format.
"""
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
@mwaskom
mwaskom / fit_prfs.m
Last active May 2, 2017 15:37
Fit pRF model using analyzePRF
function results = fit_prfs(subj, ss, ts)
%% Setup paths
addpath(genpath('~/code/vistasoft/'))
addpath(genpath('~/code/analyzePRF'))
%% Setup stimulus information
param_fname = ['data/' subj '/stim/params.mat'];
image_fname = ['data/' subj '/stim/images.mat'];