Ex8: Adaptive Exponential IF

AdEx integrate-and-fire neuron with adaptation current — four variants

Model: AdEx (adExIaFCell)

Four variants: burst2, burst4, burstChaos (excitatory input), and rebound (inhibitory input).

Reference: NeuroML2 LEMS_NML2_Ex8_AdEx.xml


1. Define Network in TVBO

from tvbo import SimulationExperiment

exp = SimulationExperiment.from_string("""
label: "NeuroML Ex8: AdEx"
dynamics:
  name: adExBurst2
  iri: neuroml:adExIaFCell
network:
  dynamics:
    adExBurst2:
      name: adExBurst2
      iri: neuroml:adExIaFCell
      parameters:
        C: {value: 281, unit: pF}
        gL: {value: 30, unit: nS}
        EL: {value: -70.6, unit: mV}
        reset: {value: -48.5, unit: mV}
        VT: {value: -50.4, unit: mV}
        thresh: {value: -40.4, unit: mV}
        delT: {value: 2, unit: mV}
        tauw: {value: 40, unit: ms}
        a: {value: 4, unit: nS}
        b: {value: 0.08, unit: nA}
        refract: {value: 0, unit: ms}
    adExBurst4:
      name: adExBurst4
      iri: neuroml:adExIaFCell
      parameters:
        C: {value: 281, unit: pF}
        gL: {value: 30, unit: nS}
        EL: {value: -70.6, unit: mV}
        reset: {value: -47.2, unit: mV}
        VT: {value: -50.4, unit: mV}
        thresh: {value: -40.4, unit: mV}
        delT: {value: 2, unit: mV}
        tauw: {value: 40, unit: ms}
        a: {value: 4, unit: nS}
        b: {value: 0.08, unit: nA}
        refract: {value: 0, unit: ms}
    adExBurstChaos:
      name: adExBurstChaos
      iri: neuroml:adExIaFCell
      parameters:
        C: {value: 281, unit: pF}
        gL: {value: 30, unit: nS}
        EL: {value: -70.6, unit: mV}
        reset: {value: -48, unit: mV}
        VT: {value: -50.4, unit: mV}
        thresh: {value: -40.4, unit: mV}
        delT: {value: 2, unit: mV}
        tauw: {value: 40, unit: ms}
        a: {value: 4, unit: nS}
        b: {value: 0.08, unit: nA}
        refract: {value: 0, unit: ms}
    adExRebound:
      name: adExRebound
      iri: neuroml:adExIaFCell
      parameters:
        C: {value: 281, unit: pF}
        gL: {value: 30, unit: nS}
        EL: {value: -60, unit: mV}
        reset: {value: -51, unit: mV}
        VT: {value: -54, unit: mV}
        thresh: {value: -30, unit: mV}
        delT: {value: 2, unit: mV}
        tauw: {value: 150, unit: ms}
        a: {value: 200, unit: nS}
        b: {value: 0.1, unit: nA}
        refract: {value: 0, unit: ms}
    pulseGen1:
      name: pulseGen1
      iri: neuroml:pulseGenerator
      parameters:
        delay: {value: 0, unit: ms}
        duration: {value: 2000, unit: ms}
        amplitude: {value: 0.8, unit: nA}
    pulseGen2:
      name: pulseGen2
      iri: neuroml:pulseGenerator
      parameters:
        delay: {value: 150, unit: ms}
        duration: {value: 50, unit: ms}
        amplitude: {value: -0.5, unit: nA}
  nodes:
    - {id: 0, dynamics: adExBurst2}
    - {id: 1, dynamics: adExBurst4}
    - {id: 2, dynamics: adExBurstChaos}
    - {id: 3, dynamics: adExRebound}
    - {id: 10, dynamics: pulseGen1, record: false}
    - {id: 11, dynamics: pulseGen2, record: false}
  edges:
    - {source: 10, target: 0}
    - {source: 10, target: 1}
    - {source: 10, target: 2}
    - {source: 11, target: 3}
integration:
  method: euler
  step_size: 0.025
  duration: 300.0
  time_scale: ms
""")
print(f"Network dynamics: {list(exp.network.dynamics.keys())}")
Network dynamics: ['adExBurst2', 'adExBurst4', 'adExBurstChaos', 'adExRebound', 'pulseGen1', 'pulseGen2']

2. Render LEMS XML

xml = exp.render("lems")
print(xml[:2000])
<Lems>
  <Target component="sim_NeuroML_Ex8__AdEx"/>

  <Include file="Cells.xml"/>
  <Include file="Networks.xml"/>
  <Include file="Inputs.xml"/>
  <Include file="Simulation.xml"/>

    <adExIaFCell id="adExBurst2" C="281 pF" EL="-70.6 mV" VT="-50.4 mV" a="4 nS" b="0.08 nA" delT="2 mV" gL="30 nS" refract="0 ms" reset="-48.5 mV" tauw="40 ms" thresh="-40.4 mV"/>

    <adExIaFCell id="adExBurst4" C="281 pF" EL="-70.6 mV" VT="-50.4 mV" a="4 nS" b="0.08 nA" delT="2 mV" gL="30 nS" refract="0 ms" reset="-47.2 mV" tauw="40 ms" thresh="-40.4 mV"/>

    <adExIaFCell id="adExBurstChaos" C="281 pF" EL="-70.6 mV" VT="-50.4 mV" a="4 nS" b="0.08 nA" delT="2 mV" gL="30 nS" refract="0 ms" reset="-48 mV" tauw="40 ms" thresh="-40.4 mV"/>

    <adExIaFCell id="adExRebound" C="281 pF" EL="-60 mV" VT="-54 mV" a="200 nS" b="0.1 nA" delT="2 mV" gL="30 nS" refract="0 ms" reset="-51 mV" tauw="150 ms" thresh="-30 mV"/>

    <pulseGenerator id="pulseGen1" amplitude="0.8 nA" delay="0.0 ms" duration="2000.0 ms"/>

    <pulseGenerator id="pulseGen2" amplitude="-0.5 nA" delay="150.0 ms" duration="50.0 ms"/>

    <network id="net1">
        <population id="adExBurst2_pop" component="adExBurst2" size="1"/>
        <population id="adExBurst4_pop" component="adExBurst4" size="1"/>
        <population id="adExBurstChaos_pop" component="adExBurstChaos" size="1"/>
        <population id="adExRebound_pop" component="adExRebound" size="1"/>
        <explicitInput target="adExBurst2_pop[0]" input="pulseGen1" destination="synapses"/>
        <explicitInput target="adExBurst4_pop[0]" input="pulseGen1" destination="synapses"/>
        <explicitInput target="adExBurstChaos_pop[0]" input="pulseGen1" destination="synapses"/>
        <explicitInput target="adExRebound_pop[0]" input="pulseGen2" destination="synapses"/>
    </network>

    <Simulation id="sim_NeuroML_Ex8__AdEx" length="300.0ms" step="0.025ms" target="net1">
        <OutputFile id="of0" fileName="results/adExBurst2.dat">
            <OutputColumn i

3. Run Reference

from tvbo.adapters.neuroml import run_lems_example

ref_outputs = run_lems_example("LEMS_NML2_Ex8_AdEx.xml")
for name, arr in ref_outputs.items():
    print(f"  {name}: shape={arr.shape}")
  adEx_2burst.dat: shape=(12001, 3)
  adEx_4burst.dat: shape=(12001, 3)
  adEx_chaos.dat: shape=(12001, 3)
  adEx_rebound.dat: shape=(12001, 3)

4. Run TVBO

result = exp.run("neuroml")
da = result.integration.data
print(f"TVBO: {da.dims}, shape={da.shape}")
TVBO: ('time', 'quantity'), shape=(12001, 4)

5. Compare & Plot

from tvbo.adapters.neuroml import plot_lems_comparison
plot_lems_comparison("LEMS_NML2_Ex8_AdEx.xml", ref_outputs, result.integration.data, title_prefix="Ex8")