====== Computer setup ====== ===== Matlab ===== If you already have Matlab installed on your computer, please proceed to the [[#Directories|next section]] Stanford provides a campus wide Matlab license that everyone can connect to. This section will get your computer set up to use it. Alternatively, if you will be using Matlab a lot in the future and would like to purchase a license, go here: https://www.mathworks.com/store/link/products/student. **Instructions for setup on Mac/Unix** * open up X11 (Start it from spotlight i.e. click on the magnifying glass at top right in the menu bar, type in the "X11" without the quotes and hit enter) * If X11 is open, you should see an icon like the following in your task bar to show that it is running
ssh -X @corn.stanford.edu
* Enter your sunet password when prompted (nothing will show, this is normal)
* Then type:
module load matlab/r2013b
matlab &
* If the Matlab GUI (graphical user interface) then pops up on your desktop, great! Please proceed to the next section.
//Possible error 1: X11 not installed//
Warning: No display specified. You will not be able to display graphics on the screen.
This means you do not have X11 (framework for displaying GUIs) installed. You can download X11 as part of the **XCode** package here:
https://developer.apple.com/xcode/
Once X11 is installed, you may need to start it **before** you login to corn. So, close the connection to corn (i.e. close terminal), open up X11 (Start it from spotlight like you did terminal). Then try the procedure from above again.
//Possible error 2: Module load error//
module: Command not found.
If you see this message after typing "module load matlab", this means you have an older account where the module environment is not set up properly. Follow instructions here:
https://web.stanford.edu/group/farmshare/cgi-bin/wiki/index.php/Dotfiles
**Instructions for setup on Windows**
* Instructions for Windows are more involved. Follow steps here (instructions starting on page 2): http://stanford.edu/~mzahr/extras/cme292/spring2014/AccessToMatlabAndAlternatives.pdf
===== Directories =====
To keep things organized, we will have you create the following directory structure: a folder called **psych202** which has the directories **data** and **proj** inside it. You can pick where you want your **psych202** folder to be.
Some useful linux commands:
* mkdir: make a directory
* cd: change current location to the specified directory
* pwd: "print working directory", lets you know where you are
* ls: "list segments", prints out files and directories in the directory you are in
To create these folders from the command line, do the following:
- First, navigate to where you want the psych202 folder installed.
- Then in your __terminal__, type:
mkdir psych202
cd psych202
mkdir data
mkdir proj
===== Download software: mrTools and mgl =====
* Navigate to **psych202/proj** in matlab.
Now type in your matlab command window to download these software packages:
* **Download mrTools**
! svn checkout https://cbi.nyu.edu/svn/mrTools/trunk mrTools
(If you don't have subversion, use this:)
! git clone https://github.com/justingardner/mrtools.git mrTools
* **Download mgl:**
! git clone https://github.com/justingardner/mgl.git mgl
If you get an error like: “Git: Command not found”, then you need to install Git. One way you can do this is by getting it as part of the command line tools of XCode. Download [[https://developer.apple.com/xcode/|Xcode]] (make sure that you have checked the option to install the command line tools to get git. If you already have Xcode installed, but git is not installed, go to Xcode > Preferences > Downloads > Command Line Tools > Install).
===== Software path setup in Matlab =====
We now want Matlab to be able to read the newly downloaded software. \\
Make sure you are in the **psych202/** folder in Matlab. \\
You can navigate through folders in Matlab either by the address bar along the top, or by clicking on the folder icons in the left panel. \\
Type these lines of code in the __Matlab__ command window. Note that you will need to do this each time Matlab starts, unless you add permanently the paths by using the path tool - which you can start by typing "pathtool" at the matlab prompt or navigating the menus to "Set Path")
>> addpath(genpath(fullfile(pwd,'proj','mgl')));
>> addpath(genpath(fullfile(pwd,'proj','mrTools')));
====== Running the Retinotopy Tutorial ======
We have preprocessed the data for you sot that you can skip the more mundane steps of the tutorial. Please follow instructions to download files below, taking note that they differ depending on how you're running Matlab:
===== Farmshare Matlab =====
If you're running the Farmshare Matlab use these instructions. Otherwise follow the [[#localmatlab|instructions]] for the local matlab
In Matlab, navigate to your **psych202/data/** directory. This can be done in the address bar along the top, or alternatively by clicking on the folder icons in the left panel. \\
To copy and paste the zipped ret tutorial materials from the class website, type in the __Matlab__ command window (this may take some time since it is a large file):
! cp /afs/.ir.stanford.edu/class/psych202/retinotopyTutorialProcessed.tar.gz ./
To unzip this file, type:
! tar -xzf retinotopyTutorialProcessed.tar.gz
This will create a folder called **retinotopyTutorial**. \\
Now navigate into the **retinotopyTutorial** folder: \\
cd retinotopyTutorial
And type into your __Matlab__ command window:
mrLoadRet([])
If you get "Undefined function or variable mrLoadRet" then it means that you have to use the [[#SoftwarepathsetupinMatlab|"addpath/genpath"]] commands from above to put mrTools in your path (this will happen if you logout and log back in to matlab.
I would also recommend turning the verbose setting for mrTools off to avoid getting a bunch of annoying dialogs;
mrSetPref('verbose','no')
Now you're ready to start the tutorial, starting at step 7:
http://gru.stanford.edu/doku.php/mrtools/tutorialsretinotopy
===== local matlab =====
Follow these directions if you are running a local version of matlab.
Download the **retinotopyTutorialProcessed.tar.gz** file from this page: [[http://gru.stanford.edu/pub/retinotopyTutorialProcessed.tar.gz|retinotopyTutorialProcessed.tar.gz]]
Copy and paste this tar file into your **psych202/data/** directory.
In Matlab, navigate to your **psych202/data/** directory. This can be done by double clicking on the folder name in the address bar along the top, or by clicking on the folder icons in the left panel, or by using the cd command in the Matlab terminal. Now type in the __Matlab__ command window:
! tar -xzf retinotopyTutorialProcessed.tar.gz
This will unzip the tar file.
Now change your directory location to be in this new directory:
cd retinotopyTutorial/
Now type:
mrLoadRet([])
If you get "Undefined function or variable mrLoadRet" then it means that you have to use the [[#SoftwarepathsetupinMatlab|"addpath/genpath"]] commands from above to put mrTools in your path (this will happen if you logout and log back in to matlab.
I would also recommend turning the verbose setting for mrTools off to avoid getting a bunch of annoying dialogs;
mrSetPref('verbose','no')
Now you're ready to start the tutorial, starting at step 7:
http://gru.stanford.edu/doku.php/mrtools/tutorialsretinotopy
====== Setting up for the pRF Tutorial ======
* **Obtain the most updated version of the mrTools software:**
Navigate to the **psych202/proj/** folder in your terminal. Then type (line by line):
mv mrTools mrToolsSVN
git clone https://github.com/justingardner/mrtools.git mrTools
cd mrTools
git checkout life
* **Remember to add the paths of mrTools and mgl so that Matlab can see these functions:**
Navigate to the **psych202/** folder in Matlab.
>> addpath(genpath(fullfile(pwd,'proj')));
__If you're using local matlab__, you're ready to start the pRF tutorial!
http://gru.stanford.edu/doku.php/mrtools/tutorialsprf
* ** *If you're using Farmshare Matlab*, ** follow the steps below, then start the tutorial __starting at step 2__:
In your terminal, navigate to **psych202/data/**. Then type:
wget http://gru.stanford.edu/pub/pRFTutorial.tar.gz
tar -xzf pRFTutorial.tar.gz
All good! Now you're ready to start the tutorial starting at step 2 : http://gru.stanford.edu/doku.php/mrtools/tutorialsprf
====== Tutorials ======
* [[:tutorials:sdt|Signal Detection Tutorial]]
* [[:tutorials:diffusion|Diffusion to Bound Tutorial]]