Does anyone know how to do spike triggered average in Igor. I have a wave with multiple events and I wish to align all the events within the wave which pass a certain threshold.
Function STA(voltage,threshold,length)wave voltage
variable threshold,length
FindLevels/Q/DEST=spiketimes voltage,threshold // this is crude, and should be made more appropriate for your applicationif(V_flag==2)DoAlert0,"No spikes found"return -1endif// I'll make an averaged wave centered on spikes with total length "length" and the same scaling as the original signalvariable dt=DimDelta(voltage,0)Make/O/D/N=(length/dt) spikeTriggeredAverage=0SetScale/Px,(-length/2),dt,spikeTriggeredAverage
variable ii
for(ii=0;ii<numpnts(spiketimes);ii+=1)
spikeTriggeredAverage+=voltage(spiketimes[ii]+x)endforEnd
June 22, 2011 at 09:42 am - Permalink