1 · Izhikevich model
A two-variable spiking model with membrane potential \(v\) and recovery current \(u\), integrated with fourth-order Runge–Kutta.
$$\frac{dv}{dt}=k_1 v^2 + k_2 v + k_3 - u + I,\qquad \frac{du}{dt}=a\,(b\,v-u)$$
When \(v\ge v_\text{th}\), the state resets:
$$v \leftarrow c,\qquad u \leftarrow u + d$$
Defaults: \(k_1{=}0.04,\ k_2{=}5,\ k_3{=}140,\ v_\text{th}{=}30\) mV. Injected current is multiplied by \(I_\text{scale}\).
2 · Hodgkin–Huxley membrane
The membrane is represented as a capacitor in parallel with a selected set of ionic conductances:
$$C_m\frac{dV}{dt}=I_\text{inj}-\sum_{c} I_c,\qquad I_c=\bar g_c\Big(\textstyle\prod_j g_j^{\,p_j}\Big)(V-E_c)$$
Each channel \(c\) is defined by maximal conductance \(\bar g_c\), reversal potential \(E_c\), and zero or more gates \(g_j\). The classic configuration uses fast Na⁺, delayed-rectifier K⁺, and leak.
3 · Gate kinetics
Each gate \(g\in[0,1]\) relaxes toward a voltage- or calcium-dependent steady state.
Alpha/beta rates
$$\frac{dg}{dt}=\alpha(V)(1-g)-\beta(V)\,g$$
$$\alpha,\beta \in \left\{\, A\,\frac{V+B}{1-e^{-(V+B)/C}},\;\; A\,e^{-(V+B)/C},\;\; \frac{A}{1+e^{-(V+B)/C}},\;\; A \right\}$$
Steady state and time constant
$$\frac{dg}{dt}=\frac{g_\infty(V)-g}{\tau(V)},\quad g_\infty(V)=\frac{1}{1+e^{-(V-V_{1/2})/k}}$$
$$\tau(V)=\tau_0+\tau_A\,e^{-((V-V_t)/S_t)^2}$$
Calcium-gated activation
$$g_\infty([\mathrm{Ca}])=\frac{[\mathrm{Ca}]^{\,h}}{[\mathrm{Ca}]^{\,h}+K_d^{\,h}}$$
4 · Intracellular calcium
Calcium-source channels feed a single intracellular pool that relaxes toward a baseline concentration:
$$\frac{d[\mathrm{Ca}]}{dt}=-\gamma\,I_{\mathrm{Ca}}-\frac{[\mathrm{Ca}]-[\mathrm{Ca}]_\text{base}}{\tau_{\mathrm{Ca}}}$$
Inward calcium current is negative and raises \([\mathrm{Ca}]_i\). Defaults: \([\mathrm{Ca}]_\text{base}{=}0.05\) µM, \(\tau_\text{Ca}{=}80\) ms, and \(\gamma{=}0.02\).
5 · Per-spike features
The same extractor is applied to model and recorded voltage:
- Threshold \(V_\text{th}\): first sustained pre-peak \(dV/dt\) crossing, with threshold time and voltage linearly interpolated when the crossing is bracketed by adjacent samples.
- Peak and amplitude: \(A=V_\text{pk}-V_\text{th}\).
- Time-to-peak: \(t_\text{pk}-t_\text{th}\).
- Half-width: width at \(\tfrac12(V_\text{th}+V_\text{pk})\).
- AHP depth: \(V_\text{th}-\min V\) over the post-spike trough.
Fixed extractor settings: 0.2 ms derivative sustain, 10 ms threshold lookback, 30 ms width tail, 20 ms AHP tail, 0.1 mV AHP-recovery criterion, 20 ms pre-stimulus rest window, and 1 ms current smoothing for automatic step detection.
Fitting logic at a glance
The custom objective first matches spike count, then compares the timing and shape of paired spikes.
$$J(\theta)=\begin{cases}J_{\rm count}(\theta),&N_m\ne N_t\\\sum_{k\ne\mathrm{count}}w_k\widetilde D_k+M_{\rm incomplete},&N_m=N_t\end{cases}$$
Different counts: a count penalty and bounded timing guide direct the search. These candidates rank below every equal-count candidate.
Same count: normalized feature errors are weighted and combined. A penalty covers model features that are missing where the target is measurable.
Nm and Nt are model and target counts. Each normalized feature error D̃k is weighted by wk; Mincomplete penalizes missing model features.
6 · Weighted fitting objective
Spike count is evaluated first. A dynamic structural gate is set above the maximum possible equal-count score, so a wrong-count trace cannot outrank an equal-count trace. A bounded spike-time distribution term guides the search within the same wrong-count level. Paired per-spike terms are included only when model and recorded spike counts agree:
$$f(\theta)=\mathbf{1}[d{>}0]\left(C_{\rm match}+G(1+d)+T_{W_1}\right)+w_{\rm count}\min(d,c)+\mathbf{1}[d{=}0]\left(\sum_{k\ne{\rm count}}w_k\widetilde D_k+M_{\rm incomplete}\right)$$
Each measurable target pair is capped before averaging:
$$V_k=\sum_{i\in A_k}|\Delta\phi_{k,i}|,\qquad \widetilde D_k=\frac{1}{|A_k|}\sum_{i\in A_k}\min\left(\frac{|\Delta\phi_{k,i}|}{s_k},c\right)$$
\(d=|N_m-N_e|\), \(c=100\), and \(C_{\rm match}=\max(c,H)\sum_{k\ne{\rm count}}w_k\) is the equal-count loss ceiling. With empirical spike-time Wasserstein distance \(W_1\), \(T_{W_1}=0.25G\,W_1/(W_1+100\,\mathrm{ms})<G\), preserving strict spike-count dominance. After the global search, deterministic current-mapping repair searches the best under-count and over-count basins independently, then ranks every evaluated exact-count candidate using the paired objective above. The bounded search does not prove a global optimum. \(M_\text{incomplete}\) penalizes a model measurement that is missing where the target is measurable; unavailable target measurements are excluded from \(A_k\). \(\phi_k\) covers spike timing, amplitude, threshold, time-to-peak, half-width, and AHP depth. The scales \(s_k\) make millivolt and millisecond differences comparable, while normalized weights satisfy \(\sum_k w_k=1\).