Ex7: Short-Term Plasticity

Tsodyks-Markram short-term plasticity synapses (STD and STF)

Model: Short-Term Plasticity Synapses

A passive cell receives spikes via three synapse types: 1. expTwoSynapse — no plasticity (control) 2. blockingPlasticSynapse with tsodyksMarkramDepMechanism — depression only 3. blockingPlasticSynapse with tsodyksMarkramDepFacMechanism — depression + facilitation

Reference: NeuroML2 LEMS_NML2_Ex7_STP.xml


1. Define Network in TVBO

from tvbo import SimulationExperiment

exp = SimulationExperiment.from_string("""
label: "NeuroML Ex7: STP Synapses"
network:
  dynamics:
    passiveCell:
      name: passiveCell
      iri: neuroml:cell
      parameters:
        diameter: {value: 17.841242}
        specificCapacitance: {value: 1.0, unit: uF_per_cm2}
        initMembPotential: {value: -65, unit: mV}
        spikeThresh: {value: -20, unit: mV}
        resistivity: {value: 0.03, unit: kohm_cm}
      components:
        passiveChan:
          name: passiveChan
          iri: neuroml:ionChannelHH
          parameters:
            conductance: {value: 10, unit: pS}
            condDensity: {value: 0.0003, unit: S_per_cm2}
            erev: {value: -54.3, unit: mV}
            ion: {description: non_specific}
    spikeGen30ms:
      name: spikeGen30ms
      iri: neuroml:spikeGenerator
      parameters:
        period: {value: 30, unit: ms}
    noStpSyn:
      name: noStpSyn
      iri: neuroml:expTwoSynapse
      parameters:
        gbase: {value: 1, unit: nS}
        erev: {value: 0, unit: mV}
        tauRise: {value: 0.1, unit: ms}
        tauDecay: {value: 40, unit: ms}
    stpSynDep:
      name: stpSynDep
      iri: neuroml:blockingPlasticSynapse
      parameters:
        gbase: {value: 1, unit: nS}
        erev: {value: 0, unit: mV}
        tauRise: {value: 0.1, unit: ms}
        tauDecay: {value: 40, unit: ms}
      modes:
        plasticityMechanism:
          name: plasticityMechanism
          iri: neuroml:tsodyksMarkramDepMechanism
          parameters:
            initReleaseProb: {value: 0.5}
            tauRec: {value: 300, unit: ms}
    stpSynDepFac:
      name: stpSynDepFac
      iri: neuroml:blockingPlasticSynapse
      parameters:
        gbase: {value: 1, unit: nS}
        erev: {value: 0, unit: mV}
        tauRise: {value: 0.1, unit: ms}
        tauDecay: {value: 40, unit: ms}
      modes:
        plasticityMechanism:
          name: plasticityMechanism
          iri: neuroml:tsodyksMarkramDepFacMechanism
          parameters:
            initReleaseProb: {value: 0.5}
            tauFac: {value: 200, unit: ms}
            tauRec: {value: 300, unit: ms}
  nodes:
    - {id: 0, dynamics: passiveCell}
    - {id: 1, dynamics: passiveCell}
    - {id: 2, dynamics: passiveCell}
    - {id: 10, dynamics: spikeGen30ms}
  edges:
    - {source: 10, target: 0, coupling: noStpSyn}
    - {source: 10, target: 1, coupling: stpSynDep}
    - {source: 10, target: 2, coupling: stpSynDepFac}
integration:
  method: euler
  step_size: 0.01
  duration: 300.0
  time_scale: ms
""")
dyn_name = next(iter(exp.network.dynamics)) if exp.network and exp.network.dynamics else 'network'
print(f"TVBO model: {dyn_name}  (source var: exp)")
TVBO model: noStpSyn  (source var: exp)

2. Render LEMS XML

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

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

    <ionChannelHH id="passiveChan" conductance="10 pS"/>

    <cell id="passiveCell">
        <morphology id="passiveCell_morphology">
            <segment id="0" name="Soma">
                <proximal x="0.0" y="0.0" z="0.0" diameter="17.841242"/>
                <distal x="0.0" y="0.0" z="0.0" diameter="17.841242"/>
            </segment>
            <segmentGroup id="all">
                <member segment="0"/>
            </segmentGroup>
            <segmentGroup id="soma_group">
                <member segment="0"/>
            </segmentGroup>
        </morphology>
        <biophysicalProperties id="biophys">
            <membraneProperties>
                <channelDensity condDensity="0.0003 S_per_cm2" id="passiveChan_all" ionChannel="passiveChan" erev="-54.3 mV" ion="non_specific"/>
                <specificCapacitance value="1 uF_per_cm2"/>
                <initMembPotential value="-65 mV"/>
                <spikeThresh value="-20 mV"/>
            </membraneProperties>
            <intracellularProperties>
                <resistivity value="0.03 kohm_cm"/>
            </intracellularProperties>
        </biophysicalProperties>
    </cell>

    <spikeGenerator id="spikeGen30ms" period="30.0 ms"/>

    <expTwoSynapse id="noStpSyn" erev="0 mV" gbase="1 nS" tauDecay="40 ms" tauRise="0.1 ms"/>

    <blockingPlasticSynapse id="stpSynDep" erev="0 mV" gbase="1 nS" tauDecay="40 ms" tauRise="0.1 ms">
        <plasticityMechanism type="tsodyksMarkramDepMechanism" initReleaseProb="0.5" tauRec="300 ms"/>
    </blockingPlasticSynapse>

    <blockingPlasticSynapse id="stpSynDepFac" erev="0 mV" gbase="1 nS" tauDecay="40 ms" tauRise="0.1 ms">
        <plasticityMechanism type="tsodyksMarkramDepFacMechanism" initReleaseProb="0.5" tauFac="200 ms" tauRec="300 ms"/>
    </blockingPlasticSynapse>

    <network id="net1">
        <population id="passiveCell_pop" component="passiveCell" size="3"/>
        <population id="spikeGen30ms_pop" component="spikeGen30ms" size="1"/>
        <synapticConnection from="spikeGen30ms_pop[0]" to="passiveCell_pop[0]" synapse="noStpSyn" destination="synapses"/>
        <synapticConnection from="spikeGen30ms_pop[0]" to="passiveCell_pop[1]" synapse="stpSynDep" destination="synapses"/>
        <synapticConnection from="spikeGen30ms_pop[0]" to="passiveCell_pop[2]" synapse="stpSynDepFac" destination="synapses"/>
    </network>

    <Simulation id="sim_NeuroML_Ex7__STP_Synapses" length="300.0ms" step="0.01ms" target="net1">
        <OutputFile id="of0" fileName="results/passiveCell.dat">
            <OutputColumn id="passiveCell_pop_0_v" quantity="passiveCell_pop[0]/v"/>
            <OutputColumn id="passiveCell_pop_1_v" quantity="passiveCell_pop[1]/v"/>
            <OutputColumn id="passiveCell_pop_2_v" quantity="passiveCell_pop[2]/v"/>
       

3. Run Reference

from tvbo.adapters.neuroml import run_lems_example

ref_outputs = run_lems_example("LEMS_NML2_Ex7_STP.xml")
for name, arr in ref_outputs.items():
    print(f"  {name}: shape={arr.shape}")
  ex7_v.dat: shape=(30001, 4)

4. Run TVBO

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

5. Compare & Plot

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