Beauchamp:Software Installation: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
Line 31: Line 31:
   rm -r {$pkg}.tgz {$pkg}
   rm -r {$pkg}.tgz {$pkg}


Many statistical programs in AFNI require the free statistical package "R". This can be downloaded from
Some statistical programs in AFNI require the free statistical package "R". This can be downloaded from
  http://www.biometrics.mtu.edu/CRAN/bin/macosx/
  http://www.biometrics.mtu.edu/CRAN/bin/macosx/



Revision as of 09:36, 15 December 2009

Brain picture
Beauchamp Lab Notebook






Backing Up

Because hard disks fail, it is important to back up your files regularly. The data drives are backed up regularly by a tape library, so don't worry about them. The files on your Mac can be backed up in several ways: Automatically, using Time Machine. Make sure to exclude the Parallels directory and disk image (.HDD and .PVS files) because these are huge and will crash Time Machine Manually, by copying your files elsewhere, such as the UT Nas, one of the /data drives.

Updating AFNI

AFNI is frequently updated, so it is important to make sure you have the most recent version. The latest version of AFNI can be downloaded from the AFNI web site

 http://afni.nimh.nih.gov/afni/download/afni/releases/latest

Download the distribution for Intel Macs.

A more automatic way to update (for Intel Macs) is the following. Set the variable "pkg" to the latest version (as of 6/2009, 64-bit 10.5):

 set pkg = macosx_10.5_Intel_64
 wget http://afni.nimh.nih.gov/pub/dist/tgz/{$pkg}.tgz
 tar xvfz {$pkg}.tgz

Optionally, it can be good to test the new version BEFORE overwriting the old version. Here is how we can test SUMA:

 cd {$pkg}
 ./suma

If it works, we copy it over the old version (type "which afni" if you are not sure which directory afni is in)

 mv {$pkg}/* /Applications/AFNI/
 rm -r {$pkg}.tgz {$pkg}

Some statistical programs in AFNI require the free statistical package "R". This can be downloaded from

http://www.biometrics.mtu.edu/CRAN/bin/macosx/

Configuring a New PC

MSIT (Ismael Perez) will install a basic set of software, including Microsoft Office, if asked. Office can also be downloaded from

 \\139.52.5.233\nba-tera\office 2007

MSIT requires security settings, such as automatic logout after 10 minutes. VirusScan can be downloaded from the MSIT web site, currently at

 http://its.uth.tmc.edu/resources_mcafeedownload.htm

If it is to be used for experiments, these security features can be a problem. MSIT will disable them if an exception form is filled out. If the PC is to be used for experiments, install Presentation software. The XVid CODEC is preferred; Virtual Dub and Audigy software are useful free editing tools.

 www.xvid.org

The VLC video player is useful

 http://www.videolan.org/

Also FFDShow

 http://sourceforge.net/projects/ffdshow

If you are running Windows on a Mac via BootCamp in order to run Presentation, you may find it easier to swap the control and Command keys for consistency with Mac OSX. This can be done with

 remapkey.exe 

A program that is in the Windows Server 2003 Resource Kit Tools (free download from Microsoft). Download the tools, go to Start/Run/remapkey Drag the "Left Windows" key onto the "Ctrl" key and vice-versa. This edits the registry and takes effect on the next reboot. The registry can also be edited manually. If you find the Windows Startup and Shutdown sounds annoying they can be turned off from Control Panel/Sounds (in Windows XP).

Configuring a New Mac

As of 2010, all new Macs will be connected to the Active Directory server, which means that you must use your global UT username and password to login to a Mac. MSIT (Ismael Perez) will install a basic set of software, including Microsoft Office, if asked. It can be useful to have Windows installed on a Mac. There are a number of ways to do this. Parallels can be purchased; this allows Windows to be used at the same time as Mac OSX. For the free Boot Camp utility that comes with Mac OSX can be used. In this configuration, only one of OSX or Windows can be used at a time. (Presentation currently only works with Windows under Boot Camp.) In either case, a licensed copy of Windows must be available. The Tandon Lab has a copy of Windows XP with the UT site license key purchased from the UT book store. Copies of this disc work fine to install Windows under Parallels. For Boot Camp, the original disc must be used (with Volume Label VRMPVOL_EN) and possibly without the license key text file. An ISO of this CD can be found on /data6 under Tandlon Lab Warez and burned if not available. For Vista, a copy could be purchased at the bookstore.

AFNI and FreeSurfer are the most commonly used analysis tools and should be installed on every Mac. Depending on the Mac purchased, it may be required to install compilers and other libraries using XTools and fink.

Software that may be handy to have: Adobe Creative Suite; Firefox; Skype

To install software, it may be necessary to have a root password. To create one, type sudo passwd root

If you like a shell different than bash, the terminal program can be configured to use any shell using the command

 chsh -s /bin/tcsh

tcsh is the shell used by MSB.

Every time tcsh starts, it reads commands from the file .cshrc To copy MSB's tcsh, type

 cp /Volumes/data9/surfaces/scripts/.cshrc ~/

Because AFNI uses all three mouse buttons, you must tell the Mac to allow this. Click on system preferences/Mouse and Keyboard/Mouse and select the middle mouse button to be button #3 and the right mouse button to be button #2.

NB: SUMA is unstable with some versions of X11. If SUMA crashes, upgrade your X11 as follows. First see which is the latest version by going to

   http://xquartz.macosforge.org/trac/wiki/Releases

Next, follow these instructions (replacing 2.3.0.pkg with the latest version)

 quit X11
 http://xquartz.macosforge.org/downloads/X11-2.3.0.pkg
 Install the new X11
 logout, login and relaunch X11

Connecting to the new Mac Server

Click here for page on connecting to the new Mac Server Beauchamp:ServerConnection


Configuring a New Mac Server

Special boot-up key strokes (hold down during boot-up): Apple-Option-P-R to erase the PRAM; C to boot up from CD; Option for a list of all boot-up choices, including CD, BootCamp, etc.

New servers can be ordered with two hard drives. These hard drives can be set to mirror one another so that if one fails, the server can continue operating. To do this, boot the Server from the OSX DVD that came with the Server (using the Startup Disk icon in System Preferences.) Then, use Disk Utility to drag and drop the Server hard drives into a RAID set. Finally, reinstall OSX on the new RAID set. Apple recommends creating an image of the boot-up disk onto an external disk using the Image utility. Then, in the event of a hard disk crash the Server can quickly and easily be restored to health, including all configurations. Before reformatting the hard disk, use the disk utility Repair Disc and Repair Permission options. Ask Network Ops (David Zhang) for fixed IP addresses for the server. Currently, servers are located in the NBA VLAN #236. Network Ops needs the MAC addresses for each jack. The MAC address can be read from the rear of the machine or as follows:

 ifconfig

returns

  ether 00:17:f2:06:7b:04

Cabling guys (David Findlay) need to know the Mac address and the VLAN. Current <ac addresses for new XServe (ike) are

en0 00:24:36:f2:b6:e0
en1 00:24:36:f2:b6:dc

with corresponding DHCP

129.106.236.182
129.106.236.183

The HP Tape Loader has Mac address: 002264CCE364 to IP address 129.106.236.185

Bidwell has Mac address 00:0d:93:9e:73:92 to IP address

 129.106.236.182


In general, no extra software (AFNI, etc.) is installed on Servers to ease maintenance and allow them to be devoted to their calling. The Promise RAID can be configured through the serial port-to-RJ11 cable included with the system. It may be possible to do this with the XServe (possibly using the "screen" command in Terminal or a terminal emulation program such as Zterm) but I could not figure out how to connect. Instead, a PC laptop with a serial cable and Microsoft Hyperterminal (C:/Program Files/WindowsNT/hypertrm.exe) was used. For more details, see Beauchamp:PromiseConfig After initial configuration, the RAID can be tweaked via the web interface. Or, through it's web-based management system. The system will automatically obtain an IP address from DHCP. It will broadcast this address via Bonjour. Open Safari, open Preferences/Bookmarks, click "Include Bonjour". Click Bonjour on favorites toolbar and select VTrak. Current IP address is 139.52.6.21. Log in is administrator, password is password. (Computer running Safari must be on same subnet.) To setup the Promise RAID, follow the instructions on http://support.apple.com/kb/HT1164 and http://support.apple.com/kb/HT1200 Which essentially means using the web interface (Adminstrative Tools/Import/Configuration Script) to upload this text file; it is then executed automatically. File:Beauchamp PromiseRAIDConfigScript.txt Also note that there are many different fiber channel cards and cables. See the compatibility matrix at

 http://support.apple.com/kb/HT1769

Creating and synchronizing takes many hours (overnight). After creation of the RAID set, turn on the XServe. You will see an error message saying the disks are not readable. Use Disk Utility to partition the drives (one big partition for each RAID set). Next, use WorkGroup Manager to add users with passwords who can access the drives. To ease managment, separate groups can be created for each partition (e.g. data1 group, data2 group). Users who want access to a particular partition can be easily added or subtracted to the group. Under the Sharing tab of Server Admin, each partition can be given an owner (MSB) and a group (e.g. data1), both of which have Read & Write access. Under the File Sharing tab, click on a Volume to share, then click Share. It will show up in the Share Points section. AppleCare recommends creating a separate folder to share if it will be used for Time Machine backups, to avoid creating share points within share points. Use RAID admin to check on the RAID. A helpful guide is the Mac OSX File Services Administrator manual.

Setting up user accounts. Create accounts for each user (easiest if use same username and ID as on previous system). It is easiest to create one "group" for each RAID set (data drive). Then users can be easily added to groups to give them access to the appropriate data. This is done in Workgroup Manager. Then, new users

XCode/XTools

This step may not be required for newer Macs.

X11 is the display system for Macs and most Unix machines. XCode is a programming environment for the Mac that includes useful compilers and other tools. To install XTools, find the Install Disc that came with your Mac, go into the System Installation Packages folder, and install the pkg files named XTools and XCode.


Optional Installs--> Xcode Tools--> XcodeTools.mpkg

AND

Optional Installs--> Xcode Tools--> Packages--> X11SDK.mpkg

http://trac.macosforge.org/projects/xquartz

1. XcodeTools and X11SDK from the Leopard DVD. 2. Maybe the latest X11 package from trac.macosforge.org 3. glib2-dev glib netpbm openmotif from fink (stable source will do). 4. mesa mesa-libglw mesa-libglw-shlibs mesa-shlibs from fink (unstable source).

If you have an older Mac, you will periodically need to go to Apple.com and download the latest XCode and XTools. They are NOT automatically installed by the Apple Software Update routines.

Fink

This step may not be required for newer Macs.

Fink is a program package manager for Macs. Download the program from the Fink webpage:

http://fink.sourceforge.net/.

The program in the dmg file will be straightforward. You can copy finkcommander to the applications folder for a GUI interface. You should update your libraries every few weeks by running the following: fink selfupdate; fink update-all

To add it to your patch, add source /sw/bin/init.csh To your .cshrc file.


Installing Required Libraries for AFNI

Type the following line to have Fink grab the newest versions:

fink install glib2-dev glib netpbm openmotif3
fink wget

AFNI

AFNI is a suite of programs developed at the NIH for the analysis of functional neuroimaging. The best place to go for installation directions is AFNI’s instruction website:

http://afni.nimh.nih.gov/pub/dist/HOWTO//howto/ht00_inst/html/index.shtml

Unlike the NIH, we install AFNI to the /Applications/abin folder, rather than the local folder of each user. If you want the most up to date version, click the link for compiling AFNI under Mac OS X. You should also check the download webpage each month for updates:

http://afni.nimh.nih.gov/pub/dist/tgz/

To include AFNI in the path, paste the following line into a terminal window:

echo 'set path = ( $path  /Applications/AFNI )' >> ~/.cshrc

FreeSurfer

FreeSurfer is another set of programs developed at NIH for the analysis of functional neuroimaging. We mainly use it for cortical surface reconstruction. Their download page is part of an extensive wiki that describes its many functions.

https://surfer.nmr.mgh.harvard.edu/fswiki/Download

Updates to the software are normally posted on the listserv. To set the correct paths for Freesurfer paste the following lines into a terminal window:

echo ‘setenv FREESURFER_HOME /Applications/freesurfer‘ >> ~/.cshrc
echo ‘source $FREESURFER_HOME/SetUpFreeSurfer.csh' >> ~/.cshrc

optseq2

Optseq2 is a program in the FreeSurfer package for generating random stimulus sequences. In the homepage, you can download the program, view a .ppt w/ more information, and some practice exercises: http://surfer.nmr.mgh.harvard.edu/optseq/

Open a terminal window to run the program w/ Unix commands. Set the following parameters:

set tr = 2 (or however many seconds for each trial)

set numev = 30 (or however many trials of each stimulus you will show each run. For example, if 150 trials/run, and 4 stimuli, you could have 30 stimuli/run. numev = 30)

set numtar = 20 (however many trials of a target stimulus you want to show per trial. The target is an extra stimulus that the subject will respond to just to make sure they're paying attention. Here, there's 150-120 = 30 trials left over, so we can make 20 of those target trials. The remaining 10 trials will automatically be made into control trials.)

set out = Example (whatever you want your filename to be)

Then, you'll run the program (change the 1st line if optseq2 isn't in Applications/freesurfer/bin):

/Applications/freesurfer/bin/optseq2 \

--tsearch 0.001 \

--psdwin 0 16 2 \

--nkeep 8 --o {$out} \

--ntp 150 --tr {$tr} \

--polyfit 2 --focb 1 \

--ev stimulus1 {$tr} $numev \

--ev stimulus2 {$tr} $numev \

--ev stimulus3 {$tr} $numev \

--ev stimulus4 {$tr} $numev \

--ev stimulus5 {$tr} $numev \

--ev target {$tr} $numtar

tsearch is the number of hours you want the program to run. nkeep is the number of total runs. ntp sets the number of trials/run.

Since there are 8 runs in this example, there will be 8 output files which look like Example-001.par . Each file will have 5 columns. Left-most column has the exact time (in seconds) that the stimulus is shown, 2nd column is the numerical value which corresponds to each stimulus type (in this example 0-6, 0 corresponding to control), 3rd column is number of seconds of each trial, 4th column is ????, and right-most column is whatever name you gave to each stimulus event (like "stimulus1" in this example).

Caret

Go to Caret's Download Webpage, register for an account, and download the newest release. Copy the caret folder to the Applications folder on your machine and add the following line to your .cshrc file:

  set path = ($path /Applications/caret/bin/)

Creating Symbolic Links

It is useful to have symbolic links from the command line so you do not need to type the full path to a file. The program ln creates such symbolic links. Here are a couple of examples:

ln –s /Volumes/data9/surfaces/ /surfaces
ln –s /Volumes/data1/UT /UT

The paths are now linked to /surfaces/ and /UT/.


Using the Dell Printer

Download the current drivers for your computer from the Dell website

 http://support.dell.com/support/downloads

The printer IP is 139.52.6.205 To see the current status of the printer go to http://139.52.6.205 Here is a copy of the manual http://openwetware.org/images/8/83/Dell_5100cn.pdf

On Windows XP, you must first add a port, then configure the printer. On Mac OSX, first run the Installer. Then open System Preferences/Print & Fax

Click the "+" button to add a printer,

    • Protocol must be Line Printer Daemon -- LPD

enter the IP address (above.)

There are sometimes several drivers to choose from. The PS (postscript) driver under Windows cannot collate. The PCL driver does. So if you need to collate, use the PCL driver.

Mounting RAID Volumes from Windows

You must have a Mac with a valid user account. On the Mac, go to System Preferences, Sharing, and enable Windows Sharing. The menu should say

 Windows users can access your computer at \\XXX.XXX.XXX.XXX\YYY

For Mac OSX 10.5, go to System Preference, Sharing. Enable File Sharing. Click the "+" button and add your user to the list of Users; change permissions to be Read & Write. Click on Options and Enable "SMB" which is what Windows uses. Click the user name (you will be prompted for your password).

You may also need to able your user account. Look for the message

 Enabled accounts: Ashley Kingon

If your account is not enabled, click on the "Accounts" button and enable it.

Additional steps for Windows VISTA:

Go to the the Start menu and choose 'Computer'

Go to Computer: Local Disk (C:): Windows: regedit

After clicking on the registry editor application:

 Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
 Click on LmCompatibilityLevel
 Set value to 1
 Restart computer

In Windows, go to Internet Explorer and type in the URL above.

Mounting a Volume after sshing to a different machine

For example. I ssh onto tellmore machine. Now I want to access data9 from his machine.

in my home directory (~) (on tellmore) I make a directory called mount, inside of mount I make a directory called data9 (or which ever volume I am mounting), then I mount data9.

cd ~
mkdir mount
cd mount
mkdir data9
mount_afp -i afp://akingon@129.106.236.180/data9 data9
enter password 

and now you can cd into data9

Installing Matlab

In general, MSIT is the best source for IT issues, including installing Matlab. Contact our MSIT rep, currently Ismael Perez, for help. To install Matlab for use in the Beauchamp lab:

1. Download and install matlab here. Get login name and pw from Mike
Note: you will be prompted to install Java run-time environment 5. This will ease the installation.
2. Currently, we use the NBA Computational Core license. To access this license, place the following in the network.lic file in the licenses subdirectory:
 SERVER ms-nba19.ms.uthouston.edu INTERNET=129.106.30.82 27000
 USE_SERVER

January 2009: A common cause for failure is that the DNS service cannot interpret the hostname. Instead, us

 SERVER 129.106.30.82 INTERNET=129.106.30.82 27000
 USE_SERVER

The last "27000" is probably optional. Another cause for failure is that you have downloaded the latest version of Matlab from Mathworks, while our license only supports a previous version. For instance, in Jan 2009, our license only support 2008a, although the website encourages you to download 2008b as the latest version.

Lab Printer

The lab laser printer is a Dell 5100cn with IP address 139.52.6.205 You can check the printer status by going to http://139.52.6.205 In Windows, you must add a Port with this address, then install the correct printer driver and tell it to print to the port. On the Mac, go to System Preferences, Print & Fax, Click the +, Click IP, enter the IP into the address field.


Python

Path:

import sys
sys.path # this will show the current path settings
sys.path.append('C:\new_path') # this will add the new path, however only until the 
                               # current python session is open

To more permanently add a path, use the Windows environment variable PYTHONPATH

Control Panel --> System --> Advanced tab --> Environment Variables (Bottom of page)--> System variables --> look for PYTHONPATH, if it does not exist, use NEW to create it. Use semi-colon to add multiple paths:

C:\path1;C:\path2

IDLE (Python's GUI editor) is slow!

Displaying outputs on IDLE makes the loop very slow. Here is a test:

import time
t0 = time.clock()
counter = 0
while time.clock() <= t0 + 1:
    print "junk"
    counter += 1

Running this code on my 2GHz laptop, results in < 400 Hz loop rate using IDLE. Whereas rate is as high as 15 KHz if the code is run from the command line (by double clicking on the python file).

This is very important when detecting a fast event. For example reading parallel port to detect the TTL pulse from MRI scanner [the philips 3T scanner's pulse is currently only 75 microseconds long].

Presentation

How to get

Download from NeuroBehavioral Systems website (http://www.neurobs.com/) Trial license is free and good for 45 days. Student version is $100 good for 1 year. You will need to place the order first and then fax/email them both sides of your student ID along with the name and contact of your academic advisor. [you need to make an account first to be able to order]

Using two monitors

- In the Windows display settings (right click on Desktop --> Properties --> Settings), choose the second monitor and select "Extend my Windows desktop onto this monitor"

- Restart Presentation, then go to Settings --> Video and add another display (bottom of page) and choose the appropriate driver for each (top of the page)

- Make sure the second monitor (the one that will show the stimulus) is selected as the primary display device.

Getting Help

In addition to the software Help, and looking at previous codes written in the lab, questions may be asked from NeuroBehavioral systems by posting them on their forum. Usually they are very responsive and helpful. Other users may also post a response to your question.

Audio Setup

From Settings-->Audio Choose Custom Mixer-->Primary Buffer Otherwise there will be a ~20ms delay between the time of auditory stimulus presentation and the time that the voltage actually gets to the audio jack! This would be specially crucial for TMS experiments.

Response Button affecting Parallel Port

Make sure you set the response_port_output header parameter to false, otherwise whenever for example response button 3 in pressed, binary code of 3 (00000011) will be sent to the parallel port! In SDL section, before begin type:

response_port_output =  false;

Configuring Presentation to use USB for output

Attaching USB to the computer The computer first needs the NI-DAQmx software installed - download NI USB-6501 (http://zone.ni.com/devzone/cda/tut/p/id/6913). Before you install anything, make sure you have .NET Framework 2.0 installed (available at: http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en). Under the installer features menu, the bare minimum is:

NI-DAQmx 8.8.0
 ->.NET Framework 3.5 Lanugages
 ->.NET Framework 2.0 Lanugages
 ->.NET Framework 1.1 Lanugages
 ->ANSI C Support

You will have to restart after you install the software.

After the restart, connecting the device via USB, Windows will detect a "New Data Acquisition Device", and present you with a window offering several options. Select "Configure and Test This Device Using NI Measurement & Automation Explorer" and run a Self-Test when the window opens. If this passes, the USB device can now be used to control TMS through Presentation.

Configuring Presentation to use USB

Now we need to make a few adjustments to the settings. Under the 'Settings' tab, select the 'Port' option and find the 'Output Ports' box. In this box we need to have a total of 2 ports.

Add the first port, and make sure the following options are set:

Port: USB-6501
Data source: port0
Register span: 1
Inversion mask: 0
Default pulse width: 5 ms

For the second port, the following options need to be set:

Port: USB-6501
Data source: port1
Register span: 1
Inversion mask: 255
Default pulse width: 5 ms

Using Presentation via USB The USB controller uses a new library File:Beauchamp USB TMS library.pcl to control the TMS machine. A sample presentation you can use to test to the USB control of the TMS is available: File:Beauchamp OhmanTMSScenario.sce. In this scenario, the up/down arrows are used to control the intensity of the TMS, while the space bar is used to toggle arming/disarming the device, and the return key is used to fire the device. The sample presentation can also be used to help write code in the future - perhaps the most important point is that it is no longer necessary to define an output port inside the pcl, including the Beauchamp_USB_TMS_library.pcl is sufficient.

Misc Unix Notes

Loops in tcsh are a handy way to automate data processing. Here is an un-commented example. The syntax varies from shell to shell.

set sdall = ( X Y Z P O R T Y)
set idx = 1
foreach ec (FL FM FN FQ FS FU FW FY FZ)
set sd = $sdall[$idx]
@ idx++
echo $idx
end