Headstage 64 Configuration
The following excerpt from the Headstage 64 example workflow demonstrates how to configure your Headstage 64 and Breakout Board in Bonsai. This process comprises of the following steps:
- Create an ONIX acquisition context using CreateContext
- Configure the Headstage 64 and the Breakout Board using ConfigureHeadstage64 and ConfigureBreakoutBoard
- Start acquisition using StartAcquisition.
NOTE
To learn more about the top-level configuration motif in every workflow involving ONIX hardware, visit the Configuration Chain Tutorial.
Creating an Acquisition Context
The CreateContext
operator creates a ContextTask that defines the device driver and
index where the hardware exists. The Driver property is set to "riffa" which is the name of the
PCIe device used by ONIX. In this case, the Index property is set to 0 because there is only a
single ONIX system. If a second system is used on the same computer, a second
CreateContext
operator would be required in its own configuration chain, with its
Index property set to 1.
Configuring the Breakout Board and Headstage 64
The ConfigureBreakoutBoard
operator configures the Onix Breakout Board. In the Headstage 64 example tutorial, it is
configured to enable digital inputs to serve as a trigger for the Headstage 64's electrical and optical stimulation and
to enable monitoring of the percentage of memory occupied. This is accomplished by leaving all of the
ConfigureBreakoutBoard
properties set to their default values except its Memory Monitor
Enable
property is set to
True
.
The ConfigureHeadstage64
operator is used to configure the Headstage 64. In the Headstage 64 example tutorial, it is
configured to enable streaming of electrophysiology data from a Rhd2164 amplifier, orientation data from the on-board
Bno055 IMU, and position data from the Ts4231. This is accomplished in the Headstage 64 example workflow by leaving all
of the ConfigureHeadstage64
properties set to their default values.
When the workflow is started, the current time (based on
Coordinated Universal Time) is saved, along with global
hardware parameters governing data acquisition. This is accomplished using a
TimeStamp operator to capture the computer's wall clock
time. The timestamp is saved along with ContextTask
's properties (e.g. AcquisitionClockHz, BlockReadSize,
BlockWriteSize) to a csv file (start-time_<filecount>.csv
) when the workflow is started.
Starting Acquisition
After starting a workflow, the StartAcquisition operator begins data acquisition with the hardware that has been configured. In the Headstage 64 example workflow, most collected data is from the Headstage 64. The rate of data being produced by the hardware will be ~4.1 MB/s. The ReadSize property is set to 4096 bytes, meaning data collection will wait until 4096 bytes of data have been produced by the hardware. At 4.1 MB/s the hardware will produce 4096 bytes every ~1000 μs. This is a hard bound on the latency of the system. If lower latencies were required, the hardware would need to produce data more quickly or the ReadSize property value would need to be reduced.
The WriteSize property is set to 2048 bytes. This determines the amount of memory that is preallocated for temporarily holding data before it is sent to hardware. It is less critical to performance unless the rate that data be written to the hardware is comparable to the rate that the hardware produces data, which is not a common scenario.
NOTE
For an overview of the devices on the Headstage 64 that can be configured through the ConfigureHeadstage64 operator, visit the Headstage 64 Overview.