Beispiel #1
0
class CellLocation(object):
    def __init__(self,
                 cell,
                 morphlocation=None,
                 section=None,
                 sectionpos=None):
        self._cell = cell

        if morphlocation:
            assert not section and not sectionpos
            self.morphlocation = morphlocation
        else:
            assert not morphlocation
            self.morphlocation = MorphLocation(section=section,
                                               sectionpos=sectionpos)

        assert not self.morphlocation.section.is_dummy_section()

    def get_cell(self):
        return self._cell

    cell = property(get_cell, None, None)

    # We want to be able to treat CellLocations as locations,
    # so that we can measure between them for example:

    @property
    def section(self):
        return self.morphlocation.section

    @property
    def sectionpos(self):
        return self.morphlocation.sectionpos

    def get_3d_position(self):
        return self.morphlocation.get_3d_position()

    def get_location_description_str(self):
        desc = self.cell.name
        t = ''
        if self.morphlocation.section.idtag:
            t = self.morphlocation.section.idtag
        return desc + t
class CellLocation(object):

    def __init__(self, cell, morphlocation=None, section=None, sectionpos=None):
        self._cell = cell

        if morphlocation:
            assert not section and not sectionpos
            self.morphlocation = morphlocation
        else:
            assert not morphlocation
            self.morphlocation = MorphLocation(section=section,
                                               sectionpos=sectionpos)

        assert not self.morphlocation.section.is_dummy_section()

    def get_cell(self):
        return self._cell

    cell = property(get_cell, None, None)

    # We want to be able to treat CellLocations as locations,
    # so that we can measure between them for example:

    @property
    def section(self):
        return self.morphlocation.section

    @property
    def sectionpos(self):
        return self.morphlocation.sectionpos

    def get_3d_position(self):
        return self.morphlocation.get_3d_position()

    def get_location_description_str(self):
        desc = self.cell.name
        t = ''
        if self.morphlocation.section.idtag:
            t = '@' + self.morphlocation.section.idtag
        return desc + t