Skip to content

Data Streaming Module

The Data Streaming module provides functionality for continuous streaming of signals to the API client and saving of data to file. The streamed signals are resampled onto a common sampling grid corresponding to that with the highest sampling rate. Linear interpolation is used for up sampling. The module provides a minimal interface - the duration of the capture is all that has to be specified, plus some extra parameters if saving to file is required.

Depending on the value of the node /duration which determines the acquisition duration, the Data Streaming module offers two modes of operation: Finite Acquisition and Endless Acquisition.

Finite Acquisition

When setting a positive value to the node /duration, the module is configured in its finite acquisition mode. In this mode, the module acquires the subscribed signals and returns data with a length approximately equal to the duration value. After starting the acquisition with the execute() method, one can check the acquisition progress with the progress() method, and the end of acquisition with the finished() method. When the acquisition is complete, the value of the node /duration will be updated to the actual duration of the acquired data. This mode is useful when a short and well-defined duration of data is needed.

Endless Acquisition

When the node /duration is set to 0, the module is configured in endless acquisition. In this mode, the module acquires data from the subscribed signals forever until the method finish() is called to stop the acquisition. To avoid large memory consumption, one can frequently read the acquired data using the read() method while the module is running. Alternatively, one can configure the module to only save into files using the node /save/saveonly and remove the need to read data from the module. The endless acquisition mode is useful when data recording for a long duration is required. The duration of acquisition can be handled using a timeout loop.

Save to Files

The Data Streaming module offers the following three approaches to record data into files:

  • Save before reading data
  • Save while reading data
  • Save without reading data

Moreover, the supported file formats include HDF5, MATLAB, and CSV.

Save before reading data

After the module execution is complete but before reading the data by the read() method, one can set the node /save/save to start writing the acquired data into files. The node stays high until the writing process is complete and then it resets to low.

Save while reading data

By setting the node /save/saveonread, the acquired data will be saved into files every time the read() method is called.

Save without reading data

In contrast to the other two save approaches, this method is only available to the Data Streaming module. By setting the node /save/saveonly, one does not need to wait until the module execution is complete or to read data to be able to record them into files. This way, as the module execution progresses, the data will be saved into files. This approach is particularly useful for long-running acquisition where the raw data are recorded in files for future post-processing.

Node Documentation

This section describes all the nodes in the Data Streaming Module node tree.

duration

/duration

Properties: Read, Write
Type: Double
Unit: Seconds

The recording length of the data to be captured. A value of zero means endless capture, in which case the module has to be stopped by calling the finish() method. The value may be adjusted upwards by the module to match its internal sampling grid.

save

/save/csvlocale

Properties: Read, Write
Type: String
Unit: None

The locale to use for the decimal point character and digit grouping character for numerical values in CSV files: "C": Dot for the decimal point and no digit grouping (default); "" (empty string): Use the symbols set in the language and region settings of the computer.

/save/csvseparator

Properties: Read, Write
Type: String
Unit: None

The character to use as CSV separator when saving files in this format.

/save/directory

Properties: Read, Write
Type: String
Unit: None

The base directory where files are saved.

/save/fileformat

Properties: Read, Write
Type: Integer (enumerated)
Unit: None

The format of the file for saving data.

Value Description
0 "mat": MATLAB
1 "csv": CSV
2 "zview": ZView (Impedance data only)
3 "sxm": SXM (Image format)
4 "hdf5": HDF5
/save/filename

Properties: Read, Write
Type: String
Unit: None

Defines the sub-directory where files are saved. The actual sub-directory has this name with a sequence count (per save) appended, e.g. daq_000.

/save/save

Properties: Read, Write
Type: Integer (64 bit)
Unit: None

Initiate the saving of data to file. The saving is done in the background. When the save has finished, the module resets this parameter to 0.

/save/saveonly

Properties: Read, Write
Type: Integer (64 bit)
Unit: None

Set to 1 to enable automatic saving of the streaming data to file, in the selected file format (HDF5, CSV or MATLAB), without the need to call the read command. When enabled, the read command has no effect.

/save/saveonread

Properties: Read, Write
Type: Integer (64 bit)
Unit: None

Automatically save the data to file immediately before reading out the data from the module using the read() command. Set this parameter to 1 if you want to save data to file when running the module continuously and performing intermediate reads.