Example #1
0
    def __init__(self, sheet, parameters):
        DirectStimulator.__init__(self, sheet,parameters)
        
        exc_syn = self.sheet.sim.StaticSynapse(weight=self.parameters.exc_weight,delay=self.sheet.model.parameters.min_delay)
        inh_syn = self.sheet.sim.StaticSynapse(weight=self.parameters.inh_weight,delay=self.sheet.model.parameters.min_delay)
        
        if not self.sheet.parameters.mpi_safe:
            from pyNN.nest import native_cell_type        
            if (self.parameters.exc_firing_rate != 0 or self.parameters.exc_weight != 0):
                self.np_exc = self.sheet.sim.Population(1, native_cell_type("poisson_generator"),{'rate': 0})
                self.sheet.sim.Projection(self.np_exc, self.sheet.pop,self.sheet.sim.AllToAllConnector(),synapse_type=exc_syn,receptor_type='excitatory')

            if (self.parameters.inh_firing_rate != 0 or self.parameters.inh_weight != 0):
                self.np_inh = self.sheet.sim.Population(1, native_cell_type("poisson_generator"),{'rate': 0})
                self.sheet.sim.Projection(self.np_inh, self.sheet.pop,self.sheet.sim.AllToAllConnector(),synapse_type=inh_syn,receptor_type='inhibitory')
        
        else:
            if (self.parameters.exc_firing_rate != 0 or self.parameters.exc_weight != 0):
                        self.ssae = self.sheet.sim.Population(self.sheet.pop.size,self.sheet.sim.SpikeSourceArray())
                        seeds=mozaik.get_seeds((self.sheet.pop.size,))
                        self.stgene = [StGen(rng=numpy.random.RandomState(seed=seeds[i])) for i in numpy.nonzero(self.sheet.pop._mask_local)[0]]
                        self.sheet.sim.Projection(self.ssae, self.sheet.pop,self.sheet.sim.OneToOneConnector(),synapse_type=exc_syn,receptor_type='excitatory')

            if (self.parameters.inh_firing_rate != 0 or self.parameters.inh_weight != 0):
                        self.ssai = self.sheet.sim.Population(self.sheet.pop.size,self.sheet.sim.SpikeSourceArray())
                        seeds=mozaik.get_seeds((self.sheet.pop.size,))
                        self.stgeni = [StGen(rng=numpy.random.RandomState(seed=seeds[i])) for i in numpy.nonzero(self.sheet.pop._mask_local)[0]]
                        self.sheet.sim.Projection(self.ssai, self.sheet.pop,self.sheet.sim.OneToOneConnector(),synapse_type=inh_syn,receptor_type='inhibitory')
Example #2
0
    def __init__(self, sheet, parameters):
        DirectStimulator.__init__(self, sheet, parameters)
        population_selector = load_component(
            self.parameters.population_selector.component)
        self.ids = population_selector(
            sheet, self.parameters.population_selector.params
        ).generate_idd_list_of_neurons()
        d = dict((j, i) for i, j in enumerate(self.sheet.pop.all_cells))
        self.to_stimulate_indexes = [d[i] for i in self.ids]

        exc_syn = self.sheet.sim.StaticSynapse(
            weight=self.parameters.exc_weight,
            delay=self.sheet.model.parameters.min_delay)
        if (self.parameters.exc_firing_rate != 0
                or self.parameters.exc_weight != 0):
            self.ssae = self.sheet.sim.Population(
                self.sheet.pop.size, self.sheet.sim.SpikeSourceArray())
            seeds = mozaik.get_seeds((self.sheet.pop.size, ))
            self.stgene = [
                StGen(rng=numpy.random.RandomState(seed=seeds[i]))
                for i in self.to_stimulate_indexes
            ]
            self.sheet.sim.Projection(self.ssae,
                                      self.sheet.pop,
                                      self.sheet.sim.OneToOneConnector(),
                                      synapse_type=exc_syn,
                                      receptor_type='excitatory')
Example #3
0
    def __init__(self, sheet, parameters):
        DirectStimulator.__init__(self, sheet, parameters)
        population_selector = load_component(
            self.parameters.population_selector.component)
        self.ids = population_selector(
            sheet, self.parameters.population_selector.params
        ).generate_idd_list_of_neurons()
        # print(self.ids[0].id)  # 1901
        # d = dict((j, i) for i, j in enumerate(self.sheet.pop.all_cells))  # nest
        d = dict((str(j), i)
                 for i, j in enumerate(self.sheet.pop.all_cells))  # spinnaker
        # d = dict((i, j) for i, j in enumerate(numpy.asarray(self.sheet.pop.all_cells)))  # spinnaker abbott
        # d = dict((j, i) for i, j in enumerate(self.sheet.pop.all_cells))  # spinnaker abbott
        # print("self.ids ", self.ids)
        # print("d ", d)
        # self.to_stimulate_indexes = [d[i.id] for i in self.ids]
        self.to_stimulate_indexes = [d[str(i)] for i in self.ids
                                     ]  # str because there is an object
        # workaround
        # self.to_stimulate_indexes = [k.item() for k in self.ids]  # spinnaker abbott

        exc_syn = self.sheet.sim.StaticSynapse(
            weight=self.parameters.exc_weight,
            delay=self.sheet.model.parameters.min_delay)
        if (self.parameters.exc_firing_rate != 0
                or self.parameters.exc_weight != 0):
            self.ssae = self.sheet.sim.Population(
                self.sheet.pop.size, self.sheet.sim.SpikeSourceArray())
            seeds = mozaik.get_seeds((self.sheet.pop.size, ))
            self.stgene = [
                StGen(rng=numpy.random.RandomState(seed=seeds[i]))
                for i in self.to_stimulate_indexes
            ]
            print("sheet Kick projection ", self.ssae)
            print("sheet Kick projection ", self.sheet.pop)
            self.p = self.sheet.sim.Projection(
                self.ssae,
                self.sheet.pop,
                self.sheet.sim.OneToOneConnector(),
                synapse_type=exc_syn,
                receptor_type='excitatory')