Spikes in time series
I would try a median filter.


Let your original signal be $f[n]$.
Median filter $f[n]$ using $N$ pixels, where $N &gt; 2 \times S + 1$, where $S$ is the maximum number of samples in the spike. The resulting signal, lets call it $g[n]$ should have all the spikes removed.
Find the absolute of the difference between the two signals, $h[n] = |f[n] - g[n]|$. This signal represents the spikes.
Count the number of positive transitions in $h[n]$ that are above a threshold. This is the number of spikes.


Example:

Original signal $f[n]$



Median filtered signal $g[n]$



Absolute difference $h[n]$