Skip to content

Instantly share code, notes, and snippets.

View danjgale's full-sized avatar
🧠

Dan Gale danjgale

🧠
View GitHub Profile
@danjgale
danjgale / trajectories.gif
Last active September 22, 2022 17:07
Sliding window manifold visualization
trajectories.gif
@danjgale
danjgale / get_files.py
Created November 18, 2020 00:10
Super handy awesome cool neat function to get files using a glob pattern.
import os
import natsort
import glob
def get_files(pattern, force_list=False):
"""Extracts files in alphanumerical order that match the provided glob
pattern.
Parameters
----------
@danjgale
danjgale / searchlight.py
Last active November 28, 2019 21:29
A real-world example of a searchlight analysis with nilearn
from nilearn.decoding import Searchlight
from nilearn.datasets import load_mni152_brain_mask
from nilearn.image import new_img_like
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from skearn.svm import LinearSVC
from sklearn.model_selection import LeaveOneGroupOut
imgs = # 4D NIfTI image or list of 3D NIfTI images
y = # array-like of condition labels for each volume in `imgs`
@danjgale
danjgale / fmriprep-log-230219
Created February 23, 2019 15:22
fmriprep MSC01 crash
Node: _autorecon30
Working directory: /scratch/fmriprep_wf/single_subject_MSC01_wf/anat_preproc_wf/surface_recon_wf/autorecon_resume_wf/autorecon3/mapflow/_autorecon30
Node inputs:
FLAIR_file = <undefined>
T1_files = <undefined>
T2_file = <undefined>
args = <undefined>
big_ventricles = <undefined>
@danjgale
danjgale / fmriprep-log-feb2019.txt
Last active February 13, 2019 02:54
fmriprep-log-feb2019
RUNNING: docker run --rm -it -e DOCKER_VERSION_8395080871=18.06.1-ce -v /Raid6/users/dan/Documents/licenses/freesurfer/license.txt:/opt/freesurfer/license.txt:ro -v /Raid6/raw/midnight_scan_club:/data:ro -v /Raid6/raw/users/dan/Documents/Projects/midnight_test/data:/out -v /Raid6/users/dan/Documents/Projects/midnight_test/fmriprep_working_dir:/scratch poldracklab/fmriprep:1.2.6-1 /data /out participant --participant-label MSC01 --anat-only -w /scratch
WARNING: Error loading config file: /Raid6/users/dan/.docker/config.json: stat /Raid6/users/dan/.docker/config.json: permission denied
Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
This dataset appears to be BIDS compatible.
Summary: Available Tasks: Available Modalities:
7717 Files, 108.71GB glasslexical bold
10 - Subjects memoryscenes T1w
14 - Sessions memorywords
@danjgale
danjgale / pysurfer.md
Created August 9, 2018 18:04
Pysurfer installation guide for Python 3.6

Installing Pysurfer with Python 3.6

Pysurfer can be a bit tough to install because the dependencies (e.g., Mayavi) can be tricky to get right. Further, the documentation, at the time of this writing, states that Pysurfer only works with Python 2.7. This is not entirely the case, as Pysurfer does in fact work with Python 3. Here, I've documented the installation steps to get Pysurfer working with Python 3 on OSX (I'm guessing these steps also hold for Linux; not sure about Windows).

Setup

Before we begin, you'll need conda installed to create a virtual environment, and you will also need Freesurfer installed on your computer (follow the installation steps for your operating system, as is, here).

Then, let's set up our conda environment. We'll want to specify Python 3.6 and install some dependencies:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.