escope.spikex module

escope.spikex.cleancontext(idx: ndarray[int], dat: ndarray[float], test: List[range] = [range(-25, -12), range(12, 25)], testabs: List[range] = [range(-25, -4), range(4, 25)], thr: float = 0.5, absthr: float = 0.9) ndarray[int]

CLEANCONTEXT - Drop spikes if their context is not clean idx = CLEANCONTEXT(idx, dat) treats the spikes at IDX (from DETECTSPIKES run on DAT) to the classic filtering operation in MEABench. That is, spikes are dropped if :

  1. there are samples with voltage >50% of peak voltage at a distance of 12 to 25 samples before or after the main peak,

or
  1. there are samples with absolute voltage >90% of peak at a distance of 4 to 25 samples before or after the main peak.

Optional argument TEST may specify a list of ranges to test at 50%; TESTABS may specify a list of ranges to test at 90% with abs. value. THR and ABSTHR override the 0.5 and 0.9 default test thresholds. Set THR or ABSTHR to None to avoid the corresponding test.

Spikes too near the start or end of the recording are dropped unconditionally.