Skip to content

Add post-spike repolarization (fall-time) tests to all neuron presets#364

Merged
JCorson merged 9 commits into
mainfrom
issue-321-fall-time-tests
May 11, 2026
Merged

Add post-spike repolarization (fall-time) tests to all neuron presets#364
JCorson merged 9 commits into
mainfrom
issue-321-fall-time-tests

Conversation

@JCorson
Copy link
Copy Markdown
Owner

@JCorson JCorson commented May 11, 2026

Summary

  • Adds a test_<species>_single_ap_repolarizes_cleanly regression test to each of the 8 remaining preset test files (squid, FS interneuron, cortical pyramidal, Purkinje, thalamic relay, CA1 pyramidal, STN, TRN), mirroring the existing test_da_single_ap_repolarizes_cleanly reference test added in fix(presets): DA SNc pacemaking and AP shape via INaP + Mainen-Sejnowski Kv #318.
  • Each test drives a single evoked AP with that preset's UI ACTION_POTENTIAL protocol parameters, finds the global voltage peak, and asserts V drops below a species-appropriate threshold within a species-appropriate window — catching the post-spike Na-window plateau pathology (V parking at ~−30 mV after the spike) that mean_half_width and mean_ahp_depth miss.
  • For TC and TRN the test is restricted to tonic mode (driven from rest, no prior hyperpolarization) so the real LTS / HP92 rebound plateau is not conflated with a pathological plateau; the docstrings call this out explicitly.
  • Each assertion message cites the literature source for its threshold/window choice (HH52; Erisir 1999 / Wang & Buzsáki 1996; McCormick 1985 / Bean 2007; Raman & Bean 1999 / Häusser & Clark 1997; McCormick & Huguenard 1992; Spruston & Johnston 2008 / Storm 1990; Bevan & Wilson 1999 / Beurrier 1999; Huguenard & Prince 1992 / Bal & McCormick 1993). Thresholds sit a few mV below each file's existing AHP-depth band so a single weakly-driven AP still clears them while the −30 mV plateau is firmly excluded. No xfail markers — all tests pass on the current main.
  • Adds a small _ms_to_samples module helper to test_trn.py (the only one of the 8 files that lacked it), matching the other preset test files.

Closes #321

Test plan

  • test_squid_single_ap_repolarizes_cleanly — V < −60 mV within 5 ms after peak (10 µA/cm² × 10 ms)
  • test_fs_single_ap_repolarizes_cleanly — V < −58 mV within 2 ms after peak (30 µA/cm² × 5 ms)
  • test_cp_single_ap_repolarizes_cleanly — V < −52 mV within 5 ms after peak (2 µA/cm² × 15 ms)
  • test_pk_single_ap_repolarizes_cleanly — V < −53 mV within 3 ms after peak (5 µA/cm² × 5 ms, on pacemaking)
  • test_tc_single_ap_repolarizes_cleanly — V < −53 mV within 4 ms after peak (8 µA/cm² × 0.5 ms, tonic mode)
  • test_ca1_single_ap_repolarizes_cleanly — V < −52 mV within 6 ms after peak (2 µA/cm² × 15 ms)
  • test_stn_single_ap_repolarizes_cleanly — V < −53 mV within 5 ms after peak (2 µA/cm² × 5 ms, on pacemaking)
  • test_trn_single_ap_repolarizes_cleanly — V < −53 mV within 3 ms after peak (5 µA/cm² × 2 ms, tonic mode)

JCorson added 9 commits May 11, 2026 13:09
Guard against a post-spike Na-window plateau that mean half-width and
AHP-depth metrics do not catch: assert V drops below −60 mV within 5 ms
after the peak of an evoked AP (HH52 reference).
Assert V drops below −58 mV within 2 ms after the peak of an evoked AP,
matching the fast Kv3-driven AHP of cortical FS interneurons (Erisir 1999;
Wang & Buzsáki 1996) and guarding against a post-spike Na-window plateau.
Assert V drops below −52 mV within 5 ms after the peak of an evoked AP,
matching the RS-pyramidal fast AHP (McCormick 1985; Bean 2007) and
guarding against a post-spike Na-window plateau.
Assert V drops below −53 mV within 3 ms after the global voltage peak of
an evoked AP riding the autonomous pacemaking, matching the fast Purkinje
AHP (Raman & Bean 1999; Häusser & Clark 1997).
Assert V drops below −53 mV within 4 ms after the peak of an evoked
tonic-mode AP (driven from rest, no LTS rebound), matching the TC fast
AHP (McCormick & Huguenard 1992).
Assert V drops below −52 mV within 6 ms after the peak of an evoked AP,
matching the CA1 Ca²⁺/IKCa-shaped AHP (Spruston & Johnston 2008; Storm
1990; Bean 2007).
Assert V drops below −53 mV within 5 ms after the global voltage peak of
an evoked AP riding the autonomous pacemaking, matching the STN fast AHP
(Bevan & Wilson 1999; Beurrier et al. 1999).
Assert V drops below −53 mV within 3 ms after the global voltage peak of
an evoked tonic-mode AP (no prior hyperpolarization, no HP92 rebound),
matching the TRN fast AHP (Huguenard & Prince 1992; Bal & McCormick 1993).
Decouple the fall-time stimulus from the repetitive-firing fixture
constant so it tracks the ACTION_POTENTIAL protocol value directly,
matching the other seven preset fall-time tests (PR review).
@JCorson JCorson merged commit a2ccdd0 into main May 11, 2026
4 checks passed
@JCorson JCorson deleted the issue-321-fall-time-tests branch May 11, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add post-spike repolarization (fall-time) test to all neuron presets

1 participant