Ejemplo n.º 1
0
    def __create_recording_devices(self):
        """ Creates one recording device of each kind per population.

        Only devices which are given in ``sim_dict['rec_dev']`` are created.

        """
        if self.Rank == 0:
            print('Creating recording devices.')

        if 'spike_detector' in self.sim_dict['rec_dev']:
            if self.Rank == 0:
                print('  Activating spike time recording.')
                #for pop in self.pops:
                ngpu.ActivateRecSpikeTimes(self.neurons, 1000)
Ejemplo n.º 2
0
        fact = Wplus * math.exp(-Dt / tau_plus)
        w1 = w + fact * math.pow(1.0 - w / Wmax, mu_plus)
        if w1 > Wmax:
            w1 = Wmax

    else:
        fact = -alpha * Wplus * math.exp(Dt / tau_minus)
        w1 = w + fact * math.pow(w / Wmax, mu_minus)
        if w1 < 0.0:
            w1 = 0.0
    return w1


# postsynaptic and presynaptic neurons
neuron_post = ngpu.Create("parrot_neuron")
ngpu.ActivateRecSpikeTimes(neuron_post, 20)
neuron_pre = ngpu.Create("parrot_neuron")
ngpu.ActivateRecSpikeTimes(neuron_pre, 20)

#spike generators
sg_post = ngpu.Create("spike_generator")
sg_pre = ngpu.Create("spike_generator")

# spike times
spike_times_post = [1.0]
spike_times_pre = [1.0]
ngpu.SetStatus(sg_post, {"spike_times": spike_times_post})
ngpu.SetStatus(sg_pre, {"spike_times": spike_times_pre})

# connect spike generators to neurons
syn_dict = {"weight": 1.0, "delay": 1.0}
Ejemplo n.º 3
0
n_neurons = 30
eps = 1.0e-6

# poisson generator parameters
poiss_rate = 500.0  # poisson signal rate in Hz
poiss_weight = 4.0
poiss_delay = 0.2  # poisson signal delay in ms

# create poisson generator
pg = ngpu.Create("poisson_generator")
ngpu.SetStatus(pg, "rate", poiss_rate)

# Create n_neurons neurons
neuron = ngpu.Create("aeif_cond_beta", n_neurons)
ngpu.ActivateSpikeCount(neuron)
ngpu.ActivateRecSpikeTimes(neuron, 500)

# Create n_neurons spike detectors
sd = ngpu.Create("spike_detector", n_neurons)

#connect poisson generator to all neurons
pg_conn_dict = {"rule": "all_to_all"}
pg_syn_dict = {"weight": poiss_weight, "delay": poiss_delay}

ngpu.Connect(pg, neuron, pg_conn_dict, pg_syn_dict)

#connect neurons to spike detectors
sd_conn_dict = {"rule": "one_to_one"}
sd_syn_dict = {"weight": 1.0, "delay": 0.1}

ngpu.Connect(neuron, sd, sd_conn_dict, sd_syn_dict)