Hoffman2:MATLAB:EEGLAB: Difference between revisions

From Center for Cognitive Neuroscience
Jump to navigation Jump to search
(Created page with "Back to all things Hoffman2 Back to all things MATLAB The three of the most recent versions of EEGLAB are maintained on Hoffman2 for the FMRI g...")
 
No edit summary
Line 55: Line 55:


===Run ICA===
===Run ICA===
If you prepared multiple datasets for ICA, you could submit many jobs in parallel to speed up the processing time.
# Use a [[Text Editors|text editor]] to make a script (e.g. icaScript.sh) on Hoffman2 with the following contents
# Use a [[Text Editors|text editor]] to make a script (e.g. icaScript.sh) on Hoffman2 with the following contents
#: <pre>#!/bin/bash&#10;&#13;/u/home/FMRI/apps/eeglab/current/functions/resources/ica_linux < path/to/sc/file </pre>
#: <pre>#!/bin/bash&#10;&#13;/u/home/FMRI/apps/eeglab/current/functions/resources/ica_linux < path/to/sc/file </pre>

Revision as of 00:45, 18 April 2012

Back to all things Hoffman2

Back to all things MATLAB

The three of the most recent versions of EEGLAB are maintained on Hoffman2 for the FMRI group in the directory

/u/home/FMRI/apps/eeglab


Adding EEGLAB to your MATLAB path

Choose one of the versions from

/u/home/FMRI/apps/eeglab

and add it to your MATLAB path by doing.

  1. Start MATLAB on Hoffman2
  2. Go to
    "File" > "Set Path..."
    • Click "Add with Subfolders..."
    • Navigate to
      /u/home/FMRI/apps/eeglab
      choose which version you'd like to use and click on it.
    • Click "Ok"
    • To save this for future sessions, click "Save."
    • If you don't want to save this path, click "Close" and then click "No" on the window that pops up.
  3. Go to the MATLAB command line and start EEGLAB by typing
    >> eeglab


binica

If you want to run ICA decomposition on your data, it can often be a very time-intensive process. Doing this through the EEGLAB GUI (runica) is almost an order of magnitude slower than doing it with binica or via command line. So let's walk through how to do this the fastest (most parallelizable) way by submitting jobs on Hoffman2.


Export your data from NetStation

  1. If you are going to preprocess your data in NetStation, do so first.
  2. Export your data in the NetStation simple binary format which produces files with the .raw extension. Upload this to Hoffman2 by your choice method.


Prep your data for ICA

  1. Start up MATLAB on Hoffman2 and start EEGLAB
  2. Go to
    "File" > "Import data" > "From Netstation binary simple file"
    • Find your .raw file and select it.
    • Click "Ok" on the first pop up window, and in the second give your dataset a name before clicking "Ok.""
  3. When EEGLAB finishes importing your data Done will appear above the command line.
  4. At this time, do any preprocessing you'd like on the data in EEGLAB/MATLAB.
  5. Use the command
    >> /u/home/FMRI/apps/examples/binica/prep4binica(ALLEEG.data, ALLEEG.nbchan*ALLEEG.pnts, 'verbose', 'on', 'filenum', FILENAME);
  6. This will save out the necessary files to run ICA:
    • data in a float-point file, .fdt
    • parameters for ICA in a configuration file, .sc
  7. Exit out of EEGLAB ("File" > "Quit").
  8. Exit out of MATLAB


Run ICA

If you prepared multiple datasets for ICA, you could submit many jobs in parallel to speed up the processing time.

  1. Use a text editor to make a script (e.g. icaScript.sh) on Hoffman2 with the following contents
    #!/bin/bash
    &#13;/u/home/FMRI/apps/eeglab/current/functions/resources/ica_linux < path/to/sc/file 
    where you replace /path/to/sc/file with the full path to the .sc file created by prep4binica.
  2. Make the script executable
    chmod 750 /path/to/script
    replacing /path/to/script with the path to your script file.
  3. Submit this script as a job, we recommend demanding at least 12 hours and 2GB of RAM for your job.
  4. Wait for the script to complete.


Import ICA data back to EEGLAB

  1. Start up MATLAB on Hoffman2 and start EEGLAB
  2. Go to
    "File" > "Import data" > "From Netstation binary simple file"
    • Find your .raw file and select it.
    • Click "Ok" on the first pop up window, and in the second give your dataset a name before clicking "Ok.""
  3. When EEGLAB finishes importing your data Done will appear above the command line.
  4. Go to
    "Edit" > "Dataset into"
    • Click "Browse" next to "ICA weights array or text/binary file (if any):" and find the ICA weight file (.wts extension).
    • Click "Browse" next to "ICA sphere array or text/binary file (if any):" and find the ICA sphere file (.sph extension).
    • Click "Ok".
  5. You should now be able to view the ICA information within EEGLAB.