Example #1
0
    def __init__(self, network, name, source, target, parameters):
        Connector.__init__(self, network, name, source, target, parameters)

        # lets load up the weight ModularConnectorFunction's
        self.weight_functions = {}
        self.delay_functions = {}
        self.simulator_time_step = self.sim.get_time_step()
        # lets determine the list of variables in weight expressions
        v = ExpVisitor()
        v.visit(ast.parse(self.parameters.weight_expression))
        self.weight_function_names = v.names
        # lets determine the list of variables in delay expressions
        v = ExpVisitor()
        v.visit(ast.parse(self.parameters.delay_expression))
        self.delay_function_names = v.names

        for k in self.weight_function_names:
            self.weight_functions[k] = load_component(self.parameters.weight_functions[k].component)(
                self.source, self.target, self.parameters.weight_functions[k].params
            )
            assert isinstance(self.weight_functions[k], ModularConnectorFunction)

        for k in self.delay_function_names:
            self.delay_functions[k] = load_component(self.parameters.delay_functions[k].component)(
                self.source, self.target, self.parameters.delay_functions[k].params
            )
Example #2
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(
            self.parameters.sheets.l4_cortex_exc.component)
        CortexInhL4 = load_component(
            self.parameters.sheets.l4_cortex_inh.component)

        cortex_exc_l4 = CortexExcL4(
            self, self.parameters.sheets.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(
            self, self.parameters.sheets.l4_cortex_inh.params)

        # initialize projections
        UniformProbabilisticArborization(
            self, 'V1L4ExcL4ExcConnection', cortex_exc_l4, cortex_exc_l4,
            self.parameters.sheets.l4_cortex_exc.L4ExcL4ExcConnection).connect(
            )
        UniformProbabilisticArborization(
            self, 'V1L4ExcL4InhConnection', cortex_exc_l4, cortex_inh_l4,
            self.parameters.sheets.l4_cortex_exc.L4ExcL4InhConnection).connect(
            )
        UniformProbabilisticArborization(
            self, 'V1L4InhL4ExcConnection', cortex_inh_l4, cortex_exc_l4,
            self.parameters.sheets.l4_cortex_inh.L4InhL4ExcConnection).connect(
            )
        UniformProbabilisticArborization(
            self, 'V1L4InhL4InhConnection', cortex_inh_l4, cortex_inh_l4,
            self.parameters.sheets.l4_cortex_inh.L4InhL4InhConnection).connect(
            )
Example #3
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExc1 = load_component(self.parameters.exc1.component)
	CortexExc2 = load_component(self.parameters.exc2.component)
	CortexInh1 = load_component(self.parameters.inh1.component)
	CortexInh2 = load_component(self.parameters.inh2.component)

        cortex_exc1 = CortexExc1(self, self.parameters.exc1.params)
        cortex_exc2 = CortexExc2(self, self.parameters.exc2.params)
        cortex_inh1 = CortexInh1(self, self.parameters.inh1.params)
        cortex_inh2 = CortexInh2(self, self.parameters.inh2.params)

        # initialize projections
        UniformProbabilisticArborization(self,'V1Exc1Exc1Connection',cortex_exc1,cortex_exc1,self.parameters.exc1.Exc1Exc1Connection).connect()
        UniformProbabilisticArborization(self,'V1Exc1Exc2Connection',cortex_exc1,cortex_exc2,self.parameters.exc1.Exc1Exc2Connection).connect()
        UniformProbabilisticArborization(self,'V1Exc1Inh1Connection',cortex_exc1,cortex_inh1,self.parameters.exc1.Exc1Inh1Connection).connect()
        UniformProbabilisticArborization(self,'V1Exc1Inh2Connection',cortex_exc1,cortex_inh2,self.parameters.exc1.Exc1Inh2Connection).connect()

        UniformProbabilisticArborization(self,'V1Exc2Exc1Connection',cortex_exc2,cortex_exc1,self.parameters.exc2.Exc2Exc1Connection).connect()
        UniformProbabilisticArborization(self,'V1Exc2Exc2Connection',cortex_exc2,cortex_exc2,self.parameters.exc2.Exc2Exc2Connection).connect()
        UniformProbabilisticArborization(self,'V1Exc2Inh1Connection',cortex_exc2,cortex_inh1,self.parameters.exc2.Exc2Inh1Connection).connect()
        UniformProbabilisticArborization(self,'V1Exc2Inh2Connection',cortex_exc2,cortex_inh2,self.parameters.exc2.Exc2Inh2Connection).connect()

        UniformProbabilisticArborization(self,'V1Inh1Exc1Connection',cortex_inh1,cortex_exc1,self.parameters.inh1.Inh1Exc1Connection).connect()
        UniformProbabilisticArborization(self,'V1Inh1Exc2Connection',cortex_inh1,cortex_exc2,self.parameters.inh1.Inh1Exc2Connection).connect()
        UniformProbabilisticArborization(self,'V1Inh1Inh1Connection',cortex_inh1,cortex_inh1,self.parameters.inh1.Inh1Inh1Connection).connect()
        UniformProbabilisticArborization(self,'V1Inh1Inh2Connection',cortex_inh1,cortex_inh2,self.parameters.inh1.Inh1Inh2Connection).connect()

        UniformProbabilisticArborization(self,'V1Inh2Exc1Connection',cortex_inh2,cortex_exc1,self.parameters.inh2.Inh2Exc1Connection).connect()
        UniformProbabilisticArborization(self,'V1Inh2Exc2Connection',cortex_inh2,cortex_exc2,self.parameters.inh2.Inh2Exc2Connection).connect()
        UniformProbabilisticArborization(self,'V1Inh2Inh1Connection',cortex_inh2,cortex_inh1,self.parameters.inh2.Inh2Inh1Connection).connect()
        UniformProbabilisticArborization(self,'V1Inh2Inh2Connection',cortex_inh2,cortex_inh2,self.parameters.inh2.Inh2Inh2Connection).connect()
Example #4
0
    def __init__(self, network, name, source, target, parameters):
        Connector.__init__(self, network, name, source, target, parameters)

        # lets load up the weight ModularConnectorFunction's
        self.weight_functions = {}
        self.delay_functions = {}
        self.simulator_time_step = self.sim.get_time_step()
        # lets determine the list of variables in weight expressions
        v = ExpVisitor()
        v.visit(ast.parse(self.parameters.weight_expression))
        self.weight_function_names = v.names
        # lets determine the list of variables in delay expressions
        v = ExpVisitor()
        v.visit(ast.parse(self.parameters.delay_expression))
        self.delay_function_names = v.names

        for k in self.weight_function_names:
            self.weight_functions[k] = load_component(
                self.parameters.weight_functions[k].component)(
                    self.source, self.target,
                    self.parameters.weight_functions[k].params)
            assert isinstance(self.weight_functions[k],
                              ModularConnectorFunction)

        for k in self.delay_function_names:
            self.delay_functions[k] = load_component(
                self.parameters.delay_functions[k].component)(
                    self.source, self.target,
                    self.parameters.delay_functions[k].params)
Example #5
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
        CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)

        RetinaLGN = load_component(self.parameters.retina_lgn.component)
      
        # Build and instrument the network
        self.visual_field = VisualRegion(location_x=self.parameters.visual_field.centre[0],location_y=self.parameters.visual_field.centre[1],size_x=self.parameters.visual_field.size[0],size_y=self.parameters.visual_field.size[1])
        self.input_layer = RetinaLGN(self, self.parameters.retina_lgn.params)
        cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

        GaborConnector(self,self.input_layer.sheets['X_ON'],self.input_layer.sheets['X_OFF'],cortex_exc_l4,self.parameters.l4_cortex_exc.AfferentConnection,'V1AffConnection')
        GaborConnector(self,self.input_layer.sheets['X_ON'],self.input_layer.sheets['X_OFF'],cortex_inh_l4,self.parameters.l4_cortex_inh.AfferentConnection,'V1AffInhConnection')

        # initialize projections
        ModularSingleWeightProbabilisticConnector(self,'V1L4ExcL4ExcConnectionRand',cortex_exc_l4,cortex_exc_l4,self.parameters.l4_cortex_exc.L4ExcL4ExcConnectionRand).connect()
        ModularSingleWeightProbabilisticConnector(self,'V1L4ExcL4InhConnectionRand',cortex_exc_l4,cortex_inh_l4,self.parameters.l4_cortex_exc.L4ExcL4InhConnectionRand).connect()
        ModularSingleWeightProbabilisticConnector(self,'V1L4InhL4ExcConnectionRand',cortex_inh_l4,cortex_exc_l4,self.parameters.l4_cortex_inh.L4InhL4ExcConnectionRand).connect()
        ModularSingleWeightProbabilisticConnector(self,'V1L4InhL4InhConnectionRand',cortex_inh_l4,cortex_inh_l4,self.parameters.l4_cortex_inh.L4InhL4InhConnectionRand).connect()

        # initialize projections
        ModularSamplingProbabilisticConnector(self,'V1L4ExcL4ExcConnection',cortex_exc_l4,cortex_exc_l4,self.parameters.l4_cortex_exc.L4ExcL4ExcConnection).connect()
        ModularSamplingProbabilisticConnector(self,'V1L4ExcL4InhConnection',cortex_exc_l4,cortex_inh_l4,self.parameters.l4_cortex_exc.L4ExcL4InhConnection).connect()
        ModularSamplingProbabilisticConnector(self,'V1L4InhL4ExcConnection',cortex_inh_l4,cortex_exc_l4,self.parameters.l4_cortex_inh.L4InhL4ExcConnection).connect()
        ModularSamplingProbabilisticConnector(self,'V1L4InhL4InhConnection',cortex_inh_l4,cortex_inh_l4,self.parameters.l4_cortex_inh.L4InhL4InhConnection).connect()
Example #6
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)

        # Load components
        RetinaLGN = load_component(self.parameters.retina_lgn.component)
        PGN = load_component(self.parameters.pgn.component)

        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1])
        # init layers
        self.input_layer = RetinaLGN(self, self.parameters.retina_lgn.params)
        pgn = PGN(self, self.parameters.pgn.params)

        ########################################################
        # LGN-PGN
        ModularSamplingProbabilisticConnector(
            self,
            'LGN_PGN_ConnectionOn',  # name
            self.input_layer.sheets['X_ON'],  # source
            pgn,  # target
            self.parameters.pgn.LGN_PGN_ConnectionOn  # params
        ).connect()

        ModularSamplingProbabilisticConnector(
            self,
            'LGN_PGN_ConnectionOff',  # name
            self.input_layer.sheets['X_OFF'],  # source
            pgn,  # target
            self.parameters.pgn.LGN_PGN_ConnectionOff  # params
        ).connect()

        ModularSamplingProbabilisticConnector(
            self,
            'PGN_PGN_Connection',  # name
            pgn,  # source
            pgn,  # target
            self.parameters.pgn.PGN_PGN_Connection  # params
        ).connect()

        ModularSamplingProbabilisticConnector(
            self,
            'PGN_LGN_ConnectionOn',  # name
            pgn,  # source
            self.input_layer.sheets['X_ON'],  # target
            self.parameters.pgn.PGN_LGN_ConnectionOn  # params
        ).connect()

        ModularSamplingProbabilisticConnector(
            self,
            'PGN_LGN_ConnectionOff',  # name
            pgn,  # source
            self.input_layer.sheets['X_OFF'],  # target
            self.parameters.pgn.PGN_LGN_ConnectionOff  # params
        ).connect()
Example #7
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        ExcLayer = load_component(self.parameters.sheets.exc_layer.component)
        InhLayer = load_component(self.parameters.sheets.inh_layer.component)
        
        exc = ExcLayer(self, self.parameters.sheets.exc_layer.params)
        inh = InhLayer(self, self.parameters.sheets.inh_layer.params)

        # initialize projections
        UniformProbabilisticArborization(self,'ExcExcConnection',exc,exc,self.parameters.sheets.exc_layer.ExcExcConnection).connect()
Example #8
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
    
        # Load components
        CortexExcL4 = load_component(self.parameters.sheets.l4_cortex_exc.component)
        CortexInhL4 = load_component(self.parameters.sheets.l4_cortex_inh.component)
	
        CortexExcL23 = load_component(self.parameters.sheets.l23_cortex_exc.component)
        CortexInhL23 = load_component(self.parameters.sheets.l23_cortex_inh.component)


        RetinaLGN = load_component(self.parameters.sheets.retina_lgn.component)
      
        # Build and instrument the network
        self.visual_field = VisualRegion(location_x=self.parameters.visual_field.centre[0],location_y=self.parameters.visual_field.centre[1],size_x=self.parameters.visual_field.size[0],size_y=self.parameters.visual_field.size[1])
        self.input_layer = RetinaLGN(self, self.parameters.sheets.retina_lgn.params)


        cortex_exc_l4 = CortexExcL4(self, self.parameters.sheets.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(self, self.parameters.sheets.l4_cortex_inh.params)


        cortex_exc_l23 = CortexExcL23(self, self.parameters.sheets.l23_cortex_exc.params)
        cortex_inh_l23 = CortexInhL23(self, self.parameters.sheets.l23_cortex_inh.params)


	
        # initialize afferent layer 4 projections
        GaborConnector(self,self.input_layer.sheets['X_ON'],self.input_layer.sheets['X_OFF'],cortex_exc_l4,self.parameters.sheets.l4_cortex_exc.AfferentConnection,'V1AffConnection')
        GaborConnector(self,self.input_layer.sheets['X_ON'],self.input_layer.sheets['X_OFF'],cortex_inh_l4,self.parameters.sheets.l4_cortex_inh.AfferentConnection,'V1AffInhConnection')


        if  self.parameters.with_cortical_conn:
            ModularSamplingProbabilisticConnectorAnnotationSamplesCount(self,'V1L4ExcL4ExcConnection',cortex_exc_l4,cortex_exc_l4,self.parameters.sheets.l4_cortex_exc.L4ExcL4ExcConnection).connect()
            ModularSamplingProbabilisticConnectorAnnotationSamplesCount(self,'V1L4ExcL4InhConnection',cortex_exc_l4,cortex_inh_l4,self.parameters.sheets.l4_cortex_exc.L4ExcL4InhConnection).connect()
            ModularSamplingProbabilisticConnector(self,'V1L4InhL4ExcConnection',cortex_inh_l4,cortex_exc_l4,self.parameters.sheets.l4_cortex_inh.L4InhL4ExcConnection).connect()
            ModularSamplingProbabilisticConnector(self,'V1L4InhL4InhConnection',cortex_inh_l4,cortex_inh_l4,self.parameters.sheets.l4_cortex_inh.L4InhL4InhConnection).connect()

        # initialize afferent layer 4 to layer 2/3 projection
        ModularSamplingProbabilisticConnector(self,'V1L4ExcL23ExcConnection',cortex_exc_l4,cortex_exc_l23,self.parameters.sheets.l23_cortex_exc.L4ExcL23ExcConnection).connect()
        ModularSamplingProbabilisticConnector(self,'V1L4ExcL23InhConnection',cortex_exc_l4,cortex_inh_l23,self.parameters.sheets.l23_cortex_inh.L4ExcL23InhConnection).connect()
	
        if self.parameters.with_cortical_conn:

            # initialize lateral layer 2/3 projections
            ModularSamplingProbabilisticConnector(self,'V1L23ExcL23ExcConnection',cortex_exc_l23,cortex_exc_l23,self.parameters.sheets.l23_cortex_exc.L23ExcL23ExcConnection).connect()
            ModularSamplingProbabilisticConnector(self,'V1L23ExcL23InhConnection',cortex_exc_l23,cortex_inh_l23,self.parameters.sheets.l23_cortex_exc.L23ExcL23InhConnection).connect()
            ModularSamplingProbabilisticConnector(self,'V1L23InhL23ExcConnection',cortex_inh_l23,cortex_exc_l23,self.parameters.sheets.l23_cortex_inh.L23InhL23ExcConnection).connect()
            ModularSamplingProbabilisticConnector(self,'V1L23InhL23InhConnection',cortex_inh_l23,cortex_inh_l23,self.parameters.sheets.l23_cortex_inh.L23InhL23InhConnection).connect()

            if self.parameters.feedback:
                        # initialize feedback layer 2/3 projections
                        ModularSamplingProbabilisticConnector(self,'V1L23ExcL4ExcConnection',cortex_exc_l23,cortex_exc_l4,self.parameters.sheets.l23_cortex_exc.L23ExcL4ExcConnection).connect()
                        ModularSamplingProbabilisticConnector(self,'V1L23ExcL4InhConnection',cortex_exc_l23,cortex_inh_l4,self.parameters.sheets.l23_cortex_exc.L23ExcL4InhConnection).connect()
Example #9
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)        
        # Load components
        CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
        CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)
        
        cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

        # initialize projections
        UniformProbabilisticArborization(self,'V1L4ExcL4ExcConnection',cortex_exc_l4,cortex_exc_l4,self.parameters.l4_cortex_exc.L4ExcL4ExcConnection).connect()
        UniformProbabilisticArborization(self,'V1L4ExcL4InhConnection',cortex_exc_l4,cortex_inh_l4,self.parameters.l4_cortex_exc.L4ExcL4InhConnection).connect()
        UniformProbabilisticArborization(self,'V1L4InhL4ExcConnection',cortex_inh_l4,cortex_exc_l4,self.parameters.l4_cortex_inh.L4InhL4ExcConnection).connect()
        UniformProbabilisticArborization(self,'V1L4InhL4InhConnection',cortex_inh_l4,cortex_inh_l4,self.parameters.l4_cortex_inh.L4InhL4InhConnection).connect()
Example #10
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
        CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)
        
        cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

        # initialize projections
        FixedKConnector(self,'V1L4ExcL4ExcConnection',cortex_exc_l4,cortex_exc_l4,self.parameters.l4_cortex_exc.L4ExcL4ExcConnection).connect()
        FixedKConnector(self,'V1L4ExcL4InhConnection',cortex_exc_l4,cortex_inh_l4,self.parameters.l4_cortex_exc.L4ExcL4InhConnection).connect()
        FixedKConnector(self,'V1L4InhL4ExcConnection',cortex_inh_l4,cortex_exc_l4,self.parameters.l4_cortex_inh.L4InhL4ExcConnection).connect()
        FixedKConnector(self,'V1L4InhL4InhConnection',cortex_inh_l4,cortex_inh_l4,self.parameters.l4_cortex_inh.L4InhL4InhConnection).connect()
Example #11
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        print(self.parameters.sheets.exc_layer.component)
        ExcLayer = load_component(self.parameters.sheets.exc_layer.component)
        InhLayer = load_component(self.parameters.sheets.inh_layer.component)
        
        exc = ExcLayer(self, self.parameters.sheets.exc_layer.params)
        inh = InhLayer(self, self.parameters.sheets.inh_layer.params)

        # initialize projections
        UniformProbabilisticArborization(self,'ExcExcConnection',exc,exc,self.parameters.sheets.exc_layer.ExcExcConnection).connect()
        UniformProbabilisticArborization(self,'ExcInhConnection',exc,inh,self.parameters.sheets.exc_layer.ExcInhConnection).connect()
        UniformProbabilisticArborization(self,'InhExcConnection',inh,exc,self.parameters.sheets.inh_layer.InhExcConnection).connect()
        UniformProbabilisticArborization(self,'InhInhConnection',inh,inh,self.parameters.sheets.inh_layer.InhInhConnection).connect()
Example #12
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.local_and_to_stimulate_indexes = [
            d[i] for i in set(self.ids) & set(self.sheet.pop.local_cells)
        ]

        exc_syn = self.sheet.sim.StaticSynapse(
            weight=self.parameters.exc_weight)
        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.StGen(rng=numpy.random.RandomState(seed=seeds[i]))
                for i in self.local_and_to_stimulate_indexes
            ]
            self.sheet.sim.Projection(self.ssae,
                                      self.sheet.pop,
                                      self.sheet.sim.OneToOneConnector(),
                                      synapse_type=exc_syn,
                                      receptor_type='excitatory')
Example #13
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()
     self.scs = self.sheet.sim.StepCurrentSource(times=[0.0], amplitudes=[0.0])
     for cell in self.sheet.pop.all_cells:
         cell.inject(self.scs)
Example #14
0
 def setup_artificial_stimulation(self):
     """
     Called once population is created. Sets up the background noise.
     """
     self.artificial_stimulators = []
     for k in  self.parameters.artificial_stimulators.keys():
         direct_stimulator = load_component(self.parameters.artificial_stimulators[k].component)
         self.artificial_stimulators.append(direct_stimulator(self,self.parameters.artificial_stimulators[k].params))
Example #15
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()
     self.scs = self.sheet.sim.StepCurrentSource(times=[0.0], amplitudes=[0.0])
     for cell in self.sheet.pop.all_cells:
         cell.inject(self.scs)
Example #16
0
 def setup_artificial_stimulation(self):
     """
     Called once population is created. Sets up the background noise.
     """
     self.artificial_stimulators = []
     for k in  self.parameters.artificial_stimulators.keys():
         direct_stimulator = load_component(self.parameters.artificial_stimulators[k].component)
         self.artificial_stimulators.append(direct_stimulator(self,self.parameters.artificial_stimulators[k].params))
Example #17
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components

        RetinaLGN = load_component(self.parameters.sheets.retina_lgn.component)
      
        # Build and instrument the network
        self.visual_field = VisualRegion(location_x=self.parameters.visual_field.centre[0],location_y=self.parameters.visual_field.centre[1],size_x=self.parameters.visual_field.size[0],size_y=self.parameters.visual_field.size[1])
        self.input_layer = RetinaLGN(self, self.parameters.sheets.retina_lgn.params)
Example #18
0
 def __init__(self, sheet, parameters):
     DirectStimulator.__init__(self, sheet,parameters)
     
     population_selector = load_component(self.parameters.population_selector.component)
     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))
     to_stimulate_indexes = [d[i] for i in ids]
     
     self.scs = self.sheet.sim.StepCurrentSource(times=[0.0], amplitudes=[0.0])
     for i in to_stimulate_indexes:
         self.sheet.pop.all_cells[i].inject(self.scs)
Example #19
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.local_and_to_stimulate_indexes = [d[i] for i in set(self.ids) & set(self.sheet.pop.local_cells)]
     
     exc_syn = self.sheet.sim.StaticSynapse(weight=self.parameters.exc_weight)
     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.StGen(rng=numpy.random.RandomState(seed=seeds[i])) for i in self.local_and_to_stimulate_indexes]
         self.sheet.sim.Projection(self.ssae, self.sheet.pop,self.sheet.sim.OneToOneConnector(),synapse_type=exc_syn,receptor_type='excitatory') 
Example #20
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
        CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)

        cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

        # initialize projections
        FixedKConnector(
            self, 'V1L4ExcL4ExcConnection', cortex_exc_l4, cortex_exc_l4,
            self.parameters.l4_cortex_exc.L4ExcL4ExcConnection).connect()
        FixedKConnector(
            self, 'V1L4ExcL4InhConnection', cortex_exc_l4, cortex_inh_l4,
            self.parameters.l4_cortex_exc.L4ExcL4InhConnection).connect()
        FixedKConnector(
            self, 'V1L4InhL4ExcConnection', cortex_inh_l4, cortex_exc_l4,
            self.parameters.l4_cortex_inh.L4InhL4ExcConnection).connect()
        FixedKConnector(
            self, 'V1L4InhL4InhConnection', cortex_inh_l4, cortex_inh_l4,
            self.parameters.l4_cortex_inh.L4InhL4InhConnection).connect()
Example #21
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components

        RetinaLGN = load_component(self.parameters.sheets.retina_lgn.component)

        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1])
        self.input_layer = RetinaLGN(self,
                                     self.parameters.sheets.retina_lgn.params)
Example #22
0
    def __init__(self, sim, num_threads, parameters):
        BaseComponent.__init__(self, self, parameters)
        self.first_time = True
        self.sim = sim
        self.node = sim.setup(timestep=self.parameters.time_step, min_delay=self.parameters.min_delay, max_delay=self.parameters.max_delay, threads=num_threads)  # should have some parameters here
        self.sheets = {}
        self.connectors = {}

        # Set-up the input space
        if self.parameters.input_space != None:
            input_space_type = load_component(self.parameters.input_space_type)
            self.input_space = input_space_type(self.parameters.input_space)
        else:
            self.input_space = None
            
        self.simulator_time = 0
Example #23
0
    def setup_to_record_list(self):
        """
        Set up the recording configuration.
        """
        self.to_record = {}
        for k in  self.parameters.recorders.keys():
            recording_configuration = load_component(self.parameters.recorders[k].component)
            l = recording_configuration(self,self.parameters.recorders[k].params).generate_idd_list_of_neurons()
            if isinstance(self.parameters.recorders[k].variables,str):
               self.parameters.recorders[k].variables = [self.parameters.recorders[k].variables]
               
            for var in self.parameters.recorders[k].variables:
                self.to_record[var] = list(set(self.to_record.get(var,[])) | set(l))


        for k in self.to_record.keys():
            idds = self.pop.all_cells.astype(int)
            self.to_record[k] = [numpy.flatnonzero(idds == idd)[0] for idd in self.to_record[k]]
Example #24
0
    def setup_to_record_list(self):
        """
        Set up the recording configuration.
        """
        self.to_record = {}
        for k in  self.parameters.recorders.keys():
            recording_configuration = load_component(self.parameters.recorders[k].component)
            l = recording_configuration(self,self.parameters.recorders[k].params).generate_idd_list_of_neurons()
            if isinstance(self.parameters.recorders[k].variables,str):
               self.parameters.recorders[k].variables = [self.parameters.recorders[k].variables]
               
            for var in self.parameters.recorders[k].variables:
                self.to_record[var] = list(set(self.to_record.get(var,[])) | set(l))


        for k in self.to_record.keys():
            idds = self.pop.all_cells.astype(int)
            self.to_record[k] = [numpy.flatnonzero(idds == idd)[0] for idd in self.to_record[k]]
Example #25
0
    def __init__(self,simulator,num_threads,parameters):
        Model.__init__(self,simulator,num_threads,parameters)        
        
        RetinaLGN = load_component(self.parameters.sheets.retina_lgn.component)
      
        # Build and instrument the network
        self.visual_field = VisualRegion(location_x=self.parameters.visual_field.centre[0],location_y=self.parameters.visual_field.centre[1],size_x=self.parameters.visual_field.size[0],size_y=self.parameters.visual_field.size[1])
        self.input_layer = RetinaLGN(self, self.parameters.sheets.retina_lgn.params)

        # which neurons to record
        tr = {'spikes' : 'all', 
              'v' : numpy.arange(0,60,1),
              'gsyn_exc' :numpy.arange(0,60,1),
              'gsyn_inh' : numpy.arange(0,60,1),
        }

        self.input_layer.sheets['X_ON'].to_record = tr #'all'
        self.input_layer.sheets['X_OFF'].to_record = tr #'all'
Example #26
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')
Example #27
0
    def __init__(self, sim, num_threads, parameters):
        BaseComponent.__init__(self, self, parameters)
        self.first_time = True
        self.sim = sim
        self.node = sim.setup(
            timestep=self.parameters.time_step,
            min_delay=self.parameters.min_delay,
            max_delay=self.parameters.max_delay,
            threads=num_threads)  # should have some parameters here
        self.sheets = OrderedDict()
        self.connectors = OrderedDict()
        self.num_threads = num_threads

        # Set-up the input space
        if self.parameters.input_space != None:
            input_space_type = load_component(self.parameters.input_space_type)
            self.input_space = input_space_type(self.parameters.input_space)
        else:
            self.input_space = None

        self.simulator_time = 0
Example #28
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(
            self.parameters.sheets.l4_cortex_exc.component)
        CortexInhL4 = load_component(
            self.parameters.sheets.l4_cortex_inh.component)
        if not self.parameters.only_afferent and self.parameters.l23:
            CortexExcL23 = load_component(
                self.parameters.sheets.l23_cortex_exc.component)
            CortexInhL23 = load_component(
                self.parameters.sheets.l23_cortex_inh.component)

        RetinaLGN = load_component(self.parameters.sheets.retina_lgn.component)

        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1],
        )
        self.input_layer = RetinaLGN(self,
                                     self.parameters.sheets.retina_lgn.params)
        cortex_exc_l4 = CortexExcL4(
            self, self.parameters.sheets.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(
            self, self.parameters.sheets.l4_cortex_inh.params)

        if not self.parameters.only_afferent and self.parameters.l23:
            cortex_exc_l23 = CortexExcL23(
                self, self.parameters.sheets.l23_cortex_exc.params)
            cortex_inh_l23 = CortexInhL23(
                self, self.parameters.sheets.l23_cortex_inh.params)

        # initialize afferent layer 4 projections
        GaborConnector(
            self,
            self.input_layer.sheets["X_ON"],
            self.input_layer.sheets["X_OFF"],
            cortex_exc_l4,
            self.parameters.sheets.l4_cortex_exc.AfferentConnection,
            "V1AffConnection",
        )
        GaborConnector(
            self,
            self.input_layer.sheets["X_ON"],
            self.input_layer.sheets["X_OFF"],
            cortex_inh_l4,
            self.parameters.sheets.l4_cortex_inh.AfferentConnection,
            "V1AffInhConnection",
        )

        # initialize lateral layer 4 projections
        if not self.parameters.only_afferent:

            ModularSamplingProbabilisticConnectorAnnotationSamplesCount(
                self,
                "V1L4ExcL4ExcConnection",
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.sheets.l4_cortex_exc.L4ExcL4ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnectorAnnotationSamplesCount(
                self,
                "V1L4ExcL4InhConnection",
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.sheets.l4_cortex_exc.L4ExcL4InhConnection,
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                "V1L4InhL4ExcConnection",
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.sheets.l4_cortex_inh.L4InhL4ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L4InhL4InhConnection",
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.sheets.l4_cortex_inh.L4InhL4InhConnection,
            ).connect()

            if self.parameters.l23:

                # initialize afferent layer 4 to layer 2/3 projection
                ModularSamplingProbabilisticConnector(
                    self,
                    "V1L4ExcL23ExcConnection",
                    cortex_exc_l4,
                    cortex_exc_l23,
                    self.parameters.sheets.l23_cortex_exc.
                    L4ExcL23ExcConnection,
                ).connect()
                ModularSamplingProbabilisticConnector(
                    self,
                    "V1L4ExcL23InhConnection",
                    cortex_exc_l4,
                    cortex_inh_l23,
                    self.parameters.sheets.l23_cortex_inh.
                    L4ExcL23InhConnection,
                ).connect()

                ModularSamplingProbabilisticConnector(
                    self,
                    "V1L23ExcL23ExcConnection",
                    cortex_exc_l23,
                    cortex_exc_l23,
                    self.parameters.sheets.l23_cortex_exc.
                    L23ExcL23ExcConnection,
                ).connect()
                ModularSamplingProbabilisticConnector(
                    self,
                    "V1L23ExcL23InhConnection",
                    cortex_exc_l23,
                    cortex_inh_l23,
                    self.parameters.sheets.l23_cortex_exc.
                    L23ExcL23InhConnection,
                ).connect()
                ModularSamplingProbabilisticConnector(
                    self,
                    "V1L23InhL23ExcConnection",
                    cortex_inh_l23,
                    cortex_exc_l23,
                    self.parameters.sheets.l23_cortex_inh.
                    L23InhL23ExcConnection,
                ).connect()
                ModularSamplingProbabilisticConnector(
                    self,
                    "V1L23InhL23InhConnection",
                    cortex_inh_l23,
                    cortex_inh_l23,
                    self.parameters.sheets.l23_cortex_inh.
                    L23InhL23InhConnection,
                ).connect()
                if self.parameters.feedback:
                    ModularSamplingProbabilisticConnector(
                        self,
                        "V1L23ExcL4ExcConnection",
                        cortex_exc_l23,
                        cortex_exc_l4,
                        self.parameters.sheets.l23_cortex_exc.
                        L23ExcL4ExcConnection,
                    ).connect()
                    ModularSamplingProbabilisticConnector(
                        self,
                        "V1L23ExcL4InhConnection",
                        cortex_exc_l23,
                        cortex_inh_l4,
                        self.parameters.sheets.l23_cortex_exc.
                        L23ExcL4InhConnection,
                    ).connect()
Example #29
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        LGN = load_component(self.parameters.lgn.component)
        # Instance
        self.input_layer = LGN(self, self.parameters.lgn.params)
      
        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1]
        )

        # PROJECTIONS
        ########################################################

        # PGN
        if withPGN:
            # Load components
            PGN = load_component( self.parameters.pgn.component )
            # Instance
            pgn = PGN(self, self.parameters.pgn.params)

            # LGN-PGN
            ModularSamplingProbabilisticConnector(
                self,
                'LGN_PGN_ConnectionOn',                     # name
                self.input_layer.sheets['X_ON'],     # source
                pgn,                                        # target
                self.parameters.pgn.LGN_PGN_ConnectionOn    # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'LGN_PGN_ConnectionOff',                    # name
                self.input_layer.sheets['X_OFF'],    # source
                pgn,                                        # target
                self.parameters.pgn.LGN_PGN_ConnectionOff   # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'PGN_PGN_Connection',                       # name
                pgn,                                        # source
                pgn,                                        # target
                self.parameters.pgn.PGN_PGN_Connection      # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'PGN_LGN_ConnectionOn',                     # name
                pgn,                                        # source
                self.input_layer.sheets['X_ON'],     # target
                self.parameters.pgn.PGN_LGN_ConnectionOn    # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'PGN_LGN_ConnectionOff',                    # name
                pgn,                                        # source
                self.input_layer.sheets['X_OFF'],    # target
                self.parameters.pgn.PGN_LGN_ConnectionOff   # params
            ).connect()

        # V1
        if withV1: # CTC
            # Load components
            CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
            CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)
            # Instance
            cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
            cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

            ########################################################
            # THALAMO-CORTICAL
            # initialize afferent layer 4 projections
            GaborConnector(
                self,
                self.input_layer.sheets['X_ON'],
                self.input_layer.sheets['X_OFF'],
                cortex_exc_l4,                                      # target
                self.parameters.l4_cortex_exc.AfferentConnection,   # parameters
                'V1AffConnection'                                   # name
            )

            GaborConnector(
                self,
                self.input_layer.sheets['X_ON'],
                self.input_layer.sheets['X_OFF'],
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.AfferentConnection,
                'V1AffInhConnection'
            )

            ########################################################
            # CORTICO-CORTICAL
            # random lateral layer 4 projections
            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4ExcL4ExcConnectionRand',
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_exc.L4ExcL4ExcConnectionRand
            ).connect()

            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4ExcL4InhConnectionRand',
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_exc.L4ExcL4InhConnectionRand
            ).connect()
            
            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4InhL4ExcConnectionRand',
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_inh.L4InhL4ExcConnectionRand
            ).connect()
            
            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4InhL4InhConnectionRand',
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.L4InhL4InhConnectionRand
            ).connect()

            # lateral layer 4 projections
            ModularSamplingProbabilisticConnector(
                self,
                'V1L4ExcL4ExcConnection',
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_exc.L4ExcL4ExcConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'V1L4ExcL4InhConnection',
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_exc.L4ExcL4InhConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'V1L4InhL4ExcConnection',
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_inh.L4InhL4ExcConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'V1L4InhL4InhConnection',
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.L4InhL4InhConnection
            ).connect()

            ########################################################
            # CORTICO-THALAMIC
            if withFeedback_CxLGN:
                ModularSamplingProbabilisticConnector(
                    self,
                    'V1EffConnectionOn',
                    cortex_exc_l4,
                    self.input_layer.sheets['X_ON'],
                    self.parameters.l4_cortex_exc.EfferentConnection_LGN
                ).connect()

                ModularSamplingProbabilisticConnector(
                    self,
                    'V1EffConnectionOff',
                    cortex_exc_l4,
                    self.input_layer.sheets['X_OFF'],
                    self.parameters.l4_cortex_exc.EfferentConnection_LGN
                ).connect()

            if withFeedback_CxPGN and withPGN:
                ModularSamplingProbabilisticConnector(
                    self,
                    'V1EffConnectionPGN',
                    cortex_exc_l4,
                    pgn,
                    self.parameters.l4_cortex_exc.EfferentConnection_PGN
                ).connect()
Example #30
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
        CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)

        if not self.parameters.only_afferent:
            CortexExcL23 = load_component(self.parameters.l23_cortex_exc.component)
            CortexInhL23 = load_component(self.parameters.l23_cortex_inh.component)

        RetinaLGN = load_component(self.parameters.retina_lgn.component)

        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1],
        )
        self.input_layer = RetinaLGN(self, self.parameters.retina_lgn.params)
        cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
        cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

        if not self.parameters.only_afferent:
            cortex_exc_l23 = CortexExcL23(self, self.parameters.l23_cortex_exc.params)
            cortex_inh_l23 = CortexInhL23(self, self.parameters.l23_cortex_inh.params)

        # initialize afferent layer 4 projections
        GaborConnector(
            self,
            self.input_layer.sheets["X_ON"],
            self.input_layer.sheets["X_OFF"],
            cortex_exc_l4,
            self.parameters.l4_cortex_exc.AfferentConnection,
            "V1AffConnection",
        )
        GaborConnector(
            self,
            self.input_layer.sheets["X_ON"],
            self.input_layer.sheets["X_OFF"],
            cortex_inh_l4,
            self.parameters.l4_cortex_inh.AfferentConnection,
            "V1AffInhConnection",
        )

        # initialize lateral layer 4 projections
        if not self.parameters.only_afferent:
            ModularSingleWeightProbabilisticConnector(
                self,
                "V1L4ExcL4ExcConnectionRand",
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_exc.L4ExcL4ExcConnectionRand,
            ).connect()
            ModularSingleWeightProbabilisticConnector(
                self,
                "V1L4ExcL4InhConnectionRand",
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_exc.L4ExcL4InhConnectionRand,
            ).connect()
            ModularSingleWeightProbabilisticConnector(
                self,
                "V1L4InhL4ExcConnectionRand",
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_inh.L4InhL4ExcConnectionRand,
            ).connect()
            ModularSingleWeightProbabilisticConnector(
                self,
                "V1L4InhL4InhConnectionRand",
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.L4InhL4InhConnectionRand,
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                "V1L4ExcL4ExcConnection",
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_exc.L4ExcL4ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L4ExcL4InhConnection",
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_exc.L4ExcL4InhConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L4InhL4ExcConnection",
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_inh.L4InhL4ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L4InhL4InhConnection",
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.L4InhL4InhConnection,
            ).connect()

            # initialize afferent layer 4 to layer 2/3 projection
            ModularSamplingProbabilisticConnector(
                self,
                "V1L4ExcL23ExcConnection",
                cortex_exc_l4,
                cortex_exc_l23,
                self.parameters.l23_cortex_exc.L4ExcL23ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L4ExcL23InhConnection",
                cortex_exc_l4,
                cortex_inh_l23,
                self.parameters.l23_cortex_inh.L4ExcL23InhConnection,
            ).connect()

            # initialize lateral layer 2/3 projections
            ModularSamplingProbabilisticConnector(
                self,
                "V1L23ExcL23ExcConnection",
                cortex_exc_l23,
                cortex_exc_l23,
                self.parameters.l23_cortex_exc.L23ExcL23ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L23ExcL23InhConnection",
                cortex_exc_l23,
                cortex_inh_l23,
                self.parameters.l23_cortex_exc.L23ExcL23InhConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L23InhL23ExcConnection",
                cortex_inh_l23,
                cortex_exc_l23,
                self.parameters.l23_cortex_inh.L23InhL23ExcConnection,
            ).connect()
            ModularSamplingProbabilisticConnector(
                self,
                "V1L23InhL23InhConnection",
                cortex_inh_l23,
                cortex_inh_l23,
                self.parameters.l23_cortex_inh.L23InhL23InhConnection,
            ).connect()
Example #31
0
    def __init__(self, sheet,parameters,shared_scs=None):
        DirectStimulator.__init__(self, sheet,parameters)

        assert math.fmod(self.parameters.size,self.parameters.spacing) < 0.000000001 , "Error the size has to be multiple of spacing!"
        assert math.fmod(self.parameters.size / self.parameters.spacing /2,2) < 0.000000001 , "Error the size and spacing have to be such that they give odd number of elements!"

        
        axis_coors = numpy.arange(0,self.parameters.size+self.parameters.spacing,self.parameters.spacing) - self.parameters.size/2.0 

        n = int(numpy.floor(len(axis_coors)/2.0))
        stimulator_coordinates = numpy.meshgrid(axis_coors,axis_coors)

        pylab.figure(figsize=(42,12))

        #let's load up disperssion data and setup interpolation
        f = open(self.parameters.light_source_light_propagation_data,'r')
        radprofs = pickle.load(f)
        #light_flux_lookup =  scipy.interpolate.RegularGridInterpolator((numpy.arange(0,1080,60),numpy.linspace(0,1,354)*149.701*numpy.sqrt(2)), radprofs, method='linear',bounds_error=False,fill_value=0)
        light_flux_lookup =  scipy.interpolate.RegularGridInterpolator((numpy.arange(0,1080,60),numpy.linspace(0,1,708)*299.7*numpy.sqrt(2)), radprofs, method='linear',bounds_error=False,fill_value=0)

        # the constant translating the data in radprofs to photons/s/cm^2
        K = 2.97e26
        W = 3.9e-10

        # now let's calculate mixing weights, this will be a matrix nxm where n is 
        # the number of neurons in the population and m is the number of stimulators
        x =  stimulator_coordinates[0].flatten()
        y =  stimulator_coordinates[1].flatten()
        xx,yy = self.sheet.vf_2_cs(self.sheet.pop.positions[0],self.sheet.pop.positions[1])
        zeros = numpy.zeros(len(x))
        f = open(Global.root_directory +'positions' + self.sheet.name.replace('/','_') + '.pickle','w')
        pickle.dump((xx,yy),f)
          
        mixing_templates=[]
        for depth in numpy.arange(sheet.parameters.min_depth,sheet.parameters.max_depth+self.parameters.depth_sampling_step,self.parameters.depth_sampling_step):
            temp = numpy.reshape(light_flux_lookup(numpy.transpose([zeros+depth,numpy.sqrt(numpy.power(x,2)  + numpy.power(y,2))])),(2*n+1,2*n+1))
            a  = temp[n,n:]
            cutof = numpy.argmax((numpy.sum(a)-numpy.cumsum(a))/numpy.sum(a) < 0.01)
            assert numpy.shape(temp[n-cutof:n+cutof+1,n-cutof:n+cutof+1]) == (2*cutof+1,2*cutof+1), str(numpy.shape(temp[n-cutof:n+cutof,n-cutof:n+cutof])) + 'vs' + str((2*cutof+1,2*cutof+1))
            mixing_templates.append((temp[n-cutof:n+cutof+1,n-cutof:n+cutof+1],cutof))

        signal_function = load_component(self.parameters.stimulating_signal)
        stimulator_signals,self.scale = signal_function(sheet,stimulator_coordinates[0],stimulator_coordinates[1],self.parameters.current_update_interval,self.parameters.stimulating_signal_parameters )

        #stimulator_signals = numpy.reshape(stimulator_signals,((2*n+1)*(2*n+1),-1))
        
        self.mixed_signals = numpy.zeros((self.sheet.pop.size,numpy.shape(stimulator_signals)[2]),dtype=numpy.float64)
        
        # find coordinates given spacing and shift by half the array size
        nearest_ix = numpy.rint(yy/self.parameters.spacing)+n
        nearest_iy = numpy.rint(xx/self.parameters.spacing)+n
        nearest_iz = numpy.rint((numpy.array(self.sheet.pop.positions[2])-sheet.parameters.min_depth)/self.parameters.depth_sampling_step)

        nearest_ix[nearest_ix<0] = 0
        nearest_iy[nearest_iy<0] = 0
        nearest_ix[nearest_ix>2*n] = 2*n
        nearest_iy[nearest_iy>2*n] = 2*n


        for i in range(0,self.sheet.pop.size):
            temp,cutof = mixing_templates[int(nearest_iz[i])]

            ss = stimulator_signals[max(int(nearest_ix[i]-cutof),0):int(nearest_ix[i]+cutof+1),max(int(nearest_iy[i]-cutof),0):int(nearest_iy[i]+cutof+1),:]
            if ss != numpy.array([]):
               temp = temp[max(int(cutof-nearest_ix[i]),0):max(int(2*n+1+cutof-nearest_ix[i]),0),max(int(cutof-nearest_iy[i]),0):max(int(2*n+1+cutof-nearest_iy[i]),0)]
               self.mixed_signals[i,:] = K*W*numpy.dot(temp.flatten(),numpy.reshape(ss,(len(temp.flatten()),-1)))


        lam=numpy.squeeze(numpy.max(self.mixed_signals,axis=1))
        for i in range(0,self.sheet.pop.size):
              self.sheet.add_neuron_annotation(i, 'Light activation magnitude(' +self.sheet.name + ',' +  str(self.scale) + ',' +  str(self.parameters.stimulating_signal_parameters.orientation.value)  + ',' +  str(self.parameters.stimulating_signal_parameters.sharpness) + ',' +  str(self.parameters.spacing) + ')', lam[i], protected=True)

        #ax = pylab.subplot(154, projection='3d')
        ax = pylab.subplot(154)
        pylab.gca().set_aspect('equal')
        pylab.title('Activation magnitude (neurons)')
        #ax.scatter(self.sheet.pop.positions[0],self.sheet.pop.positions[1],self.sheet.pop.positions[2],s=10,c=lam,cmap='gray',vmin=0)
        ax.scatter(self.sheet.pop.positions[0],self.sheet.pop.positions[1],s=10,c=lam,cmap='gray',vmin=0)
        ax = pylab.gca()
        #ax.set_zlim(ax.get_zlim()[::-1])
        
        assert numpy.shape(self.mixed_signals) == (self.sheet.pop.size,numpy.shape(stimulator_signals)[2]), "ERROR: mixed_signals doesn't have the desired size:" + str(numpy.shape(self.mixed_signals)) + " vs " +str((self.sheet.pop.size,numpy.shape(stimulator_signals)[1]))
        
        self.stimulation_duration = numpy.shape(self.mixed_signals)[1] * self.parameters.current_update_interval
        
        if shared_scs != None:
           self.scs = shared_scs
        else:
           self.scs = [self.sheet.sim.StepCurrentSource(times=[0.0], amplitudes=[0.0]) for cell in self.sheet.pop.all_cells] 
           for cell,scs in zip(self.sheet.pop.all_cells,self.scs):
               cell.inject(scs)
Example #32
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        LGN = load_component(self.parameters.lgn.component)
        # Instance
        self.input_layer = LGN(self, self.parameters.lgn.params)
      
        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1]
        )

        # PROJECTIONS
        ########################################################

        # PGN
        if withPGN:
            # Load components
            PGN = load_component( self.parameters.pgn.component )
            # Instance
            pgn = PGN(self, self.parameters.pgn.params)

            # LGN-PGN
            ModularSamplingProbabilisticConnector(
                self,
                'LGN_PGN_ConnectionOn',                     # name
                self.input_layer.sheets['X_ON'],     # source
                pgn,                                        # target
                self.parameters.pgn.LGN_PGN_ConnectionOn    # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'LGN_PGN_ConnectionOff',                    # name
                self.input_layer.sheets['X_OFF'],    # source
                pgn,                                        # target
                self.parameters.pgn.LGN_PGN_ConnectionOff   # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'PGN_PGN_Connection',                       # name
                pgn,                                        # source
                pgn,                                        # target
                self.parameters.pgn.PGN_PGN_Connection      # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'PGN_LGN_ConnectionOn',                     # name
                pgn,                                        # source
                self.input_layer.sheets['X_ON'],     # target
                self.parameters.pgn.PGN_LGN_ConnectionOn    # params
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'PGN_LGN_ConnectionOff',                    # name
                pgn,                                        # source
                self.input_layer.sheets['X_OFF'],    # target
                self.parameters.pgn.PGN_LGN_ConnectionOff   # params
            ).connect()

        # V1
        if withV1: # CTC
            # Load components
            CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
            CortexInhL4 = load_component(self.parameters.l4_cortex_inh.component)
            # Instance
            cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
            cortex_inh_l4 = CortexInhL4(self, self.parameters.l4_cortex_inh.params)

            # ########################################################
            # THALAMO-CORTICAL
            # initialize afferent layer 4 projections
            GaborConnector(
                self,
                self.input_layer.sheets['X_ON'],
                self.input_layer.sheets['X_OFF'],
                cortex_exc_l4,                                      # target
                self.parameters.l4_cortex_exc.AfferentConnection,   # parameters
                'V1AffConnection'                                   # name
            )

            GaborConnector(
                self,
                self.input_layer.sheets['X_ON'],
                self.input_layer.sheets['X_OFF'],
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.AfferentConnection,
                'V1AffInhConnection'
            )

            # ########################################################
            # CORTICO-CORTICAL
            # random lateral layer 4 projections
            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4ExcL4ExcConnectionRand',
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_exc.L4ExcL4ExcConnectionRand
            ).connect()

            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4ExcL4InhConnectionRand',
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_exc.L4ExcL4InhConnectionRand
            ).connect()
            
            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4InhL4ExcConnectionRand',
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_inh.L4InhL4ExcConnectionRand
            ).connect()
            
            ModularSingleWeightProbabilisticConnector(
                self,
                'V1L4InhL4InhConnectionRand',
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.L4InhL4InhConnectionRand
            ).connect()

            # lateral layer 4 projections
            ModularSamplingProbabilisticConnector(
                self,
                'V1L4ExcL4ExcConnection',
                cortex_exc_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_exc.L4ExcL4ExcConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'V1L4ExcL4InhConnection',
                cortex_exc_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_exc.L4ExcL4InhConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'V1L4InhL4ExcConnection',
                cortex_inh_l4,
                cortex_exc_l4,
                self.parameters.l4_cortex_inh.L4InhL4ExcConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self,
                'V1L4InhL4InhConnection',
                cortex_inh_l4,
                cortex_inh_l4,
                self.parameters.l4_cortex_inh.L4InhL4InhConnection
            ).connect()

            ########################################################
            # CORTICO-THALAMIC
            if withFeedback_CxLGN:
                ModularSamplingProbabilisticConnector(
                    self,
                    'V1EffConnectionOn',
                    cortex_exc_l4,
                    self.input_layer.sheets['X_ON'],
                    self.parameters.l4_cortex_exc.EfferentConnection_LGN
                ).connect()

                ModularSamplingProbabilisticConnector(
                    self,
                    'V1EffConnectionOff',
                    cortex_exc_l4,
                    self.input_layer.sheets['X_OFF'],
                    self.parameters.l4_cortex_exc.EfferentConnection_LGN
                ).connect()

                # GaborConnector(
                #     self,
                #     self.input_layer.sheets['X_ON'],
                #     self.input_layer.sheets['X_OFF'],
                #     cortex_exc_l4,                                      # source
                #     self.parameters.l4_cortex_exc.EfferentConnection,   # parameters
                #     'V1EffConnection'                                   # name
                # )


            if withFeedback_CxPGN and withPGN:
                ModularSamplingProbabilisticConnector(
                    self,
                    'V1EffConnectionPGN',
                    cortex_exc_l4,
                    pgn,
                    self.parameters.l4_cortex_exc.EfferentConnection_PGN
                ).connect()
Example #33
0
 def __init__(self, sim, num_threads, parameters):
     Model.__init__(self, sim, num_threads, parameters)
     # Load components
     CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
     cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
Example #34
0
 def __init__(self, sim, num_threads, parameters):
     Model.__init__(self, sim, num_threads, parameters)
     # Load components
     CortexExcL4 = load_component(self.parameters.l4_cortex_exc.component)
     cortex_exc_l4 = CortexExcL4(self, self.parameters.l4_cortex_exc.params)
Example #35
0
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExc1 = load_component(self.parameters.exc1.component)
        CortexExc2 = load_component(self.parameters.exc2.component)
        CortexInh1 = load_component(self.parameters.inh1.component)
        CortexInh2 = load_component(self.parameters.inh2.component)

        cortex_exc1 = CortexExc1(self, self.parameters.exc1.params)
        cortex_exc2 = CortexExc2(self, self.parameters.exc2.params)
        cortex_inh1 = CortexInh1(self, self.parameters.inh1.params)
        cortex_inh2 = CortexInh2(self, self.parameters.inh2.params)

        # initialize projections
        UniformProbabilisticArborization(
            self, 'V1Exc1Exc1Connection', cortex_exc1, cortex_exc1,
            self.parameters.exc1.Exc1Exc1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Exc1Exc2Connection', cortex_exc1, cortex_exc2,
            self.parameters.exc1.Exc1Exc2Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Exc1Inh1Connection', cortex_exc1, cortex_inh1,
            self.parameters.exc1.Exc1Inh1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Exc1Inh2Connection', cortex_exc1, cortex_inh2,
            self.parameters.exc1.Exc1Inh2Connection).connect()

        UniformProbabilisticArborization(
            self, 'V1Exc2Exc1Connection', cortex_exc2, cortex_exc1,
            self.parameters.exc2.Exc2Exc1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Exc2Exc2Connection', cortex_exc2, cortex_exc2,
            self.parameters.exc2.Exc2Exc2Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Exc2Inh1Connection', cortex_exc2, cortex_inh1,
            self.parameters.exc2.Exc2Inh1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Exc2Inh2Connection', cortex_exc2, cortex_inh2,
            self.parameters.exc2.Exc2Inh2Connection).connect()

        UniformProbabilisticArborization(
            self, 'V1Inh1Exc1Connection', cortex_inh1, cortex_exc1,
            self.parameters.inh1.Inh1Exc1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Inh1Exc2Connection', cortex_inh1, cortex_exc2,
            self.parameters.inh1.Inh1Exc2Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Inh1Inh1Connection', cortex_inh1, cortex_inh1,
            self.parameters.inh1.Inh1Inh1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Inh1Inh2Connection', cortex_inh1, cortex_inh2,
            self.parameters.inh1.Inh1Inh2Connection).connect()

        UniformProbabilisticArborization(
            self, 'V1Inh2Exc1Connection', cortex_inh2, cortex_exc1,
            self.parameters.inh2.Inh2Exc1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Inh2Exc2Connection', cortex_inh2, cortex_exc2,
            self.parameters.inh2.Inh2Exc2Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Inh2Inh1Connection', cortex_inh2, cortex_inh1,
            self.parameters.inh2.Inh2Inh1Connection).connect()
        UniformProbabilisticArborization(
            self, 'V1Inh2Inh2Connection', cortex_inh2, cortex_inh2,
            self.parameters.inh2.Inh2Inh2Connection).connect()
Example #36
0
File: model.py Project: aopy/mozaik
    def __init__(self, sim, num_threads, parameters):
        Model.__init__(self, sim, num_threads, parameters)
        # Load components
        CortexExcL4 = load_component(
            self.parameters.sheets.l4_cortex_exc.component)
        CortexInhL4 = load_component(
            self.parameters.sheets.l4_cortex_inh.component)

        if not self.parameters.only_afferent and self.parameters.l23:
            CortexExcL23 = load_component(
                self.parameters.sheets.l23_cortex_exc.component)
            CortexInhL23 = load_component(
                self.parameters.sheets.l23_cortex_inh.component)

        RetinaLGN = load_component(self.parameters.sheets.retina_lgn.component)

        # Build and instrument the network
        self.visual_field = VisualRegion(
            location_x=self.parameters.visual_field.centre[0],
            location_y=self.parameters.visual_field.centre[1],
            size_x=self.parameters.visual_field.size[0],
            size_y=self.parameters.visual_field.size[1])

        self.input_layer = RetinaLGN(
            self, self.parameters.sheets.retina_lgn.params
        )  # 'pyNN.spiNNaker' has no attribute 'StepCurrentSource'

        cortex_exc_l4 = CortexExcL4(
            self, self.parameters.sheets.l4_cortex_exc.params
        )  # spiNNaker has no attribute EIF_cond_exp_isfa_ista ->Iz

        cortex_inh_l4 = CortexInhL4(
            self, self.parameters.sheets.l4_cortex_inh.params)

        if not self.parameters.only_afferent and self.parameters.l23:
            cortex_exc_l23 = CortexExcL23(
                self, self.parameters.sheets.l23_cortex_exc.params)
            cortex_inh_l23 = CortexInhL23(
                self, self.parameters.sheets.l23_cortex_inh.params)

        # initialize afferent layer 4 projections
        GaborConnector(self, self.input_layer.sheets['X_ON'],
                       self.input_layer.sheets['X_OFF'], cortex_exc_l4,
                       self.parameters.sheets.l4_cortex_exc.AfferentConnection,
                       'V1AffConnection')
        GaborConnector(self, self.input_layer.sheets['X_ON'],
                       self.input_layer.sheets['X_OFF'], cortex_inh_l4,
                       self.parameters.sheets.l4_cortex_inh.AfferentConnection,
                       'V1AffInhConnection')

        # initialize lateral layer 4 projections
        if not self.parameters.only_afferent:

            ModularSamplingProbabilisticConnectorAnnotationSamplesCount(
                self, 'V1L4ExcL4ExcConnection', cortex_exc_l4, cortex_exc_l4,
                self.parameters.sheets.l4_cortex_exc.L4ExcL4ExcConnection
            ).connect()
            ModularSamplingProbabilisticConnectorAnnotationSamplesCount(
                self, 'V1L4ExcL4InhConnection', cortex_exc_l4, cortex_inh_l4,
                self.parameters.sheets.l4_cortex_exc.L4ExcL4InhConnection
            ).connect()

            ModularSamplingProbabilisticConnector(
                self, 'V1L4InhL4ExcConnection', cortex_inh_l4, cortex_exc_l4,
                self.parameters.sheets.l4_cortex_inh.L4InhL4ExcConnection
            ).connect()
            ModularSamplingProbabilisticConnector(
                self, 'V1L4InhL4InhConnection', cortex_inh_l4, cortex_inh_l4,
                self.parameters.sheets.l4_cortex_inh.L4InhL4InhConnection
            ).connect()

            if self.parameters.l23:
                # if False:
                # initialize afferent layer 4 to layer 2/3 projection
                ModularSamplingProbabilisticConnector(
                    self, 'V1L4ExcL23ExcConnection', cortex_exc_l4,
                    cortex_exc_l23, self.parameters.sheets.l23_cortex_exc.
                    L4ExcL23ExcConnection).connect()
                ModularSamplingProbabilisticConnector(
                    self, 'V1L4ExcL23InhConnection', cortex_exc_l4,
                    cortex_inh_l23, self.parameters.sheets.l23_cortex_inh.
                    L4ExcL23InhConnection).connect()

                ModularSamplingProbabilisticConnector(
                    self, 'V1L23ExcL23ExcConnection', cortex_exc_l23,
                    cortex_exc_l23, self.parameters.sheets.l23_cortex_exc.
                    L23ExcL23ExcConnection).connect()
                ModularSamplingProbabilisticConnector(
                    self, 'V1L23ExcL23InhConnection', cortex_exc_l23,
                    cortex_inh_l23, self.parameters.sheets.l23_cortex_exc.
                    L23ExcL23InhConnection).connect()
                ModularSamplingProbabilisticConnector(
                    self, 'V1L23InhL23ExcConnection', cortex_inh_l23,
                    cortex_exc_l23, self.parameters.sheets.l23_cortex_inh.
                    L23InhL23ExcConnection).connect()
                ModularSamplingProbabilisticConnector(
                    self, 'V1L23InhL23InhConnection', cortex_inh_l23,
                    cortex_inh_l23, self.parameters.sheets.l23_cortex_inh.
                    L23InhL23InhConnection).connect()
                if self.parameters.feedback:
                    ModularSamplingProbabilisticConnector(
                        self, 'V1L23ExcL4ExcConnection', cortex_exc_l23,
                        cortex_exc_l4, self.parameters.sheets.l23_cortex_exc.
                        L23ExcL4ExcConnection).connect()
                    ModularSamplingProbabilisticConnector(
                        self, 'V1L23ExcL4InhConnection', cortex_exc_l23,
                        cortex_inh_l4, self.parameters.sheets.l23_cortex_exc.
                        L23ExcL4InhConnection).connect()