I noticed today that something is off.
It was quite apparent that spike sorting (box mode) sorted spikes even when they fell completely outside the box.
I managed to trace the problem down to incorrect way of reconstructing the uV signal from the uint16.
Usually, wave forms are encoded the following way:
s->data[currentIndex] = uint16(value / channels[chan]->bitVolts + 32768);
And then converted back to uV using the following equation:
float value2 = (s->data[currentIndex]-32768) /float(s->gain[currentChannel])_1000.0f;
where gain is defined:
s->gain[currentChannel] = (int)(1.0f / channels[chan]->bitVolts)_1000;
However, due to quantization errors (gain is 16 bit uint), you don't get back the original value. This can lead to significant errors in the uV estimation.
I am going to modify the SpikeObject and get this fixed by converting the gain from uint16 to float.
Hi,
I noticed today that something is off. It was quite apparent that spike sorting (box mode) sorted spikes even when they fell completely outside the box. I managed to trace the problem down to incorrect way of reconstructing the uV signal from the uint16.
Usually, wave forms are encoded the following way: s->data[currentIndex] = uint16(value / channels[chan]->bitVolts + 32768); And then converted back to uV using the following equation: float value2 = (s->data[currentIndex]-32768) /float(s->gain[currentChannel])_1000.0f; where gain is defined: s->gain[currentChannel] = (int)(1.0f / channels[chan]->bitVolts)_1000;
However, due to quantization errors (gain is 16 bit uint), you don't get back the original value. This can lead to significant errors in the uV estimation.
I am going to modify the SpikeObject and get this fixed by converting the gain from uint16 to float.