Skip to content

Instantly share code, notes, and snippets.

View njvack's full-sized avatar

Nate Vack njvack

View GitHub Profile
@njvack
njvack / mosaic.py
Last active October 17, 2024 17:39
MRI Image Mosaic generator
#!/usr/bin/env python
# Copyright 2024 Board of Regents of the Universities of Wisconsin
# Written by Nate Vack <[email protected]>
"""MRI Image Mosaic.
Makes an MxN mosaic of images, intended for checking things like defacing
and alignment.
@njvack
njvack / ema_gen.py
Created June 27, 2024 17:36
EMA Scheduling
#!/usr/bin/env python
"""
Simple EMA schedule generator. Outputs to stdout.
Usage:
ema_gen.py [options] <record_id> <sched_field> <start_time> <days> <samples_per_day> <sampling_min> <gap_min>
ema_gen.py interval_test <iters> <num_samples> <sampling_minutes> <gap_minutes>
Options:
#!/usr/bin/env python
"""
Takes a REDCap CSV file and splits it into:
* A file for each event
* A file for repeated instruments in events where they happen
So, if your data has events 'scr,' 'pre,' and 'post', and 'pre' and 'post'
each have a repeated instument called 'meds', you can expect
"""
Generates an array blocks * block_len long, containing 1 and 2.
It's shuffled such that there can never be more than block_len
consecutive repetitions of either value.
"""
import numpy as np
blocks = 100
block_len = 8
groupnums = (np.arange(blocks * block_len) % 2) + 1
@njvack
njvack / sample-slack-coc.md
Last active March 13, 2020 17:18 — forked from annalee/sample-slack-coc.md
A sample code of conduct for social slack teams.

UW-Madison TechPartners Slack Code of Conduct

Welcome!

This Slack group is for any and everyone involved in tech at UW-Madison. Students, staff, faculty, alumni, and emeriti are all welcome. We're here to share tips and tricks, debate policy, but more importantly: to be a community.

The current admins are:

  • Nate Vack
# Binary builds
tap "homebrew/cask"
# Lets me get at things like sequel-pro-nightly
tap "homebrew/cask-versions"
# mas -> "Mac App Store"
brew "mas"
mas "Xcode", id: 497799835
brew "imagemagick"
@njvack
njvack / keybase.md
Created November 12, 2019 17:31
keybase.md

Keybase proof

I hereby claim:

  • I am njvack on github.
  • I am njvack (https://keybase.io/njvack) on keybase.
  • I have a public key ASB6TTOovVMHwUxq7IPCufRUK8WWK-MQlLVNO5USZ4C1lQo

To claim this, I am signing this object:

@njvack
njvack / distribution_match.py
Created April 25, 2019 15:05
Match distributions of two pandas dataframes
# -*- coding: utf-8 -*-
# Written by Nate Vack <[email protected]> at the Center for Healthy Minds
# Copyright 2019 Board of Regents of the University of Wisconsin System
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@njvack
njvack / make_lags.py
Created June 28, 2018 19:23
LAG generator for Mnemonic Similarity Task
#!/usr/bin/env python
"""
Compute stimulus orderings for the mnemonic similarity task, described in:
Stark SM, Stevenson R, Wu C, Rutledge S, & Stark CEL (2015). Stability of
age-related deficits in the mnemonic similarity task across task variations.
Behavioral Neuroscience 129(3), 257-268.
Written by Nate Vack <[email protected]> at the Center for Healthy Minds,
University of Wisconsin-Madison, for the mp2 study conducted by Dan Grupe
@njvack
njvack / convert_dcm2niix.sh
Created October 11, 2017 23:02
Convert tarfile of dicoms
#!/bin/bash
# Written by Jonah Chaiken and Nate Vack
# Support: [email protected]
help=" Usage: convert_dcm2niix.sh <in_file> <out_file>
This program will individually convert a dicom archive file to a NIfTI file.
The input can be either a .tar file containing bzip2'd dicom slices, or a