aqnwb 0.1.0
|
For users wanting to integrate NWB with a particular data acquisition software, here we outline the steps for a single recording from file creation to saving.
Below, we walk through these steps in more detail.
First, create an I/O object (e.g., HDF5IO) used for writing data to the file. AqNWB provides the convenience method, createIO to create this object using one of the supported backends. For more fine-grained control of different backend parameters, you can create your own std::shared_ptr
using any of the derived BaseIO classes.
Next, create a RecordingContainers object to manage the different Container objects with the datasets that you would like to write data to.
Next, constructs the NWBFile object, using the I/O object as an input. Then, initialize the object to create the basic file structure of the NWBFile.
Next, create the different data types (e.g. ElectricalSeries or other AQNWB::NWB::TimeSeries "TimeSeries") that you would like to write data into. After creation, these objects are added to the RecordingContainers object so that it can mana ge access and data writing during the recording process. When adding containers, ownership of the Container is transferred to the RecordingContainers object, so that we can access it again via its index. New containers will always be appended to the end of the private member `RecordingContainers.m_containers
object and their index can be tracked using the RecordingContainers.size of the input recordingArrays
.
Then, start the recording process with a call to the startRecording
function of the I/O object.
During the recording process, use the RecordingContainers as an interface to access the various Container object and corresponding datasets and write blocks of data to the file. Calling flush()
on the I/O object at any time will ensure the data is moved to disk.
When the recording process is finished, call stopRecording
from the I/O object to flush any data and close the file.