Ejemplo n.º 1
0
    def __init__(
        self,
        sim,
        synapses,
        synapse_pop_name=None,
        user_tags=None,
        ):

        # Some functions return lists of synapses; so we
        # reduce the input down to a flat list:
        self.synapses = []
        for s in synapses:
            if s is None:
                continue
            elif is_iterable(s):
                self.synapses.extend(s)
            else:
                print 'Not Iterable:', s
                self.synapses.append(s)

        for s in self.synapses:
            print s, type(s)
            assert s.population is None
            s.population = self

        self.sim = sim
        self.synapse_pop_name=synapse_pop_name if synapse_pop_name is not None else ObjectLabeller.get_next_unamed_object_name(SynapsePopulation, prefix="SynPop")

        user_tags = user_tags or []
Ejemplo n.º 2
0
    def __init__(self, sim, neuron_functor, n, pop_name=None, name_tmpl_str=None, user_tags=None):

        user_tags = user_tags or []
        if pop_name:
            user_tags.extend(pop_name.split("_"))

        if pop_name is None:
            pop_name = ObjectLabeller.get_next_unamed_object_name(
                NeuronPopulation, prefix="NrnPop", num_fmt_string="%d"
            )

        self.pop_name = pop_name

        if name_tmpl_str is None:
            name_tmpl_str = "%s_$i" % self.pop_name

        name_tmpl = string.Template(name_tmpl_str)
        self.sim = sim

        # Create the neurons:
        self._nrns = []
        for i in range(n):
            cell_name = name_tmpl.substitute({"i": i})

            cell_tags = user_tags + ["Index%d" % i]
            n = neuron_functor(sim=sim, name=cell_name, cell_tags=cell_tags)
            n.population = self
            self._nrns.append(n)

        self._cell_to_index_lut = self._build_cell_to_index_lut()
Ejemplo n.º 3
0
 def __init__(self, region_number_to_name_bidict=None, name=None, metadata=None):
     self.region_number_to_name_bidict = region_number_to_name_bidict
     
     self._name = name or ObjectLabeller.getNextUnamedObjectName(MorphologyBase) 
     CheckValidName(self._name)
     
     self.metadata = metadata if metadata else {}
Ejemplo n.º 4
0
    def __init__(self, region_number_to_name_bidict=None, name=None,
                 metadata=None):
        self.region_number_to_name_bidict = region_number_to_name_bidict

        self._name = name or ObjectLabeller.get_next_unamed_object_name(MorphologyBase)
        check_cstyle_varname(self._name)

        self.metadata = (metadata if metadata else {})
Ejemplo n.º 5
0
    def __init__(self,
                 region_number_to_name_bidict=None,
                 name=None,
                 metadata=None):
        self.region_number_to_name_bidict = region_number_to_name_bidict

        self._name = name or ObjectLabeller.get_next_unamed_object_name(
            MorphologyBase)
        check_cstyle_varname(self._name)

        self.metadata = (metadata if metadata else {})
Ejemplo n.º 6
0
    def __init__(
        self,
        sim,
        neuron_functor,
        n,
        pop_name=None,
        name_tmpl_str=None,
        user_tags=None,
        ):

        user_tags = user_tags or []
        if pop_name:
            user_tags.extend(pop_name.split('_'))
        
        if pop_name is None:
            pop_name = ObjectLabeller.get_next_unamed_object_name(NeuronPopulation, prefix='NrnPop', num_fmt_string='%d')
        
        self.pop_name = pop_name

        if name_tmpl_str is None:
            name_tmpl_str = '%s_$i' % self.pop_name

        name_tmpl = string.Template(name_tmpl_str)
        self.sim = sim

        # Create the neurons:
        self._nrns = []
        for i in range(n):
            cell_name = name_tmpl.substitute({'i': i})

            # print cell_name
            # assert False

            cell_tags = user_tags + ['Index%d' % i]
            n = neuron_functor(sim=sim, name=cell_name,
                               cell_tags=cell_tags)
            n.population = self
            self._nrns.append(n)


        self._cell_to_index_lut = self._build_cell_to_index_lut()
Ejemplo n.º 7
0
 def __init__(self, simulationresult, filename=None, keyTraceSets = [], make_graphs=True ):
     
     if not filename:
         filename = ObjectLabeller.getNextUnamedObjectName(SimulationSummariser, prefix='SimulationSummary') + '.pdf'
         
     
     self.simulationresult = simulationresult
     self.simulation = simulationresult.simulation
     
     
     self.make_graphs= make_graphs
     
     self.elements = defaultdict(list)
     
     self.keyTraceSets = keyTraceSets
     
     self.reportlabconfig = ReportLabConfig()
         
     
     # Do the Summarising:
     self.summarise(filename)
Ejemplo n.º 8
0
    def __init__(
        self,
        sim,
        neuron_functor,
        n,
        pop_name=None,
        name_tmpl_str=None,
        user_tags=None,
    ):

        user_tags = user_tags or []
        if pop_name:
            user_tags.extend(pop_name.split('_'))

        if pop_name is None:
            pop_name = ObjectLabeller.get_next_unamed_object_name(
                NeuronPopulation, prefix='NrnPop', num_fmt_string='%d')

        self.pop_name = pop_name

        if name_tmpl_str is None:
            name_tmpl_str = '%s_$i' % self.pop_name

        name_tmpl = string.Template(name_tmpl_str)
        self.sim = sim

        # Create the neurons:
        self._nrns = []
        for i in range(n):
            cell_name = name_tmpl.substitute({'i': i})

            # print cell_name
            # assert False

            cell_tags = user_tags + ['Index%d' % i]
            n = neuron_functor(sim=sim, name=cell_name, cell_tags=cell_tags)
            n.population = self
            self._nrns.append(n)

        self._cell_to_index_lut = self._build_cell_to_index_lut()
Ejemplo n.º 9
0
    def __init__(self,    morphology, simulation, name= None, segmenter=None, initial_voltage=None, cell_tags = [], **kwargs):
        from morphforge.simulation.core.segmentation.cellsegmenter import DefaultCellSegementer
        
        
        

        self.simulation = simulation
        self.name = name if name else ObjectLabeller.getNextUnamedObjectName(Cell, 'AnonCell_')
        self.morphology = morphology 
        
        self.cellSegmenter = segmenter if segmenter else DefaultCellSegementer()
        self.cellSegmenter.connectToCell(self)
        
        
        self.biophysics = CellBiophysics()
    
        self.initial_voltage = initial_voltage or unit("-51:mV")
        
        
        self.cell_tags = cell_tags 
        
        if self.name:
            self.cell_tags = self.cell_tags +  [self.name]
Ejemplo n.º 10
0
    def __init__(
        self,
        sim,
        synapses,
        synapse_pop_name=None,
        user_tags=None,
    ):

        # Some functions return lists of synapses; so we
        # reduce the input down to a flat list:
        self.synapses = []
        for s in synapses:
            if s is None:
                continue
            elif is_iterable(s):
                self.synapses.extend(s)
            else:
                print 'Not Iterable:', s
                self.synapses.append(s)

        for s in self.synapses:
            print s, type(s)
            assert s.population is None
            s.population = self

        self.sim = sim
        self.synapse_pop_name = synapse_pop_name if synapse_pop_name is not None else ObjectLabeller.get_next_unamed_object_name(
            SynapsePopulation, prefix="SynPop")

        user_tags = user_tags or []
Ejemplo n.º 11
0
 def __init__(self, name=None, description=None, user_tags=None, **kwargs):
     
     self.name = name if name else ObjectLabeller.getNextUnamedObjectName(objType=Recordable, prefix="AnonRec") 
     self.user_tags = user_tags if user_tags else []
     self._description = description