You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently SpikeTrain waveforms are defined as a 3D quantity (array). This makes sense if all waveform have the same length, which in most cases is true. However, in rare cases (eg. with a spike close to the end of the recording signal (AnalogSignal) or very long extraction time windows for waveforms) some waveforms may be lacking a few samples at the beginning or end.
When using quantities objects it is not possible to use 'None' as for simple numpy arrays to indicate missing values as this results in "TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'". It is also not possible to leave incomplete waveforms out and only store complete ones, as the number of spikes has to match the number of waveforms for a given SpikeTrain.
I would be happy about suggestions on how to handle this and still use quantities.
Hi Samuel,
thanks for the hint of using np.NaN, this works indeed also with quantities. However one still needs to keep in mind that it does not work with arrays of dtype int.
If you are not using spiketrain waveforms any more, can you go a bit more into detail how you are dealing with waveforms instead?
Store somewhere the indexes of the peak of the waveform.
Never try to get all thewaveform at the same time in memory
Sample some indexes (10000) among all indexes of peak (some million !).
Construct on the fly the waveform 3D corresponding to thoses index directly from the signal
Do some stuff with it.
Get some other indexes.
I also do:
on the fly locally oversample the signal chunk for a better waveform alignement on peak.
For the spike sorting, we need to estimate the density probality of the amplitude of the waveform.
For this no need to get all the waveforms at the same time.
Activity
samuelgarcia commentedon Jun 21, 2017
Hi Julia,
Historically, I was the guy that introduced all that waveforms stuuf for SpikeTrain.
Today I am a bit more expert in spike sorting technics, I known that storing waveforms on the fly is something bad:
So today, I don't use anymore these SpikeTrains.waveforms.
So, I would vote for removing theses SpikeTrains.waveforms instead of improving it.
But, this is not possible because some formats still store this, so we need an object for this.
For this specific problem, I would put np.NaN for padding this spikes near the border.
For the problem of swapping axes for waveforms, I am OK but it is a piece of work.
Best
Samuel
apdavison commentedon Jun 21, 2017
👍 for
np.NaNJuliaSprenger commentedon Jun 21, 2017
Hi Samuel,
thanks for the hint of using np.NaN, this works indeed also with quantities. However one still needs to keep in mind that it does not work with arrays of dtype int.
If you are not using spiketrain waveforms any more, can you go a bit more into detail how you are dealing with waveforms instead?
samuelgarcia commentedon Jun 21, 2017
What I do in tridesclous (https://github.com/samuelgarcia/tridesclous):
I also do:
For the spike sorting, we need to estimate the density probality of the amplitude of the waveform.
For this no need to get all the waveforms at the same time.
Samuel
samuelgarcia commentedon Jun 14, 2023
outdated debate and corner case.