Skip to content

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

@JCorson

Description

@JCorson

Background

While reviewing PR #318 (DA pacemaking fix for #304), an AP-shape pathology was found in the SNc Dopaminergic preset that no existing test caught: the cell would spike normally (peak ~+27 mV, half-width ~1.7 ms — passing all bands), but then park at −30 mV for 20+ ms after the peak before finally dropping to AHP. Root cause was the Komendantov Na window current (m_inf = 0.79 at −30 mV) dominating the post-spike conductance landscape; SK / Ca dynamics were retuned in #318 to fix it.

Crucially, mean_half_width does not catch this. Half-width is measured at the spike midpoint (~−10 mV) — V can cross that level cleanly during the upstroke and downstroke and still hang at −30 mV afterwards. Likewise mean_ahp_depth finds the eventual AHP minimum even if it arrives 30 ms late.

The new regression test added in #318test_da_single_ap_repolarises_cleanly in tests/integration/test_dopaminergic.py — drives a single AP with the UI ACTION_POTENTIAL protocol (4 µA/cm² × 5 ms) and asserts that V drops below −60 mV within 5 ms after the peak. This pins the post-spike repolarization shape, which is what was actually broken.

Proposal

Add an analogous fall-time test to the preset test files for every preset in NEURON_PRESET_NAMES:

  • tests/integration/test_squid_giant_axon.py
  • tests/integration/test_cortical_pyramidal.py
  • tests/integration/test_fast_spiking_interneuron.py
  • tests/integration/test_purkinje.py
  • tests/integration/test_thalamic_relay.py
  • tests/integration/test_ca1_pyramidal.py
  • tests/integration/test_stn.py
  • tests/integration/test_trn.py

(plus any species-specific files I've missed)

Each test should:

  1. Drive a single evoked AP with that preset's ACTION_POTENTIAL protocol parameters.
  2. Assert V drops below a species-appropriate threshold (typically −55 to −65 mV) within a species-appropriate window after the peak.

The exact threshold/window pair must come from the species literature. Examples:

  • Fast-spiking interneuron: very fast — V should drop below −60 mV within 1–2 ms after peak.
  • Cortical pyramidal: standard — within ~3–5 ms.
  • Thalamic-relay (tonic mode only): tonic AP only; the burst LTS plateau is a separate phenotype and should not be exercised by this test.
  • Purkinje: fast — peak to AHP within 2–3 ms.
  • CA1 pyramidal: ~4–6 ms.
  • STN: ~3–5 ms.
  • TRN (tonic mode only): same caveat as TC — burst-mode rebound LTS is separate.
  • Squid giant axon: HH52 reference; ~5 ms.

For presets that have both tonic and burst modes (TC, TRN), this test should target tonic mode explicitly, since the burst/LTS plateau is a real biological phenomenon and must not be conflated with a pathological Na-window plateau.

Why this matters

Without this test:

  • Half-width and AHP-depth bands can pass while the AP shape is fundamentally wrong (fix(presets): DA SNc pacemaking and AP shape via INaP + Mainen-Sejnowski Kv #318 review).
  • F-I curves can look pathologically wrong because the post-spike plateau prevents proper inter-spike repolarization, but the existing tests only check spike count and rolling-mean voltage — they miss shape problems.
  • A future change to a Na/K kinetic or a leak conductance can silently break repolarization in any preset.

Acceptance criteria

  • A test_<species>_single_ap_repolarises_cleanly test in each preset's test file.
  • Each test cites the literature source for its threshold/window choice.
  • All tests pass on main.
  • Where literature does not support a clean fall-time bound (e.g. burst-prone presets), the test is either restricted to tonic mode or explicitly omitted with a comment explaining why.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions