NML2_AbstractCells.nml
This is the master catalog of all abstract (non-morphological) cell types in NeuroML2. Each cell type is a single-compartment model with analytically defined dynamics.
iafTauCell
IntegrateAndFire (Ex0)
1 (v)
iafTauRefCell
IaF + refractory
2 (v, lastSpikeTime)
iafCell
IaF (conductance-based)
1 (v)
iafRefCell
IaF + refractory
2
izhikevichCell
IzhikevichCell (Ex2)
2 (v, U)
izhikevich2007Cell
Izhikevich2007
2 (v, u)
adExIaFCell
AdaptiveExponentialIF (Ex8)
2 (v, w)
fitzHughNagumoCell
FitzHughNagumo (Ex9)
2 (V, W)
fitzHughNagumo1969Cell
FHN1969
2 (V, W)
pinskyRinzelCA3Cell
PinskyRinzel (Ex22)
10
Show Original NML File Structure
from pathlib import Path
nml_file = Path.home() / "work_data/toolboxes/NeuroML2/examples/NML2_AbstractCells.nml"
text = nml_file.read_text()
# Show component declarations
for line in text.split(' \n ' ):
stripped = line.strip()
if stripped.startswith('<iaf' ) or stripped.startswith('<izh' ) or \
stripped.startswith('<adEx' ) or stripped.startswith('<fitz' ) or \
stripped.startswith('<pinsky' ):
print (stripped[:120 ])
<iafTauCell id="iafTau" leakReversal="-50mV" thresh="-55mV"
<iafTauRefCell id="iafTauRef" leakReversal="-50mV" thresh="-55mV"
<iafCell id="iaf" leakReversal="-50mV" thresh="-55mV"
<iafRefCell id="iafRef" leakReversal="-50mV" thresh="-55mV"
<izhikevichCell id="izBurst" v0 = "-70mV" thresh = "30mV" a="0.02"
<izhikevich2007Cell id="iz2007RS" v0 = "-60mV" C="100 pF" k = "0.7 nS_per_mV"
<adExIaFCell id="adExBurst" C="281pF" gL="30nS" EL="-70.6mV"
<fitzHughNagumoCell id="fn1" I="0.8" />
<fitzHughNagumo1969Cell id="fn1969" a="0.7" b="0.08" I="1.0" phi="0.08" V0="0.0" W0="0.0"/>
<pinskyRinzelCA3Cell id="pr2A" iSoma="0.75 uA_per_cm2" iDend="0 uA_per_cm2" gc="2.1 mS_per_cm2" qd0="0"
Define All Cells in TVBO
FitzHugh-Nagumo 1969
from tvbo import SimulationExperiment
exp_fn1969 = SimulationExperiment.from_string("""
label: "NML2 AbstractCells: FitzHugh-Nagumo 1969"
dynamics:
name: FitzHughNagumo1969
parameters:
a: { value: 0.7 }
b: { value: 0.08 }
I: { value: 1.0 }
phi: { value: 0.08 }
state_variables:
V:
equation: { rhs: "V - V**3/3 - W + I" }
initial_value: 0.0
variable_of_interest: true
W:
equation: { rhs: "phi*(V + a - b*W)" }
initial_value: 0.0
network:
number_of_nodes: 1
integration:
method: euler
step_size: 0.01
duration: 200.0
time_scale: ms
""" )
print (f"FHN1969 model defined: { exp_fn1969. dynamics. name} " )
FHN1969 model defined: FitzHughNagumo1969
Izhikevich 2007
exp_iz2007 = SimulationExperiment.from_string("""
label: "NML2 AbstractCells: Izhikevich 2007"
dynamics:
name: Izhikevich2007
description: "Izhikevich 2007 model"
parameters:
C: { value: 100.0, description: "Capacitance (pF)" }
k: { value: 0.7, description: "nS/mV" }
vr: { value: -60.0, description: "Resting potential (mV)" }
vt: { value: -40.0, description: "Instantaneous threshold (mV)" }
vpeak: { value: 35.0, description: "Spike cutoff (mV)" }
a: { value: 0.03, description: "Recovery rate (1/ms)" }
b: { value: -2.0, description: "Recovery sensitivity (nS)" }
c: { value: -50.0, description: "Reset potential (mV)" }
d: { value: 100.0, description: "Recovery reset (pA)" }
state_variables:
v:
equation: { rhs: "(k*(v - vr)*(v - vt) - u) / C" }
initial_value: -60.0
variable_of_interest: true
u:
equation: { rhs: "a*(b*(v - vr) - u)" }
initial_value: 0.0
events:
spike:
condition: { rhs: "v > vpeak" }
affect: { rhs: "v = c; u = u + d" }
network:
number_of_nodes: 1
integration:
method: euler
step_size: 0.005
duration: 200.0
time_scale: ms
""" )
print (f"Iz2007 model defined: { exp_iz2007. dynamics. name} " )
Iz2007 model defined: Izhikevich2007
Render and Inspect LEMS
# Show FHN1969 LEMS
xml = exp_fn1969.render("lems" )
print ("=== FHN1969 LEMS (excerpt) ===" )
print (xml[:1200 ])
=== FHN1969 LEMS (excerpt) ===
<Lems>
<!-- Tell jLEMS/jNeuroML which component is the simulation entry point. -->
<Target component="sim_NML2_AbstractCells__FitzHugh_Nagumo_1969"/>
<!-- ════════════════════════════════════════════════════════════════
Dimensions & Units (inline — no external includes needed)
════════════════════════════════════════════════════════════════ -->
<!-- Dimensions -->
<Dimension name="none"/>
<Dimension name="time" t="1"/>
<Dimension name="voltage" m="1" l="2" t="-3" i="-1"/>
<Dimension name="per_time" t="-1"/>
<Dimension name="conductance" m="-1" l="-2" t="3" i="2"/>
<Dimension name="capacitance" m="-1" l="-2" t="4" i="2"/>
<Dimension name="current" i="1"/>
<Dimension name="resistance" m="1" l="2" t="-3" i="-2"/>
<Dimension name="concentration" l="-3" n="1"/>
<Dimension name="substance" n="1"/>
<Dimension name="charge" t="1" i="1"/>
<Dimension name="temperature" k="1"/>
<!-- Units -->
<Unit symbol="s" dimension="time" power="0"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<Unit symbol="us" dimension="time" power="-6"/>
<Unit symbol="V" dimension="voltage" power="0"/>
<Unit symbol="mV" dimension="voltage" power="-3"/>
Run TVBO
import numpy as np
import matplotlib.pyplot as plt
# Run FHN1969
result_fn = exp_fn1969.run("neuroml" )
da_fn = result_fn.integration.data
# Run Iz2007
result_iz = exp_iz2007.run("neuroml" )
da_iz = result_iz.integration.data
fig, axes = plt.subplots(1 , 2 , figsize= (14 , 4 ))
# FHN1969
t = da_fn.coords['time' ].values
vals = da_fn.values
axes[0 ].plot(t, vals[:, 0 ], label= 'V' )
axes[0 ].plot(t, vals[:, 1 ], label= 'W' , alpha= 0.7 )
axes[0 ].set_xlabel("Time (ms)" )
axes[0 ].set_title("FitzHugh-Nagumo 1969" )
axes[0 ].legend()
axes[0 ].grid(True , alpha= 0.3 )
# Iz2007
t = da_iz.coords['time' ].values
vals = da_iz.values
axes[1 ].plot(t, vals[:, 0 ], label= 'v' )
axes[1 ].plot(t, vals[:, 1 ], label= 'u' , alpha= 0.7 )
axes[1 ].set_xlabel("Time (ms)" )
axes[1 ].set_title("Izhikevich 2007" )
axes[1 ].legend()
axes[1 ].grid(True , alpha= 0.3 )
plt.tight_layout()
plt.show()