Python implementation of hierarchical Bayesian modelling of fMRI data
This project would be nothing without:
Gang Chen
Kelly Garner
Christopher Nolan
Lea Waller
Darin Erat Sleiter
Megan EJ Campbell
Steffen Bollmann
Adam Manoogian
Isabella Orlando
Preethom Pal
Judy Zhu
Arshiyan Sangchooli
Daniel Borek
Installation on linux:
- Install Anaconda / Miniconda
- create a new virtual environment with required dependencies:
$ conda env create -n pyrba --file environment.yml
- activate the new environment:
$ conda activate pyrba
Installation on MacOS has not been tested, and is not supported for Windows (because Jax is not directly supported on Windows).
Notes:
- the conda environment uses pymc v4.3.0. The newest version is v4.4.0, but conda was having difficulty resolving dependency versions for all dependencies with v4.4.0 of pymc. Using v4.3.0 seemed to solve this issue.
- when training a bambi model in jupyterlab, you might see "Error displaying widget: model not found". This does not prevent training, it just means that the notebook is unable to display the progress bar. This could possibly be resolved by testing out different versions of ipywidgets, but hasn't been tested yet.
After creating a new notebook session:
- clone this repository in the session:
- click on the git icon on the left sidebar
- clone a repository, and copy in the repository url:
https://github.com/crnolan/pyrba.git
- alternatively: fork the repository into your own github account first, and then clone your fork (this will make contributions easier via pull requests)
- create a new conda environment:
- from the launcher, open a new terminal
- cd pyrba/
- create a conda environment from the
environment.yml
file:$ conda env create -n pyrba --file environment.yml
- create a new notebook or open an existing one, and select the kernel labeled:
[conda env:.conda-pyrba]
- you might need to give the instance a moment to recognize the new kernel after the previous environment creation step
-
Python notebooks (xx.ipynb) = examples of fitting hierarchical Bayesian modelling of fMRI (and fMRI-like) data.
-
generate_random_voxels.py - build a quick simulation to test of your compute but generating some random data for a set of 'voxels' in small scale before going on to real fMRI data.
-
neurosyth_masks.sh - this script will pull down custom ROI masks based on neurosynth.org/ meta-analysis of interest.
-
scrape_data.sh - script to pull down open source dataset to play with from the Amsterdam Open MRI Collection https://openneuro.org/datasets/ds002790/versions/2.0.0 please see preprint for details of this data https://www.biorxiv.org/content/10.1101/2020.06.16.155317v1
-
fmri-frst-lvl/ - simple first-level GLM of the AOMRIC data pulled down by scrape_data.sh ** GLM batch scripted in SPM12 Matlab - sorry not sorry ;)
- scrape_data.sh, then
- fmri-frst-level/get_stopsignal_motion_regressors.py - simplified regressor extraction
- fmri-frst-level/eventreader_onsets.m
- fmri-frst-level/glm_1stlevel_stopsignal.m (this calls glm_build_batch_jobs.m)