diff --git a/doc/concepts/morphology.rst b/doc/concepts/morphology.rst index 13ffcd4bc1..3c2fb57cbc 100644 --- a/doc/concepts/morphology.rst +++ b/doc/concepts/morphology.rst @@ -693,6 +693,8 @@ and *B*, while *A* | *B* is a policy which gives all the boundary points from The domain of *A* + *B* and *A* | *B* is the union of the domains of *A* and *B*. +.. _morph-cv-sexpr: + Reading CV policies from strings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/python/decor.rst b/doc/python/decor.rst index 33338141bd..6eb79d2414 100644 --- a/doc/python/decor.rst +++ b/doc/python/decor.rst @@ -167,3 +167,9 @@ Cable cell decoration :param policy: The cv_policy. :type policy: :py:class:`cv_policy` + + .. method:: discretization(policy) + + Set the cv_policy used to discretise the cell into control volumes for simulation. + + :param str policy: :ref:`string representation ` of a cv_policy. \ No newline at end of file diff --git a/python/cells.cpp b/python/cells.cpp index da9060d0e9..90932f3811 100644 --- a/python/cells.cpp +++ b/python/cells.cpp @@ -691,7 +691,13 @@ void register_cells(pybind11::module& m) { "The group of spike detectors has the label 'label', used for forming connections between cells.") .def("discretization", [](arb::decor& dec, const arb::cv_policy& p) { dec.set_default(p); }, - pybind11::arg_v("policy", "A cv_policy used to discretise the cell into compartments for simulation")); + pybind11::arg_v("policy", "A cv_policy used to discretise the cell into compartments for simulation")) + .def("discretization", + [](arb::decor& dec, const std::string& p) { + dec.set_default(arborio::parse_cv_policy_expression(p).unwrap()); + }, + pybind11::arg_v("policy", "An s-expression string representing a cv_policy used to discretise the " + "cell into compartments for simulation")); // arb::cable_cell