Expose diverse probes in Python API. (#1225)
Major changes in Python library and documentation: * Add global state (immutable after initialization) for the Python module that manages the mapping between probe metadata types and the method by which the corresponding [sample data can be collected and presented as Python objects. This is necessary for decoupling the implementation of the simulation wrapper from that of the various cable cell probe types. * Wrap each of the C++ cable cell probe types with a Python function that returns a `probe_info` object. * Add code for converting and accumulating C++ probe metadata and sample data, registered in the module global state against the metadata type info. * Make the `arbor.simulator` object responsible for recording all spike and sample data, with corresponding new methods. * Use NumPy arrays and structured datatypes for returning spike and sample data. * Place Python schedule proxies under an abstract interface so that consumers of the proxies can be made generic over schedule types. * Add unit tests for the `arbor.simulator` class and its new functionality, including distributed spike collection. * Rework all Python API documentation concerning probes, sampling, and spike recording; add information on newly exposed cable cell probe addresses. * Add new python example `single_cell_recipe.py` which is a generic recipe version of `single_cell_model.py`. * Adjust other code in the wrapper and examples to accommodate these changes. Minor changes in Python library: * Add equality tests for `arbor.location` and `arbor.cable` Python classes. * Use the `py::` namespace shorthand more often in the Python wrapping sources. * Add an implicit conversion for a pair of numbers to `arbor.cell_member`, so that e.g. probe ids can be specified simply as `(gid, index)`. * Add an implicit conversion from a tuple to `arbor.mpoint` so that a morphological point can be specified simply as `(x, y, z, radius)`. * Modify the interface to `arbor.regular_schedule` so that the overloads correspond more closely to the C++ API. In particular, `arbor.regular_schedule(dt)` now describes a schedule with times 0, dt, 2*dt, etc. Minor changes in C++ library: * Change test in FVM lowered cell implementation and exception message for `bad_source_description`: assert number of detectors is exactly the number of sources promised by the recipe. * Add comment describing `probe_metadata` object in `sampling.hpp` which asserts that the type and value of probe-specific metadata completely determines the correct interpretation of sampled data provided to a callback.
Showing
- arbor/arbexcept.cpp 1 addition, 1 deletionarbor/arbexcept.cpp
- arbor/fvm_lowered_cell_impl.hpp 1 addition, 1 deletionarbor/fvm_lowered_cell_impl.hpp
- arbor/include/arbor/cable_cell.hpp 1 addition, 1 deletionarbor/include/arbor/cable_cell.hpp
- arbor/include/arbor/sampling.hpp 6 additions, 0 deletionsarbor/include/arbor/sampling.hpp
- doc/cpp/cable_cell.rst 2 additions, 0 deletionsdoc/cpp/cable_cell.rst
- doc/python/cable_cell.rst 150 additions, 0 deletionsdoc/python/cable_cell.rst
- doc/python/recipe.rst 9 additions, 28 deletionsdoc/python/recipe.rst
- doc/python/simulation.rst 188 additions, 105 deletionsdoc/python/simulation.rst
- python/CMakeLists.txt 1 addition, 1 deletionpython/CMakeLists.txt
- python/cable_probes.cpp 294 additions, 0 deletionspython/cable_probes.cpp
- python/cells.cpp 1 addition, 1 deletionpython/cells.cpp
- python/event_generator.cpp 3 additions, 28 deletionspython/event_generator.cpp
- python/example/network_ring.py 7 additions, 9 deletionspython/example/network_ring.py
- python/example/single_cell_multi_branch.py 1 addition, 1 deletionpython/example/single_cell_multi_branch.py
- python/example/single_cell_recipe.py 82 additions, 0 deletionspython/example/single_cell_recipe.py
- python/example/single_cell_swc.py 1 addition, 1 deletionpython/example/single_cell_swc.py
- python/identifiers.cpp 18 additions, 8 deletionspython/identifiers.cpp
- python/morphology.cpp 25 additions, 13 deletionspython/morphology.cpp
- python/pyarb.cpp 17 additions, 5 deletionspython/pyarb.cpp
- python/pyarb.hpp 84 additions, 0 deletionspython/pyarb.hpp
Please register or sign in to comment