Skip to content

Let Neuron SpikeGenerator to create synapses if not present #209

@filimarc

Description

@filimarc

At the moment the SpikeGenerator of BSB-NEURON loops over the synapses that are present in the location and stimulates all the selected ones.

If in the SpikeGenerator i select synapses that are not already present they will never be stimulated.

EXAMPLE OF ISSUE

In our neuron example we have:

simulations:
  neuronsim:
    simulator: neuron
    duration: 100
    resolution: 0.025
    temperature: 32
    cell_models:
      stellate_cell:
        model: data.Stellate.definitionStellate
        parameters: []
    connection_models:
      stellate_to_stellate:
        synapses:
          - synapse: GABA
            weight: 0.001
            delay: 1
    devices:
      spike_generator:
        device: spike_generator
        start: 9
        number: 1
        weight: 0.01
        delay: 1
        targetting:
          strategy: by_id
          ids:
            stellate_cell:
              - 0
        locations:
          strategy: branch
          labels:
            - dendrites
        synapses:
          - AMPA
          - NMDA

The only synapse created are GABA, but we want to stimulate through AMPA and NMDA. So in this case the SpikeGenerator do not stimulate anything.

Proposal

I think we can make that the SpikeGenerator check if the synapses specified by the user are present in the location, if not it will create a new synapse.

with small changing in the code:

@config.node
class SpikeGenerator(NeuronDevice, classmap_entry="spike_generator"):
    locations = config.attr(type=LocationTargetting, default={"strategy": "soma"})
    synapses = config.list()
    parameters = config.catch_all(type=types.any_())

    def implement(self, adapter, simulation, simdata):
        for _model, pop in self.targetting.get_targets(
            adapter, simulation, simdata
        ).items():
            for target in pop:
                for location in self.locations.get_locations(target):
                    location_synapses= location.section.synapses
                    names = [syn.name for syn in location_synapses]
                    for synapse in self.synapses:
                        try:
                            index = names.index(synapse)
                            location_synapses[index].stimulate(**self.parameters)
                        except:
                            syn = target.insert_synapse(synapse,location)
                            syn.stimulate(**self.parameters)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions