Installation

This page is now out of date. Please check out Downloads

1. Unarchive the code (that is, unzip vhtools.zip or whatever file the code is in) and decide where it will live on your drive; for this example, we'll assume you chose e:\mytools\ and that it is a windows path (would be /Users/username/mytools/ on Mac OS X or another type of unix operating system for example). Go ahead and put the directories there. We'll refer to this directory casually as VHTOOLSPATH. If the Downloads page indicates that the calibration files have changed, or if this is a new installation, also unzip vhtools_calibration.zip at the same location. Make sure calibration is placed inside the vhtools folder; some computers like to put it in a separate vhtools 2 directory (see Contents).

2. If the computer will be a visual STIMULUS computer or will otherwise use the Psychophysics Toolbox, install (or update if an old version is installed, see instructions here) the Psychophysics Toolbox. Finally, make sure the display properties on the stimulus monitor are correct (on Mac OS 9, 256 colors and 800x600 resolution at 100Hz is a good choice) before you run Matlab. If the second monitor isn't recognized, note that the monitor needs to be connected and ON at bootup for a Mac OS 9 computer to recognize it, maybe that is the issue.

3. Edit the configuration files in the calibration directory under the VHTOOLSPATH directory as needed (it's probably needed). Typical edits are described below.

    1. If your computer will be a STIMULUS computer or other type of slave computer, then you'll need to edit NewStimCalibration.m. Set Remote_Comm_isremote to 1, make sure Remote_Comm_enable is 1, and Remote_Comm_method is usually 'filesystem'. Next, if you are using 'filesystem', you need to establish the common directory where the slaves and master computer will exchange files; maybe this will be fitzdata\remote\999H if you work in room 999 and there are already rigs labeled A-G. Next, you need to figure out how the stimulus computer can write to this common directory; maybe it is drive z for the stimulus computer; then set Remote_Comm_dir = 'z:\remote\999H\', or wherever it should be. Note that you need to have a trailing file separator (\ on Windows, / on Mac OS X/Unix, : on Mac OS 9) and that you should use whatever file separators are appropriate for the slave computer's operating system. For example, on Mac OS 9, you'd use 'fitzdata:remote:999H:'. Finally, edit StimWindowMonitor to be equal to the screen number you want to use (0 for the first screen, 1 for the 2nd screen, etc).

    2. If your computer will be an acquisition computer or other type of MASTER computer that issues complex instructions to slave computers, you'll need a different NewStimCalibration.m configuration. In NewStimCalibration.m, set Remote_Comm_isremote to 0, and then configure the rest of NewStimCalibration as above in Step 3.1, except be sure to specify the file paths with respect to the Master computer, using the Master computer's file separators. Next, we need to tell the Master computer how to convert the remote pathname into an appropriate form so that the "slave" or "remote" computer can access it. For example, if the "master" computer is a PC, the common path might be 'z:\remote\999H\', but on a stimulus computer that is a Mac OS 9 machine, then that Mac might refer to the same directory as 'fitzdata:remote:999H:'. Edit Remote_Comm_remoteachitecture so it matches the appropriate computer (e.g., 'MacOS9' for Mac OS 9; the various options are listed in the NewStimCalibration.m file), edit Remote_Comm_localprefix so it searches for the file system on the "master" computer (e.g., 'z:' for a PC), and set Remote_Comm_remoteprefix to be the same directory name as Remote_Comm_localprefix, except the path will be with respect to the "slave" or "remote" computer.

    3. If your computer will be performing 2-photon analysis, then edit TwoPhotonCalibration.m to reflect the acquisition system and synchronization methods you will be using (usually TwoPhotonPlatform is 'PrairieView', usually TwoPhotonSynchonization is 'Generic' for none or 'Fitzpatrick' for the Fitzpatrick lab methods using Spike2; if you are not using our visual stimulus software (like Kristen and Wendy!), then you probably want to choose 'Generic').

    4. Under normal circumstances, FitzLabCalibration.m and NelsonLabToolsInitLocal.m require no editing.

4. Start Matlab. (On a recent Mac OS X Intel machine, you'll need to make sure you launch the 32 bit version of Matlab, needed for the Psychtoolbox, either a) by running X11, and typing matlab -maci on the command line; or b) by finding the Matlab application in the finder, selecting Get Info from the File menu and clicking Run in 32-bit mode.) Create a file called startup.m in your default Matlab directory (maybe it is C:\yourusername\documents\MATLAB\ or something similar). If you already have a startup.m file for other programs, you can simply add this to your existing startup.m file. Add the following 6 lines:

mydir = pwd; % save the directory where we are currently

cd('VHTOOLSPATH/VH_matlab_code'); % change directories to the tool path

% use your actual directory instead of VHTOOLSPATH

vhtools_startup(pwd,1); % installs directory paths and initializes objects

cd(mydir); % changes back to the previous directory

clear mydir; % clears the variable mydir

If you use Mac OS X or unix, you can put startup.m wherever you like and edit your MATLABPATH variable to include this path; for example, you could add EXPORT MATLABPATH=.:/Users/vanhoosr/tools/vhtools to your .bashrc file.

5. Test it out. Exit Matlab and re-run it. You may get warnings about directories not being present, but there should be no errors.

Extra credit:

6. If the STIMULUS computer is a Mac, use an AppleScript to automatically mount the hard drive of the MASTER computer. Run the AppleScript Editor to start editing a new script. Use the following script:

tell application "Finder"

mount volume "smb://vhlab@leghorn.bio.brandeis.edu/remote"

end tell

Of course, you'll need to substitute your own information. Here we are assuming the MASTER computer is a windows computer that uses the "smb" protocol for sharing its drives; you'll need to use your own username, computer name, and share directory name (here the "share name" is "remote"). Once you have written the script, you can save it as an application. Then, go to the Finder, and drag the application into the Dock. Once its in the Dock, you can right-click the application, go to the Options submenu, and choose Open at Login. Now the drive will be mounted automatically at login.

7. You can have the STIMULUS computer boot up right into Matlab. (We are assuming the STIMULUS computer is a Mac OS X machine here.) (Follow these instructions exactly; you can't just click on an already-running Matlab in the Dock.) In the Finder, go to Applications and find Matlab. Under the File menu, choose Get Info. Check Run in 32-bit mode. Next, drag the Matlab application into the Dock; it should look like the Matlab logo but also have an upward pointing array in the upper right part of the icon. Then, right-click the Matlab icon in the Dock and choose Options/Open at Login. Now Matlab will launch at login. Finally, add a line to your startup.m file that says

initstims;

this will start the stimulus program automatically when you start up Matlab.

Development notes for Steve (everyone else can ignore):

1. vhtools_startup should be smarter about handling the psychophysics toolbox pathname installations