C++ API#
When I run make
in the */maxlab_lib/
folder I get compilation errors. How can I solve this?
The examples are meant to work out of the box. If you get compilation erros it is most probably a toolchain issue.
Please make sure that you have installed at least GCC 11
and make sure that when you run
g++ --version
it actually runs version 11 or newer.
Changing the gain value in MLL does not appear to change the range of data?
The gain value changes the value of the LSB (the multiplication factor to get from bits to volts/microvolts). The range of the bits does not change, as it always is 10bits (2^10, i.e. 0-1023). But what one bit corresponds to, does change (via the LSB).

In what units is the amplitude?
There are two member variables that can hold the amplitude:
That data is in ‘bits’. These bits can be between 0 and 1023. To convert from bits to volts or microvolts, one needs to multiply the bits value with the LSB. The LSB depends on the gain used and is
Gain |
LSB [µV] |
---|---|
1 |
3222.66 |
7 |
460.38 |
112 |
28.77 |
512 |
6.29 |
1024 |
3.15 |
2048 |
1.57 |
We notice that we do not get consecutive frame numbers. Is our PC too slow?
Likely the system is not too slow. It does not need a very powerful system to keep up with the data. But it might depend on what you’re doing with the data in-between two data reads/two frames. If you want to do more complicated computations, it is advisable to use two or more threads (one thread to receive the data, one thread to process the data). But yes, in rare cases, a faster computer might help as well.
How do the amplitudes in the raw data need to be interpreted?
The member maxlab::RawFrameData::amplitudes
is of type float*
and is arranged as follows:
One call to
maxlab::DataStreamerRaw_receiveNextFrame()
yields one sample of data, i.e. one vector offloat
values where each value represents one sample from one of the 1024 channelsIndividual elements (channels) of that sample can be accessed:
RawFrameData rawFrame;
float *dataRaw = rawFrame.amplitudes;
float channel0 = dataRaw[0];
float channel1 = dataRaw[1];
// etc.
What is the relationship between frame-number and the real time?
The frame numbers start at 0, when you turn on the device (hub). Then, they should be monotonically increasing with each frame. I.e. since the data is coming with 20kHz, there will be 20’000 frame numbers per second, and each frame number will be the preceding number +1. However, the data might arrive from the system with some jitter. So the individual frames cannot be used as precise time source.
How can I access electrode positions and channel mappings in C++ code?
Electrode positions and channel mappings can be accessed by manually parsing a .cfg
file or
by using the Python class mx.Config
and passing data from
the Python script to the C++ script.
See also: What information is contained in the .cfg files of the array?
What are the differences between the FIR and IIR filters?
The FIR filter is a finite impulse response filter while the IIR filter is an infinite impulse response filter.
Both are used to extract spike data from raw voltage traces. However, the data from the two are not comparable: they are different methods of spike detection and will result in spikes of different recorded amplitudes.
The two filters have different latencies. The FIR filter has a latency of about 2048 / sampling rate
ms
while the IIR filter has a latency of about 10 / sampling rate
ms.