Exemple #1
0
    def __init__(self,  morphology=None, area=None, segmenter=None, initial_voltage=None, cell_tags=None, cell_type=None, **kwargs):

        if area is not None:
            assert morphology is None
            morphology = MorphologyBuilder.get_single_section_soma(area=area)

        if cell_tags == None:
            cell_tags = []

        from morphforge.simulation.base.segmentation.cellsegmenter import CellSegmenter_MaxCompartmentLength
        super(Cell, self).__init__(**kwargs)

        self.morphology = morphology
        self._cell_type = cell_type

        self.cell_segmenter = (segmenter if segmenter else CellSegmenter_MaxCompartmentLength())
        self.cell_segmenter.connect_to_cell(self)

        self.biophysics = CellBiophysics(self)

        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]

        self.population = None
Exemple #2
0
    def __init__(self,  morphology=None, area=None, segmenter=None, initial_voltage=None, cell_tags=None, cell_type=None, **kwargs):

        if area is not None:
            assert morphology is None
            morphology = MorphologyBuilder.get_single_section_soma(area=area)

        if cell_tags == None:
            cell_tags = []

        from morphforge.simulation.base.segmentation.cellsegmenter import CellSegmenter_MaxCompartmentLength
        super(Cell, self).__init__(**kwargs)

        self.morphology = morphology
        self._cell_type = cell_type

        self.cell_segmenter = (segmenter if segmenter else CellSegmenter_MaxCompartmentLength())
        #self.cell_segmenter.connect_to_cell(self)

        self.biophysics = CellBiophysics(self)

        self.initial_voltage = initial_voltage or qty('-51:mV')

        self.cell_tags = cell_tags

        if self.name:
            self.cell_tags = self.cell_tags + [self.name]

        self.population = None
Exemple #3
0
class Cell(NamedSimulationObject):

    class Recordables(object):

        MembraneVoltage = StandardTags.Voltage

    @property
    def cell_type(self):
        return self._cell_type

    @property
    def cell_type_str(self):
        return (self._cell_type if self._cell_type else '<?>')


    def __init__(self,  morphology=None, area=None, segmenter=None, initial_voltage=None, cell_tags=None, cell_type=None, **kwargs):

        if area is not None:
            assert morphology is None
            morphology = MorphologyBuilder.get_single_section_soma(area=area)

        if cell_tags == None:
            cell_tags = []

        from morphforge.simulation.base.segmentation.cellsegmenter import CellSegmenter_MaxCompartmentLength
        super(Cell, self).__init__(**kwargs)

        self.morphology = morphology
        self._cell_type = cell_type

        self.cell_segmenter = (segmenter if segmenter else CellSegmenter_MaxCompartmentLength())
        #self.cell_segmenter.connect_to_cell(self)

        self.biophysics = CellBiophysics(self)

        self.initial_voltage = initial_voltage or qty('-51:mV')

        self.cell_tags = cell_tags

        if self.name:
            self.cell_tags = self.cell_tags + [self.name]

        self.population = None


    @property
    def index_in_pop(self):
        assert self.population is not None
        return self.population.index(self)

    def get_location(self, idtag, sectionpos=0.5):
        return CellLocation(cell=self,
                            section=self.morphology.get_section(idtag=idtag),
                            sectionpos=sectionpos)

    def get_region(self, region_name):
        return self.morphology.get_region(region_name)

    def get_regions(self):
        return self.morphology.get_regions()

    def get_biophysics(self):
        return self.biophysics

    def get_segmenter(self):
        return self.cell_segmenter

    # Make the object a bit more pythonic:
    @property
    def segmenter(self):
        return self.cell_segmenter

    @property
    def presynaptic_connections(self):
        return [synapse for synapse in self.simulation.synapses
                if synapse.get_presynaptic_cell() == self]

    @property
    def postsynaptic_connections(self):
        return [synapse for synapse in self.simulation.synapses
                if synapse.get_postsynaptic_cell() == self]

    @property
    def electrical_connections(self):
        return [gap_junction for gap_junction in self.simulation.gapjunctions if self
                in gap_junction.connected_cells]


    # Commonly used helper methods:
    @property
    def soma(self):
        return self.get_location('soma')

    @property 
    def is_single_compartment(self):
        return len( self.morphology ) == 1 and \
               self.segmenter.get_num_segments(self.soma.section) == 1


    # Simple forwarding method to biophysics, (syntactic sugar)
    def apply_channel(self, *args, **kwargs) :
        self.biophysics.apply_channel(*args, **kwargs)

    def set_passive(self, *args, **kwargs) :
        self.biophysics.set_passive(*args, **kwargs)
Exemple #4
0
class Cell(NamedSimulationObject):

    class Recordables(object):

        MembraneVoltage = StandardTags.Voltage

    @property
    def cell_type(self):
        return self._cell_type

    @property
    def cell_type_str(self):
        return (self._cell_type if self._cell_type else '<?>')


    def __init__(self,  morphology=None, area=None, segmenter=None, initial_voltage=None, cell_tags=None, cell_type=None, **kwargs):

        if area is not None:
            assert morphology is None
            morphology = MorphologyBuilder.get_single_section_soma(area=area)

        if cell_tags == None:
            cell_tags = []

        from morphforge.simulation.base.segmentation.cellsegmenter import CellSegmenter_MaxCompartmentLength
        super(Cell, self).__init__(**kwargs)

        self.morphology = morphology
        self._cell_type = cell_type

        self.cell_segmenter = (segmenter if segmenter else CellSegmenter_MaxCompartmentLength())
        self.cell_segmenter.connect_to_cell(self)

        self.biophysics = CellBiophysics(self)

        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]

        self.population = None


    @property
    def index_in_pop(self):
        assert self.population is not None
        return self.population.index(self)

    def get_location(self, idtag, sectionpos=0.5):
        return CellLocation(cell=self,
                            section=self.morphology.get_section(idtag=idtag),
                            sectionpos=sectionpos)

    def get_region(self, region_name):
        return self.morphology.get_region(region_name)

    def get_regions(self):
        return self.morphology.get_regions()

    def get_biophysics(self):
        return self.biophysics

    def get_segmenter(self):
        return self.cell_segmenter

    # Make the object a bit more pythonic:
    @property
    def segmenter(self):
        return self.cell_segmenter

    @property
    def presynaptic_connections(self):
        return [synapse for synapse in self.simulation.synapses
                if synapse.get_presynaptic_cell() == self]

    @property
    def postsynaptic_connections(self):
        return [synapse for synapse in self.simulation.synapses
                if synapse.get_postsynaptic_cell() == self]

    @property
    def electrical_connections(self):
        return [gap_junction for gap_junction in self.simulation.gapjunctions if self
                in gap_junction.connected_cells]


    # Commonly used helper methods:
    @property
    def soma(self):
        return self.get_location('soma')

    @property 
    def is_single_compartment(self):
        return len( self.morphology ) == 1 and \
               self.segmenter.get_num_segments(self.soma.section) == 1


    # Simple forwarding method to biophysics, (syntactic sugar)
    def apply_channel(self, *args, **kwargs) :
        self.biophysics.apply_channel(*args, **kwargs)

    def set_passive(self, *args, **kwargs) :
        self.biophysics.set_passive(*args, **kwargs)