AllenInstitute / MIES

Multichannel Igor Electrophysiology Suite
https://alleninstitute.github.io/MIES/user.html
Other
22 stars 6 forks source link

apfrequency: Make it more robust #2250

Open t-b opened 2 weeks ago

t-b commented 2 weeks ago

The problem is that it is not robust to fluctuations around spike threshold.

gouwens commented 1 day ago

The basic spike detection procedure implemented in IPFX is:

  1. Identify putative spikes as places where the dV/dt equals or exceeds 20 mV/ms (dV/dt values are taken from a Bessel-filtered version of the voltage trace with a 10 kHz cutoff frequency)
  2. Find putative AP peaks (max Vm between those detected points)
  3. Find the maximum dV/dt between the initially detected points and the putative peaks, then define the putative spike threshold as the point were it reaches 5% of that max value
  4. Drop putative APs where any of the following occur:
    • threshold to peak is less than 2 mV
    • threshold-to-peak time greater than 2 ms
    • putative peak is below -30 mV
  5. Refine the spike thresholds by finding the point for each AP where the dV/dt is 5% of the average maximum dV/dt across all APs in the sweep (rather than its own specific max dV/dt as before)

That's the basic idea - there are some other checks/dealing with edge cases in the code (like trying to figure out if a voltage transient may be throwing off threshold/peak pairs, and that kind of thing), and there are some adjustments to the initial 20 mV/ms dV/dt detection threshold for short square sweeps where the initial passive rise in the membrane potential can exceed that value in some cells.