Пример #1
0
    def connect(self, neuronName, custom):
        """
        Connect all nodes in the model.
        """
        if self.connected: return
        if not self.built:
            self.build(neuronName, custom)

        cynest.CopyModel("static_synapse_hom_wd", "excitatory", {
            "weight": self.J_E,
            "delay": self.delay
        })
        cynest.CopyModel("static_synapse_hom_wd", "inhibitory", {
            "weight": self.J_I,
            "delay": self.delay
        })

        cynest.RandomConvergentConnect(self.nodes_E,
                                       self.nodes,
                                       self.C_E,
                                       model="excitatory")
        cynest.RandomConvergentConnect(self.nodes_I,
                                       self.nodes,
                                       self.C_I,
                                       model="inhibitory")
        cynest.DivergentConnect(self.noise, self.nodes, model="excitatory")
        cynest.ConvergentConnect(self.nodes_E[:self.N_rec], self.spikes_E)
        cynest.ConvergentConnect(self.nodes_I[:self.N_rec], self.spikes_I)
        self.connected = True
Пример #2
0
    def test_CopyModel(self):
        """CopyModel"""

        cynest.ResetKernel()
        cynest.CopyModel("sample_neuron", 'new_neuron', {'V_m': 10.0})
        vm = cynest.GetDefaults('new_neuron')['V_m']
        self.assertEqual(vm, 10.0)

        n = cynest.Create('new_neuron', 10)
        vm = cynest.GetStatus([n[0]])[0]['V_m']
        self.assertEqual(vm, 10.0)

        cynest.CopyModel('static_synapse', 'new_synapse', {'weight': 10.})
        cynest.Connect([n[0]], [n[1]], model='new_synapse')
        w = cynest.GetDefaults('new_synapse')['weight']
        self.assertEqual(w, 10.0)

        try:
            cynest.CopyModel(
                "sample_neuron",
                'new_neuron')  # shouldn't be possible a second time
            self.fail('an error should have risen!')  # should not be reached
        except:
            info = sys.exc_info()[1]
            if not "NewModelNameExists" in info.__str__():
                self.fail('could not pass error message to cynest!')
# connect dc_generator to neuron 1:
nest.Connect(dc_gen, [neurons[0]])

# connect voltmeter to neuron 2:
nest.Connect(volts, [neurons[1]])

# set synapse parameters:
syn_param = {
    "tau_psc": Tau_psc,
    "tau_rec": Tau_rec,
    "tau_fac": Tau_fac,
    "U": U,
    "delay": 0.1,
    "weight": A,
    "u": 0.0,
    "x": 1.0
}

# create desired synapse type with chosen parameters:
nest.CopyModel("tsodyks_synapse", "syn", syn_param)

# connect neuron 1 with neuron 2 via synapse model 'syn':
nest.Connect([neurons[0]], [neurons[1]], model="syn")

# simulate:
nest.Simulate(Tend)

# print membrane potential of neuron 2:
nest.voltage_trace.from_device(volts)
nest.voltage_trace.show()
Пример #4
0
#! - The paper uses double exponential time courses for the synaptic
#!   conductances, with separate time constants for the rising and
#!   fallings flanks. Alpha functions have only a single time
#!   constant: we use twice the rising time constant given by Hill and
#!   Tononi.
#! - In the general model below, we use the values for the cortical
#!   excitatory cells as defaults. Values will then be adapted below.
#!
nest.CopyModel('iaf_cond_alpha',
               'NeuronModel',
               params={
                   'C_m': 16.0,
                   'E_L': (0.2 * 30.0 + 1.5 * -90.0) / (0.2 + 1.5),
                   'g_L': 0.2 + 1.5,
                   'E_ex': 0.0,
                   'E_in': -70.0,
                   'V_reset': -60.0,
                   'V_th': -51.0,
                   't_ref': 2.0,
                   'tau_syn_ex': 1.0,
                   'tau_syn_in': 2.0,
                   'I_e': 0.0,
                   'V_m': -70.0
               })

#! Adaptation of models for different populations
#! ----------------------------------------------

#! We must copy the `NeuronModel` dictionary explicitly, otherwise
#! Python would just create a reference.

#! Cortical excitatory cells
Пример #5
0
nest.SetStatus([espikes], [{
    "label": "brunel-py-ex",
    "withtime": True,
    "withgid": True
}])

nest.SetStatus([ispikes], [{
    "label": "brunel-py-in",
    "withtime": True,
    "withgid": True
}])

print("Connecting devices.")

nest.CopyModel("static_synapse", "excitatory", {
    "weight": J_ex,
    "delay": delay
})
nest.CopyModel("static_synapse", "inhibitory", {
    "weight": J_in,
    "delay": delay
})

nest.DivergentConnect(noise, nodes_ex, model="excitatory")
nest.DivergentConnect(noise, nodes_in, model="excitatory")

nest.ConvergentConnect(list(range(1, N_rec + 1)), espikes, model="excitatory")
nest.ConvergentConnect(list(range(NE + 1, NE + 1 + N_rec)),
                       ispikes,
                       model="excitatory")

print("Connecting network.")