# How to extract features of individual spikes in non-negative signal?

I have data of non-negative (in the sense there's no signal below baseline) spiking waveforms, which are in the form of a 1D array of numbers:

Spikes that cross some threshold are considered real signal events and I want to be able to measure the properties of individual events such as their amplitude, rise-time, decay-time, duration, and half-width.

The signals are pretty clean so I imagine I don't need some fancy machine learning algorithm. Would a wavelet transform approach give me the results I need? If not, what's the best and simplest approach here?

• Are you simply trying to generate a set of characteristic values in order to classify your events? Is the leading spike and the three larger ones events and the other lower peaks to be disregarded? – Cedron Dawg Mar 19 '18 at 3:27
• @CedronDawg Yes. I first want to detect the “real” events from the noise, which could be a simple threshold of amplitude or area under the curve. Then for each detected event I want summary statistics like rise time, decay time, amplitude, and duration. The reasons I have signals like these that were generated by different sources (neurons in different groups of mice) and I want to see if there are differences in spike shape between different groups. And yes the 3 large spikes are real events and the rest are noise. – Brandon Brown Mar 19 '18 at 7:40
• Check out my answer here as well: dsp.stackexchange.com/questions/48003 – Cedron Dawg Mar 23 '18 at 3:50

Continuous wavelet transforms can provide information and parameters for sparse, piece-wise regular signals. One example related to yours is present in The Continuous Wavelet Transform in MRS, A. Suvichakorn, C. Lemke, A. Schuck, J.-P. Antoine, as exemplified in the following picture.

• I looked into this but since wavelets must be zero-mean functions, they poorly reflect the shape of the events in my signal data – Brandon Brown Mar 20 '18 at 7:16
• Despite zero-mean, the structure and statistics of continuous wavelet coefficients can retrieve data shape parameters – Laurent Duval Mar 24 '18 at 21:10
• Yes, thanks, I've since played with CWT and have had reasonably good results. I will accept this answer for now although I'm still not 100% sold that this will be as robust as I need. – Brandon Brown Mar 25 '18 at 19:55
• Robustness is not the realm of energy preserving functions. Do you have a model for your data? Half-exponential? – Laurent Duval Mar 27 '18 at 19:55

A technique to measure the decay characteristics is given in my answer to "least square fitting to inverse exponential function". This method also gives you a fitness metric which can be calculated in a single loop as well. Note my advice in the comments to use a +++--- pattern instead of a +-+-+- pattern that I give in the answer when finding the rate of decay.

A good amplitude is simply your max value. You may want to average the peak and it adjacent neighbors instead because the peak is sensitive to sampling timing.

A good characteristic duration would be the distance between your nearly vertical line on the left and you fitted decay curve on the right at half your peak height.

An aspect metric could be formed by dividing the width by the height.

That should give you a good set of numbers to identify and describe your events. They are fairly efficient to calculate as well.

The leading spike looks like an event to me as well. If events of interest have to have a certain height it makes this problem that much easier.

Hope this helps.

Ced

Followup

On second thought, you are probably better off measuring the width of your pulse at a fixed height. Perhaps, your cutoff threshold would be a good height because you would always get a value. For the left side you should to a linear regression to find the best line.