Karas Lab:RAVE Module

From OpenWetWare
Jump to navigationJump to search

Home        Contact        Lab Notebook        Lab Members        Publications        Research        Talks       

Starting Off


I would recommend starting off by just opening up a new R script - we can worry about integrating into RAVE's module system later. But how do you load the data that your RAVE program will eventually be working with into the script? That's where rave::rave_prepare() comes in. This function loads the specified subject's data into the workspace environment so that you can test your script with the data loaded without having to go into the RAVE environment. Here is an example:

  subject = 'Demo/DemoSubject',
  electrodes = 13:15,
  epoch = 'auditory_onset',
  time_range = c(1,2),
  reference = "default"

Four variables will be loaded into the environment: data_check, module_tools, preload_info, and subject. To access the RAVE-processed data, use module_tools. For example, for power data, you would use

s <- module_tools$get_power()

or for voltage data,

s <- module_tools$get_voltage() 

You can type module_tools$ to see a list of the different data you can access. After the module tools command, you still need to extract the data from the s object.

data <- s$get_data()

This data variable will contain the matrix with the data that you are looking for. For example, if we were working with power data, this matrix would be the 4D matrix of data with dimensions of Trial, Frequency, Time, and Electrode #.

Making the RAVE Module Framework

RAVE already provides a template for creating modules. If you go to File -> Create New Project in RStudio, under the Project Type selector, scroll down to RAVE Module. Choose what your module name will be, and it will automatically generate the directory structure and basic files for a working RAVE module.