Skip to content

Add Kobayashi model with PyNN#806

Draft
HarshKhilawala wants to merge 2 commits into
NeuralEnsemble:masterfrom
HarshKhilawala:add-kobayashi-model
Draft

Add Kobayashi model with PyNN#806
HarshKhilawala wants to merge 2 commits into
NeuralEnsemble:masterfrom
HarshKhilawala:add-kobayashi-model

Conversation

@HarshKhilawala

Copy link
Copy Markdown

Add Kobayashi model to PyNN

Kobayashi, R., Tsubo, Y., & Shinomoto, S. (2009). Made-to-order spiking neuron model equipped with a multi-timescale adaptive threshold. Frontiers in computational neuroscience, 3, 9. Link

@HarshKhilawala

Copy link
Copy Markdown
Author

@apdavison Can you review this? I tried it as per NEST backend. (Yet to add for NEURON backend)

@HarshKhilawala

Copy link
Copy Markdown
Author

This PR fixes issue #366

@apdavison

Copy link
Copy Markdown
Member

This looks good so far. Please could you either add a new example script, or extend the "cell_type_demonstration.py" example?

@HarshKhilawala

Copy link
Copy Markdown
Author

Will extend "cell_type_demonstration.py"

@HarshKhilawala

Copy link
Copy Markdown
Author

@apdavison I didn’t complete the work and left it pending. [REASON: FORGOT].

  • Kobayashi Model still PENDING/INCOMPLETE to be implemented with NEURON backend of PyNN.

  • Kobayashi Model still PENDING/INCOMPLETE to be implemented with Brian2 backend of PyNN.

@HarshKhilawala

Copy link
Copy Markdown
Author

Extension "cell_type_demonstration.py" PENDING

@apdavison

Copy link
Copy Markdown
Member

Thanks for the status update, @HarshKhilawala. It's no problem at all that it's been sitting; it's an addition worth finishing. To make it easy to pick back up, here's a concrete sketch of the two pending backends. Handily, there's existing code to lean on for each, so neither needs writing from scratch.

NEURON There's an existing NMODL implementation of this exact model on ModelDB: entry 226422 (MAT_model.mod, defaults set for regular spiking), contributed by Shailesh Appukuttan, with a GitHub mirror at ModelDBRepository/226422. You can adapt that .mod into pyNN/neuron/nmodl/ rather than deriving it from scratch, then add a cell class alongside GsfaGrrIF in pyNN/neuron/cells.py and the translations in pyNN/neuron/standardmodels/cells.py. The repo's MAT_Neuron_StepCurrent.py reproduces Fig 5B of the paper, so it doubles as a ready-made correctness check.

Brian2 (pyNN/brian2/standardmodels/cells.py) is equation-based, which suits this model well. There's no existing implementation in Brian2, but the official adaptive_threshold example is essentially the single-timescale version of this pattern, so it's a good starting point, you'd generalise its one threshold variable to two decaying components. Using the existing adaptive cells (EIF_cond_exp_isfa_ista, IF_cond_exp_gsfa_grr) as templates for the PyNN wiring, the shape is roughly:

eqs = """
dv/dt   = (v_rest - v)/tau_m + (i_syn + i_offset + i_inj)/c_m : volt
dvt1/dt = -vt1/tau_1 : volt
dvt2/dt = -vt2/tau_2 : volt
"""
# threshold:  v > omega + vt1 + vt2
# reset:      vt1 += alpha_1; vt2 += alpha_2
# refractory: tau_refrac

The two things to change from that adaptive_threshold example are: 9&0 use two threshold components (vt1/vt2) rather than one, and (2) the membrane potential is not reset on a spike. So the reset block should increment vt1/vt2 and leave v alone, and I'd let v keep integrating through the refractory period (rely on refractory=tau_refrac to suppress spikes) rather than freezing it with (unless refractory).

One small thing worth fixing in the NEST version too: omega (like NEST's V_th) is an absolute membrane voltage, default around −51 mV, whereas the current default treats it as a value relative to rest. Setting the v_thresh default to the absolute value (~ −51 mV, consistent with how v_thresh is used in the other standard cells) would fix it. A quick spike-count check against a constant current across the three backends is a good way to confirm they agree, and that would pair naturally with the cell_type_demonstration.py extension.

No rush on any of this. I'm happy to review whenever you next get a chance to pick it up.

@apdavison apdavison marked this pull request as draft July 11, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants