Esempio n. 1
0
    def __init__(self,
                 size,
                 cellclass,
                 cellparams,
                 structure=None,
                 label=None):
        """
        Instantiates a :py:object:`Population`.
        """
        global controller, multi_cast_vertex

        # Raise an exception if the Pop. attempts to employ spatial structure
        if structure:
            raise Exception(
                "Spatial structure is unsupported for Populations.")

        # Create a graph vertex for the population and add it to PACMAN
        self.vertex = cellclass(size, label=label, **cellparams)

        #check if the vertex is a cmd sender, if so store for future
        if self.vertex.requires_multi_cast_source():
            if multi_cast_vertex is None:
                multi_cast_vertex = MultiCastSource()
                controller.add_vertex(multi_cast_vertex)
            edge = graph.Edge(multi_cast_vertex, self.vertex)
            controller.add_edge(edge)

        self.parameters = PyNNParametersSurrogate(self.vertex)
        controller.add_vertex(self.vertex)

        #add any dependant edges and verts if needed
        dependant_verts, dependant_edges = \
            self.vertex.get_dependant_vertexes_edges()

        if dependant_verts is not None:
            for dependant_vert in dependant_verts:
                controller.add_vertex(dependant_vert)

        if dependant_edges is not None:
            for dependant_edge in dependant_edges:
                controller.add_edge(dependant_edge)

        #initlise common stuff
        self.size = size
        self.recordSpikeFile = None
        self.recordVFile = None
        self.recordGSynFile = None