R Analysis and Visualization of ECOG Data (RAVE)
Return to list of tutorials.
Getting your data into RAVE
- The general folder structure is RAVE_raw_dir/subject_code/block_number/*.mat.
- For instance, /Volumes/data/rave_data/raw/NAA/001/, /Volumes/data/rave_data/raw/NAA/002/ and /Volumes/data/rave_data/raw/NAA/003/ contain the data for blocks 001 through 003 for subject NAA. The RAVE raw dir is located at /Volumes/data/rave_data/raw
- RAVE requires one .mat file per electrode. Inside this .mat file is a variable with the EEG voltage data. The name of the variable should be analogTraces
- The naming of each channel follows a strict pattern. For example: NAADatafile003_ch1.mat means subject NAA, block 003 (the leading 0 are important) and channel 1.
- When you run RAVE pre-process application (rave_preprocess()), the program requires you first input the subject code and project name.
- Press Create Subject after inputting the Subject Code and Project Name and the application will create a subject directory in your RAE_data_dir/ProjectName folder and then scan your RAVE_raw_dir to look for available blocks.
- The user then selects the blocks that go with the particular experiment (using a multi-selector).
- After selecting the blocks, input the electrodes (a range may be specified) and the sampling rate (in Hz, must be the same for all channels across all blocks)
- Press the "Import Subject" button to import the raw data into that subject's directory in your RAVE_data_dir/ProjectName.
- To summarize: raw data is placed into raw_dir by the user, then RAVE pre-processes the data and places it into data_dir.
[Deprecated] Older method for formatting data for RAVE
- Assume you have pre-processed your subject and have 1 mat file per electrode
- Pre-processing pipeline in our data includes common average reference, epoching, notch filtering, time-frequency analysis using 'multitaper method' (dpss for 30-200 Hz, hanning for 2-30 Hz), resulting in power-spectra over time at each frequency
- Each mat file contains a matrix with: [trial, freq, time]
- these mat files are the output of matlab script 'write_out_electrodes.m'
- note that since preprocessing at low and high frequencies is performed using different tapers, the 'write_out_electrodes.m' script must concatenate 2-30 Hz with 32-200 Hz data prior to creating mat files
- Also need information about each dimension in meta folder
- 'trials.csv:' data corresponds to the 1st mode in the .mat file.
- Column 1: Number (numeric) -- cell A1 is 'Number', A2 reads '1', A3 reads '2', ... , An reads 'n'
- Column 2: Type (string) -- cell B1 reads 'Type', then data begins in B2
- Column 3: Stimulus (string) -- cell C1 reads 'Stimulus', then data begins in C2
- Other columns will be imported as a string and made available to the module
- Note in rAFE GUI, conditions will appear as 'Stimulus_Type'
- 'frequencies.csv:' has the frequencies that correspond to the 2nd mode in the .mat file
- Column 1: Frequency (numeric) -- cell A1 reads 'Frequency', then data begins in A2
- 'time_points.csv:' has the timestamps that correspond to the 3rd mode in the .mat file
- Column 1: Time (numeric) -- cell A1 reads 'Time'
- By default, many modules consider values prior to time '0' as the baseline period. In many modules this can also be changed.
- 'electrodes.csv:' Contains information corresponding to each electrode. In RAFE, this corresponds to the 4th mode of the data, but this is not directly represented in users' the file system.
- Column 1: Label (string) (this is used throughout the application as a unique identifier)
- Column 2: Number (integer)
- This value is not explicitly used in the module, but is required here to facilitate matching with the raw data.
- Column 3: Valid (0 or 1)
- If the value is 0, the electrode is not imported into RAFE, or cached, or even checked for existence in the data/ directory. We allow for invalid electrodes to provide a way to match between the raw data files coming from the recording system and the final data that will be analyzed.
- Column 4-6: Coordinates for the electrode in the space of the surface file
- Coord_x (numeric)
- Coord_y (numeric)
- Coord_z (numeric)
- Create a folder in your RAFE data directory (you will tell the application where your data are located, so this location can be arbitrary).
Return to list of tutorials.