Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Markiewicz effigies

View GitHub Profile
@effigies
effigies / compression_check.py
Created Jan 9, 2021
Comparing sizes of identical .nii.gz data saved as int16, float32, float64
View compression_check.py
import os
import nibabel as nb
import numpy as np
# Create an image with a "plausible" range of fMRI values
img = nb.Nifti1Image(np.random.uniform(500, 2000, (256,256,256,1)), np.eye(4))
# Verify numpy's giving us float64
assert img.get_data_dtype() == np.float64
# Quantize to 16 bits and reload
@effigies
effigies / python_packaging_2020.md
Last active May 7, 2021
Contemporary Python Packaging - 2020
View python_packaging_2020.md

Contemporary Python Packaging

This document lays out a set of Python packaging practices. I don't claim they are best practices, but they fit my needs, and might fit yours.

Validity

This was written in July 2020, superseding this gist from 2019.

View model-narps_smdl.json
{
"Name": "NARPS",
"Description": "Basic NARPS model",
"Input": {
"task": "MGT"
},
"Steps": [
{
"Level": "run",
"Transformations": [
@effigies
effigies / python_packaging_2019.md
Last active Oct 12, 2020
Contemporary Python Packaging - August 2019
View python_packaging_2019.md

Contemporary Python Packaging

This document lays out a set of Python packaging practices. I don't claim they are best practices, but they fit my needs, and might fit yours.

Validity

This document has been superseded as of July 2020.

This was written in July 2019. As of this writing Python 2.7 and Python 3.5 still have not

@effigies
effigies / partial_permutation_testing.md
Created Jul 24, 2018
Markiewicz and Bohland, 2016 permutation testing
View partial_permutation_testing.md

Partially-parametric permutation testing

Cluster thresholding in multi-voxel pattern analysis (MVPA) is an open problem, as many figures of merit are possible, few (if any) of which have been sufficiently analyzed to permit a parametric solution or a guarantee of compatibility with pre-computed simulations. Stelzer, et al. 2012 represents probably the most conservative approach, constructing voxel-wise and then cluster-wise null distributions at the group level, based on permuting the training labels at the individual level.

In Mapping the cortical representation of speech sounds in a syllable repetition task, we adapted this approach to skip the voxel-wise null distribution,

@effigies
effigies / nspn.yml
Created May 30, 2018
NSPN conda environment
View nspn.yml
name: base
channels:
- conda-forge
- defaults
dependencies:
- apptools=4.4.0=py27_0
- ca-certificates=2018.4.16=0
- cairo=1.14.6=0
- conda=4.5.4=py27_0
- conda-env=2.6.0=0
@effigies
effigies / traitlet_extension.py
Last active Apr 27, 2017
Traitlet extension draft
View traitlet_extension.py
import traitlets
class _Undefined(object):
obj = None
def __new__(cls):
if cls.obj is None:
cls.obj = object.__new__(cls)
return cls.obj
class _UseDefault(_Undefined):
@effigies
effigies / fmriprep.py
Created Jan 27, 2017
FMRIPREP Wrapper
View fmriprep.py
#!/usr/bin/env python3
import sys
import os
import re
import argparse
import subprocess
import tempfile
from functools import partial
__version__ = 0.1
@effigies
effigies / TypedDict.py
Created Jul 30, 2015
Typed Dictionary
View TypedDict.py
#!python3
class TypedDict(dict):
keytype = valtype = keymap = valmap = valid_keys = typemap = None
def __init__(self, mapping=None, **kwargs):
if self.typemap is not None and self.valid_keys is None:
self.valid_keys = set(self.typemap)
super(TypedDict, self).__init__()
if mapping is None:
View gist:9055df837f1f996e4015
#!/bin/sh
#
# /etc/chromium-browser/default
#
# Default settings for chromium-browser. This file is sourced by /bin/sh from
# /usr/bin/chromium-browser
# Options to pass to chromium-browser
MIN_SSL="tls1"
RC4="0x0004,0x0005,0xc007,0xc011"