Sweep-based Recording

By default, RTXI run continuous protocols, similar to a chart recorder. We are currently working on environments to make it easier to visualize results within RTXI from sweep-based protocols. Meanwhile, you can implement sweep-based protocols in your custom modules by using counters for each cycle, or by keeping track of the time lapsed since you unpaused your module. It is also possible to synchronize your module with the Data Recorder such that each sweep is a separate Trial in the HDF5 file. The following two functions are equivalent to manually starting and stopping the Data Recorder using the buttons:

DataRecorder::startRecording();
DataRecorder::stopRecording();

Simply call these functions when your criteria are met. In the following example, each trial has a fixed length, triallength, and the current trial number is tracked. systime is the total time elapsed since the module was unpaused. This example also has a boolean flag that checks if the user wants to record data. If recording is on, and the end of a trial has been reached: 1) the Data Recorder stops recording to close the Trial in the HDF5 file, 2) the module increments the trial number to reset the stop criteria, and 3) the Data Recorder starts recording again to create the next Trial in the HDF5 file.

if (systime > triallength * (trial + 1))
{
  if (recordon)
    DataRecorder::stopRecording();
  trial++;
  if (recordon)
     DataRecorder::startRecording();
}

Depending on how you write the code, you may need to open the Data Recorder before opening a module that requires the Data Recorder. Not doing so could result in the module failing to load or RTXI crashing.

Bookmark the permalink.

Comments are closed.