Use BrainIAK and Its Tutorials

This page shows steps for setting up and loading Python BrainIAK environment for learning and computing.

We have got needed packages and data needed for BrainIAK and its tutorials installed on the cluster. However, you’ll need to download and set up your own tutorial environment once before you can use the tutorials with Jupyter Notebook.

The following steps are for downloading and setting up your own tutorial environment, you can skip them if you don’t need to go through the tutorials using the cluster. The following steps can be done using a master node or a compute node, and they only need to be done once:
1) cd
2) git clone https://github.com/brainiak/brainiak-tutorials.git
3) Edit ~/brainiak-tutorials/tutorials/utils.py file *once* and make the following changes 
   (note: we change the original "data_path" to "data_path2" and use it for "sherlock" settings):
   data_path = '/pkgsGPU/brainiak_datasets'
   data_path2 = os.path.join(os.path.expanduser('~'), 'brainiak_datasets')
   # for Sherlock dataset
   sherlock_h5_data = os.path.join(data_path2, 'sherlock_h5')
   sherlock_dir = os.path.join(data_path2, 'Sherlock_processed')
You can then follow the instructions here to start a Slurm session for starting a Jupyter Notebook server on the cluster. Before you start a Jupyter Notebook server, you need to load the BrainIAK environment using the following command. You’ll also need to load the environment for running computing jobs using BrainIAK:
4) source /opt/scripts/user/conda3-2020.11.init.sh 
5) conda activate brainiak-202105

You can then continue with the instructions for starting a Jupyter Notebook server on the cluster and accessing it using a local browser. After connect to the Jupyter Notebook using a local browser, you’ll be able to browse “tutorials” folder.

Note: niwidgets doesn’t work with the Python environment because of version conflicts, an alternative solution has been tested, here is an example script:

from nibabel.viewers import OrthoSlicer3D
import numpy as np
a = np.sin(np.linspace(0, np.pi, 20))
b = np.sin(np.linspace(0, np.pi*5, 20))
data = np.outer(a, b)[..., np.newaxis] * a
OrthoSlicer3D(data).show()