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

Add introspection for global properties. #1890

Merged
merged 1 commit into from
May 18, 2022
Merged
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
27 changes: 25 additions & 2 deletions python/cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,11 @@ void register_cells(pybind11::module& m) {
return util::pprintf("(threshold_detector {})", d.threshold);});

// arb::cable_cell_global_properties
pybind11::class_<arb::cable_cell_ion_data> ion_data(m, "ion_data");
ion_data
.def_readonly("internal_concentration", &arb::cable_cell_ion_data::init_int_concentration, "Internal concentration.")
.def_readonly("external_concentration", &arb::cable_cell_ion_data::init_ext_concentration, "External concentration.")
.def_readonly("reversal_concentration", &arb::cable_cell_ion_data::init_reversal_potential, "Reversal potential.");

pybind11::class_<arb::cable_cell_global_properties> gprop(m, "cable_global_properties");
gprop
Expand All @@ -506,6 +511,24 @@ void register_cells(pybind11::module& m) {
arb::check_global_properties(props);},
"Test whether all default parameters and ion species properties have been set.")
// set cable properties
.def_property("membrane_potential",
[](const arb::cable_cell_global_properties& props) { return props.default_parameters.init_membrane_potential; },
[](arb::cable_cell_global_properties& props, double u) { props.default_parameters.init_membrane_potential = u; })
.def_property("membrane_capacitance",
[](const arb::cable_cell_global_properties& props) { return props.default_parameters.membrane_capacitance; },
[](arb::cable_cell_global_properties& props, double u) { props.default_parameters.membrane_capacitance = u; })
.def_property("temperature",
[](const arb::cable_cell_global_properties& props) { return props.default_parameters.temperature_K; },
[](arb::cable_cell_global_properties& props, double u) { props.default_parameters.temperature_K = u; })
.def_property("axial_resisitivity",
[](const arb::cable_cell_global_properties& props) { return props.default_parameters.axial_resistivity; },
[](arb::cable_cell_global_properties& props, double u) { props.default_parameters.axial_resistivity = u; })
.def_property_readonly("ion_data",
[](const arb::cable_cell_global_properties& props) { return props.default_parameters.ion_data; })
.def_property_readonly("ion_valence",
[](const arb::cable_cell_global_properties& props) { return props.ion_species; })
.def_property_readonly("ion_reversal_potential",
[](const arb::cable_cell_global_properties& props) { return props.default_parameters.reversal_potential_method; })
.def("set_property",
[](arb::cable_cell_global_properties& props,
optional<double> Vm, optional<double> cm,
Expand Down Expand Up @@ -534,8 +557,8 @@ void register_cells(pybind11::module& m) {
if (valence) props.ion_species[ion] = *valence;

auto& data = props.default_parameters.ion_data[ion];
if (int_con) data.init_int_concentration = *int_con;
if (ext_con) data.init_ext_concentration = *ext_con;
if (int_con) data.init_int_concentration = *int_con;
if (ext_con) data.init_ext_concentration = *ext_con;
if (rev_pot) data.init_reversal_potential = *rev_pot;

if (auto m = maybe_method(method)) {
Expand Down