Ejemplo n.º 1
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()
Ejemplo n.º 2
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()
Ejemplo n.º 3
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()
Ejemplo n.º 4
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()
Ejemplo n.º 5
0
Archivo: model.py Proyecto: 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()
Ejemplo n.º 6
0
    def __init__(self, network, lgn_on, lgn_off, target, parameters, name):
        from numpy import random
        random.seed(1023)
        BaseComponent.__init__(self, network, parameters)
        self.name = name

        t_size = target.size_in_degrees()
        or_map = None
        if self.parameters.or_map:
            f = open(self.parameters.or_map_location, 'r')
            or_map = pickle.load(f)*numpy.pi
            coords_x = numpy.linspace(-t_size[0]/2.0,
                                      t_size[0]/2.0,
                                      numpy.shape(or_map)[0])
            coords_y = numpy.linspace(-t_size[1]/2.0,
                                      t_size[1]/2.0,
                                      numpy.shape(or_map)[1])
            X, Y = numpy.meshgrid(coords_x, coords_y)
            or_map = NearestNDInterpolator(zip(X.flatten(), Y.flatten()),
                                           or_map.flatten())

        phase_map = None
        if self.parameters.phase_map:
            f = open(self.parameters.phase_map_location, 'r')
            phase_map = pickle.load(f)
            coords_x = numpy.linspace(-t_size[0]/2.0,
                                      t_size[0]/2.0,
                                      numpy.shape(phase_map)[0])
            coords_y = numpy.linspace(-t_size[1]/2.0,
                                      t_size[1]/2.0,
                                      numpy.shape(phase_map)[1])
            X, Y = numpy.meshgrid(coords_x, coords_y)
            phase_map = NearestNDInterpolator(zip(X.flatten(), Y.flatten()),
                                              phase_map.flatten())

        for (j, neuron2) in enumerate(target.pop.all()):
            if or_map:
                orientation = or_map(target.pop.positions[0][j],
                                     target.pop.positions[1][j])
            else:
                orientation = parameters.orientation_preference.next()[0]

            if phase_map:
                phase = phase_map(target.pop.positions[0][j],
                                  target.pop.positions[1][j])
            else:
                phase = parameters.phase.next()[0]

            aspect_ratio = parameters.aspect_ratio.next()[0]
            frequency = parameters.frequency.next()[0]
            size = parameters.size.next()[0]

            assert orientation < numpy.pi

            target.add_neuron_annotation(j, 'LGNAfferentOrientation', orientation, protected=True)
            target.add_neuron_annotation(j, 'LGNAfferentAspectRatio', aspect_ratio, protected=True)
            target.add_neuron_annotation(j, 'LGNAfferentFrequency', frequency, protected=True)
            target.add_neuron_annotation(j, 'LGNAfferentSize', size, protected=True)
            target.add_neuron_annotation(j, 'LGNAfferentPhase', phase, protected=True)
            
            if self.parameters.topological:
                target.add_neuron_annotation(j, 'LGNAfferentX', target.pop.positions[0][j], protected=True)
                target.add_neuron_annotation(j, 'LGNAfferentY', target.pop.positions[1][j], protected=True)
            else:
                target.add_neuron_annotation(j, 'LGNAfferentX', 0, protected=True)
                target.add_neuron_annotation(j, 'LGNAfferentY', 0, protected=True)
                

        ps = ParameterSet({   'target_synapses' : 'excitatory',               
                              'weight_functions' : {  'f1' : {
                                                                 'component' : 'mozaik.connectors.vision.GaborArborization',
                                                                 'params' : {
                                                                                'ON' : True,
                                                                            }
                                                             }                                                                              
                                                   },
                             'delay_functions' : {},
                             'weight_expression' : 'f1', # a python expression that can use variables f1..fn where n is the number of functions in weight_functions, and fi corresponds to the name given to a ModularConnectorFunction in weight_function ParameterSet. It determines how are the weight functions combined to obtain the weights
                             'delay_expression' : str(self.parameters.delay),
                             'short_term_plasticity' : self.parameters.short_term_plasticity,
                             'base_weight' : self.parameters.base_weight,
                             'num_samples' : self.parameters.num_samples,
                          })
        ModularSamplingProbabilisticConnector(network,name+'On',lgn_on,target,ps).connect()
        ps['weight_functions.f1.params.ON']=False
        ModularSamplingProbabilisticConnector(network,name+'Off',lgn_off,target,ps).connect()