{"id":538,"date":"2021-06-04T09:51:04","date_gmt":"2021-06-04T13:51:04","guid":{"rendered":"https:\/\/psycomp.utsc.utoronto.ca\/support\/?p=538"},"modified":"2023-10-27T13:28:31","modified_gmt":"2023-10-27T17:28:31","slug":"use-brainiak-and-its-tutorials","status":"publish","type":"post","link":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/2021\/06\/04\/use-brainiak-and-its-tutorials\/","title":{"rendered":"Use BrainIAK and Its Tutorials"},"content":{"rendered":"<p><strong>This page shows steps for setting up and loading Python <a href=\"https:\/\/brainiak.org\/\" target=\"_blank\" rel=\"noopener\">BrainIAK<\/a> environment for learning and computing.<\/strong><p\/>\r\n<p>We have got needed packages and data needed for <a href=\"https:\/\/brainiak.org\/\" target=\"_blank\" rel=\"noopener\">BrainIAK<\/a> and <a href=\"https:\/\/brainiak.org\/tutorials\/\" target=\"_blank\" rel=\"noopener\">its tutorials<\/a> installed on the cluster. However, you&#8217;ll need to download and set up your own tutorial environment once before you can use the tutorials with <a href=\"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/2019\/06\/14\/connecting-to-jupyter-notebook-running-on-psy-cluster-using-your-laptop-desktop-browser\/\" target=\"_blank\" rel=\"noopener\">Jupyter Notebook<\/a>.<\/p>\r\nThe following steps are for downloading and setting up your own tutorial environment, you can skip them if you don&#8217;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:\r\n<pre>\r\n1) cd\r\n2) git clone https:\/\/github.com\/brainiak\/brainiak-tutorials.git\r\n3) Edit ~\/brainiak-tutorials\/tutorials\/utils.py file *once* and make the following changes \r\n   (note: we change the original \"data_path\" to \"data_path2\" and use it for \"sherlock\" settings):\r\n   data_path = '\/pkgsGPU\/brainiak_datasets'\r\n   data_path2 = os.path.join(os.path.expanduser('~'), 'brainiak_datasets')\r\n   # for Sherlock dataset\r\n   sherlock_h5_data = os.path.join(data_path2, 'sherlock_h5')\r\n   sherlock_dir = os.path.join(data_path2, 'Sherlock_processed')\r\n<\/pre>\r\nYou can then follow the instructions <a href=\"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/2019\/06\/14\/connecting-to-jupyter-notebook-running-on-psy-cluster-using-your-laptop-desktop-browser\/\" target=\"_blank\" rel=\"noopener\">here<\/a> 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&#8217;ll also need to load the environment for running computing jobs using BrainIAK:\r\n<pre>\r\n4) source \/opt\/scripts\/user\/conda3-2020.11.init.sh \r\n5) conda activate brainiak-202105\r\n<\/pre>\r\n<p>\r\nYou 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&#8217;ll be able to browse &#8220;tutorials&#8221; folder.\r\n<\/p>\r\n<p><strong>Note<\/strong>: <strong>niwidgets<\/strong> doesn&#8217;t work with the Python environment because of version conflicts, an alternative solution has been tested, here is an example script:<\/p>\r\n<pre>\r\nfrom nibabel.viewers import OrthoSlicer3D\r\nimport numpy as np\r\na = np.sin(np.linspace(0, np.pi, 20))\r\nb = np.sin(np.linspace(0, np.pi*5, 20))\r\ndata = np.outer(a, b)[..., np.newaxis] * a\r\nOrthoSlicer3D(data).show() \r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>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&#8217;ll need to download and set &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/2021\/06\/04\/use-brainiak-and-its-tutorials\/\"> <span class=\"screen-reader-text\">Use BrainIAK and Its Tutorials<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[3,5],"tags":[],"class_list":["post-538","post","type-post","status-publish","format-standard","hentry","category-clusterinfo","category-python"],"_links":{"self":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts\/538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/comments?post=538"}],"version-history":[{"count":12,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts\/538\/revisions"}],"predecessor-version":[{"id":724,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/posts\/538\/revisions\/724"}],"wp:attachment":[{"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/media?parent=538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/categories?post=538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/psycomp.utsc.utoronto.ca\/support\/index.php\/wp-json\/wp\/v2\/tags?post=538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}