Ejemplo n.º 1
0
    def cell_description(self, gid):
        """A high level description of the cell with global identifier gid.

        For example the morphology, synapses and ion channels required
        to build a multi-compartment neuron.
        """
        assert gid == 0

        tree = arbor.segment_tree()

        tree.append(arbor.mnpos,
                    arbor.mpoint(0, 0, 0, self.radius),
                    arbor.mpoint(self.length, 0, 0, self.radius),
                    tag=1)

        labels = arbor.label_dict({'cable': '(tag 1)',
                                   'start': '(location 0 0)'})

        decor = arbor.decor()
        decor.set_property(Vm=self.Vm)
        decor.set_property(cm=self.cm)
        decor.set_property(rL=self.rL)

        decor.paint('"cable"',
                    arbor.density(f'pas/e={self.Vm}', {'g': self.g}))

        decor.place('"start"', arbor.iclamp(self.stimulus_start, self.stimulus_duration, self.stimulus_amplitude), "iclamp")

        policy = arbor.cv_policy_max_extent(self.cv_policy_max_extent)
        decor.discretization(policy)

        return arbor.cable_cell(tree, labels, decor)
Ejemplo n.º 2
0
    def cable_cell_template(cls, morphology=0, decor=None, labels=None):
        import arbor

        if not isinstance(cls.morphologies[morphology], str):
            raise NotImplementedError(
                "Can't use builders for cable cells, must import from file. Please export your morphology builder to an SWC or ASC file and update `cls.morphologies`."
            )
        if labels is None:
            labels = arbor.label_dict()
        if decor is None:
            decor = arbor.decor()
        path = os.path.join(cls.morphology_directory,
                            cls.morphologies[morphology])
        morph, morpho_labels = _try_arb_morpho(path)
        labels.update(morpho_labels)
        cls._cc_insert_labels(labels, getattr(cls, "labels", {}),
                              getattr(cls, "tags", {}))
        composites = _arb_resolve_composites(cls.section_types, labels)

        dflt_policy = arbor.cv_policy_max_extent(40.0)
        soma_policy = arbor.cv_policy_fixed_per_branch(1, "(tag 1)")
        policy = dflt_policy | soma_policy
        decor.discretization(policy)

        for label, definition in composites.items():
            cls._cc_all(decor, label, definition)
        return morph, labels, decor
Ejemplo n.º 3
0
    def cell_description(self, gid):
        """A high level description of the cell with global identifier gid.

        For example the morphology, synapses and ion channels required
        to build a multi-compartment neuron.
        """
        assert gid in [0, 1]

        tree = arbor.segment_tree()

        tree.append(arbor.mnpos,
                    arbor.mpoint(0, 0, 0, self.radius),
                    arbor.mpoint(self.length, 0, 0, self.radius),
                    tag=1)

        labels = arbor.label_dict({
            'cell': '(tag 1)',
            'gj_site': '(location 0 0.5)'
        })

        decor = arbor.decor()
        decor.set_property(Vm=self.Vms[gid])
        decor.set_property(cm=self.cm)
        decor.set_property(rL=self.rL)

        # add a gap junction mechanism at the "gj_site" location and label that specific mechanism on that location "gj_label"
        junction_mech = arbor.junction('gj', {"g": self.gj_g})
        decor.place('"gj_site"', junction_mech, 'gj_label')
        decor.paint('"cell"',
                    arbor.density(f'pas/e={self.Vms[gid]}', {'g': self.g}))

        if self.cv_policy_max_extent is not None:
            policy = arbor.cv_policy_max_extent(self.cv_policy_max_extent)
            decor.discretization(policy)
        else:
            decor.discretization(arbor.cv_policy_single())

        return arbor.cable_cell(tree, labels, decor)
decor.paint('"all"', 'pas')
decor.paint('"custom"', 'hh')
decor.paint('"dend"', mech('Ih', {'gbar': 0.001}))

# Place stimuli and spike detectors.

decor.place('"root"', arbor.iclamp(10, 1, current=2), "iclamp0")
decor.place('"root"', arbor.iclamp(30, 1, current=2), "iclamp1")
decor.place('"root"', arbor.iclamp(50, 1, current=2), "iclamp2")
decor.place('"axon_terminal"', arbor.spike_detector(-10), "detector")

# Set cv_policy

soma_policy = arbor.cv_policy_single('"soma"')
dflt_policy = arbor.cv_policy_max_extent(1.0)
policy = dflt_policy | soma_policy
decor.discretization(policy)

# Create a cell

cell = arbor.cable_cell(morph, labels, decor)

# (2) Declare a probe.

probe = arbor.cable_probe_membrane_voltage('"custom_terminal"')

# (3) Create a recipe class and instantiate a recipe


class single_recipe(arbor.recipe):