Search code examples
pythonneuron-simulator

How to create a synapse in NEURON?


How can I create a synapse in the NEURON simulator using its Python interface? I would like to create 2 Sections and connect them with a synapse, but there aren't any functions for it on the Section API or in the Section docs:

from neuron import h

src = h.Section(name="source")
dest = h.Section(name="destination")

Solution

  • In NEURON synapses are of the family of PointProcesses. You can insert a PointProcess into a Section by accessing it on the HocInterpreter and giving it a Segment on the Section. You then have to create a NetCon from a voltage pointer on the presynaptic Section (src(x)._ref_v) to the target point process:

    from neuron import h
    
    dest = h.Section(name="destination")
    synapse = h.ExpSyn(sec(0.5))
    src = h.Section(name="source")
    connection = h.NetCon(src(0.5)._ref_v, synapse)
    

    Make sure to keep references to each piece around or they get garbage collected. Also make sure that you set the proper connection.weight (it's an array, so usually connection.weight[0]) and that you set the proper attributes on the point process for it to function as well.