


Spike detection and extraction; extraction of noise traces
detects spikes from raw signal; re-aligns spikes. supports multiple methods of detection as well as alignment.
this function can detect spikes in two ways: either by thresholding an arbitrary signal (thresholdSignal) or by picking spikes
at pre-defined timepoints (searchInds). Also, the function supports different ways of finding the peak location. Some of them
require a separate signal for this (peakFindSignal).
inputs
======
rawSignal: bandpass filtered signal
realRawMean: running mean of unfiltered signal
thresholdSignal:signal to threshold for detection. empty if detection method used doesnt require thresholding.
runningThres:threshold to use on runningStd. empty if detection method used doesnt require thresholding.
params:struct,with fields:
samplingFreq: sampling freq of rawSignal
detectionMethod: which method is used for detection (see extractSpikes.m)
limit: absolute value of maximal valid real signal. higher/lower then this is considered out of band.
peakAlignMethod: which method is used for peak detection (see extractSpikes.m)
alignMethod: additional parameters for peak finding. only used if peakAlignMethod==1 (see findPeak.m for values)
nrNoiseTraces: 0 (no) or >0 : get maximally x noise traces,each the same length as a waveform
searchInds: localization of peaks, empty if thresholding is used as detection method. (depends on params.detectionMethod)
peakFindSignal: signal used for peak finding. empty if peak finding method doesnt require this.
outputs
=======
rawTrace: raw trace with only the parts left which were taken as spikes
spikeWaveforms: raw waveforms
spikeTimestamps: raw timestamp values, at peak
noiseTraces: noise traces of specified length
orig: urut/2004
updated:
urut/feb07: parameterized dynamic range/out of range limit.
urut/april07: allow direct passing of search Inds as alternative to to-be-thresholded signal.
urut/may07: implemented new peak alignment methods (power,MTEO).
===========================