Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the use of string s-expression CV-policies in pyarb #1799

Merged
merged 2 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/concepts/morphology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
6 changes: 6 additions & 0 deletions doc/python/decor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <morph-cv-sexpr>` of a cv_policy.
8 changes: 7 additions & 1 deletion python/cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down