diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 0f2921b72a..c9ee464569 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -20,11 +20,11 @@ jobs: sudo apt-get update sudo apt-get install -y ninja-build ccache - name: Set up cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.0 with: cmake-version: 3.22.x - name: Clone w/ submodules - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive # figure out vector extensions for ccache key diff --git a/.github/workflows/build-pip-wheels.yml b/.github/workflows/build-pip-wheels.yml index 9370c56a19..9a5f9d2439 100644 --- a/.github/workflows/build-pip-wheels.yml +++ b/.github/workflows/build-pip-wheels.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Get Arbor - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Create unique version in pyproject.toml @@ -38,7 +38,7 @@ jobs: steps: - name: Get Arbor - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Delete pyproject.toml @@ -69,7 +69,7 @@ jobs: - name: Get packages run: python3 -m pip install build - name: Get Arbor - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Delete pyproject.toml @@ -118,7 +118,7 @@ jobs: needs: [build_binary_wheels, build_sdist] steps: - name: "Clone w/ submodules" - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: "recursive" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 892bb704e8..8c9a2eaf0f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,13 +46,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -81,6 +81,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0cf9fd3bd8..518b0e9110 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,9 +11,9 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' - name: Get packages @@ -21,7 +21,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 - name: Clone w/ submodules - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Python Formatting diff --git a/.github/workflows/sanitize.yml b/.github/workflows/sanitize.yml index 8fd3c75772..bb17283317 100644 --- a/.github/workflows/sanitize.yml +++ b/.github/workflows/sanitize.yml @@ -33,11 +33,11 @@ jobs: sudo apt-get update sudo apt-get install -y ninja-build ccache - name: Set up cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.0 with: cmake-version: 3.19.x - name: Clone w/ submodules - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Update pip diff --git a/.github/workflows/test-docs.yaml b/.github/workflows/test-docs.yaml index d7cac2a8b2..3ef6683b6e 100644 --- a/.github/workflows/test-docs.yaml +++ b/.github/workflows/test-docs.yaml @@ -18,17 +18,17 @@ jobs: python-version: [3.8] steps: - name: Set up cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.0 with: cmake-version: ${{ matrix.config.cmake }} - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Update pip and setup venv run: python -m pip install --upgrade pip && python -m venv ~/env && . ~/env/bin/activate && echo "PATH=$PATH" >> $GITHUB_ENV - name: Clone w/ submodules - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Install Python packages diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index d1c4e8d0c6..8878809b06 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -105,11 +105,11 @@ jobs: run: | brew install openmpi ninja ccache - name: Set up cmake - uses: jwlawson/actions-setup-cmake@v1.13 + uses: jwlawson/actions-setup-cmake@v2.0.0 with: cmake-version: ${{ matrix.config.cmake }} - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.config.py }} - name: Update pip @@ -117,7 +117,7 @@ jobs: - name: Install Python packages run: pip install numpy sphinx svgwrite sphinx-rtd-theme mpi4py pandas seaborn - name: Clone w/ submodules - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive # figure out vector extensions for ccache key diff --git a/.github/workflows/test-pip.yml b/.github/workflows/test-pip.yml index df029593e9..e25928f827 100644 --- a/.github/workflows/test-pip.yml +++ b/.github/workflows/test-pip.yml @@ -17,11 +17,11 @@ jobs: os: [ubuntu-20.04] python-version: [3.8] steps: - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Clone w/ submodules - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive - name: Update pip and setup venv diff --git a/.github/workflows/test-spack.yml b/.github/workflows/test-spack.yml index b78a347580..44171e6216 100644 --- a/.github/workflows/test-spack.yml +++ b/.github/workflows/test-spack.yml @@ -32,7 +32,7 @@ jobs: sudo apt-get install -y gfortran libblas-dev - name: clone arbor - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: arbor submodules: recursive diff --git a/README.md b/README.md index 955b07554a..d0ed6aec72 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![gitpod](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/arbor-sim/arbor) [![docs](https://readthedocs.org/projects/arbor/badge/?version=latest)](https://docs.arbor-sim.org/en/latest/) [![gitter](https://badges.gitter.im/arbor-sim/community.svg)](https://gitter.im/arbor-sim/community) +[![CodeQL](https://github.com/arbor-sim/arbor/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/arbor-sim/arbor/actions/workflows/codeql.yml) # Arbor Library diff --git a/arbor/cable_cell_group.cpp b/arbor/cable_cell_group.cpp index 559f3e9ef8..efa27ea0e8 100644 --- a/arbor/cable_cell_group.cpp +++ b/arbor/cable_cell_group.cpp @@ -1,6 +1,3 @@ -#include -#include -#include #include #include @@ -18,8 +15,6 @@ #include "cable_cell_group.hpp" #include "profile/profiler_macro.hpp" #include "sampler_map.hpp" -#include "util/filter.hpp" -#include "util/maputil.hpp" #include "util/partition.hpp" #include "util/range.hpp" #include "util/span.hpp" @@ -215,9 +210,9 @@ void run_samples( fvm_probe_scratch& scratch) { const sample_size_type n_raw_per_sample = p.raw_handles.size(); - sample_size_type n_sample = (sc.end_offset-sc.begin_offset)/n_raw_per_sample; - arb_assert((sc.end_offset-sc.begin_offset)==n_sample*n_raw_per_sample); - arb_assert((unsigned)n_raw_per_sample==p.weight.size()); + sample_size_type n_sample = (sc.end_offset - sc.begin_offset)/n_raw_per_sample; + arb_assert((sc.end_offset - sc.begin_offset)==n_sample*n_raw_per_sample); + arb_assert((unsigned)n_raw_per_sample == p.weight.size()); auto& sample_ranges = std::get>(scratch); sample_ranges.clear(); @@ -249,14 +244,12 @@ void run_samples( sc.sampler({sc.probeset_id, sc.index, p.get_metadata_ptr()}, n_sample, sample_records.data()); } -void run_samples( - const fvm_probe_interpolated_multi& p, - const sampler_call_info& sc, - const arb_value_type* raw_times, - const arb_value_type* raw_samples, - std::vector& sample_records, - fvm_probe_scratch& scratch) -{ +void run_samples(const fvm_probe_interpolated_multi& p, + const sampler_call_info& sc, + const arb_value_type* raw_times, + const arb_value_type* raw_samples, + std::vector& sample_records, + fvm_probe_scratch& scratch) { const sample_size_type n_raw_per_sample = p.raw_handles.size(); const sample_size_type n_interp_per_sample = n_raw_per_sample/2; sample_size_type n_sample = (sc.end_offset-sc.begin_offset)/n_raw_per_sample; diff --git a/arbor/communication/dry_run_context.cpp b/arbor/communication/dry_run_context.cpp index affcd77660..9936eaabba 100644 --- a/arbor/communication/dry_run_context.cpp +++ b/arbor/communication/dry_run_context.cpp @@ -1,4 +1,3 @@ -#include #include #include @@ -6,12 +5,12 @@ #include "distributed_context.hpp" #include "label_resolution.hpp" -#include "threading/threading.hpp" #include "util/rangeutil.hpp" namespace arb { struct dry_run_context_impl { + using count_type = typename gathered_vector::count_type; explicit dry_run_context_impl(unsigned num_ranks, unsigned num_cells_per_tile): num_ranks_(num_ranks), num_cells_per_tile_(num_cells_per_tile) {}; @@ -21,7 +20,6 @@ struct dry_run_context_impl { } gathered_vector gather_spikes(const std::vector& local_spikes) const { - using count_type = typename gathered_vector::count_type; count_type local_size = local_spikes.size(); @@ -49,8 +47,6 @@ struct dry_run_context_impl { void remote_ctrl_send_done() const {} gathered_vector gather_gids(const std::vector& local_gids) const { - using count_type = typename gathered_vector::count_type; - count_type local_size = local_gids.size(); std::vector gathered_gids; @@ -68,7 +64,7 @@ struct dry_run_context_impl { std::vector partition; for (count_type i = 0; i <= num_ranks_; i++) { - partition.push_back(static_cast(i*local_size)); + partition.push_back(i*local_size); } return gathered_vector(std::move(gathered_gids), std::move(partition)); diff --git a/arbor/include/arbor/common_types.hpp b/arbor/include/arbor/common_types.hpp index be3f4f095d..5e57f723c2 100644 --- a/arbor/include/arbor/common_types.hpp +++ b/arbor/include/arbor/common_types.hpp @@ -138,8 +138,8 @@ using time_type = double; constexpr time_type terminal_time = std::numeric_limits::max(); // For holding counts and indexes into generated sample data. - -using sample_size_type = std::int32_t; +using sample_index_type = std::int32_t; +using sample_size_type = std::uint32_t; // Enumeration for execution back-end targets, as specified in domain decompositions. diff --git a/arbor/include/arbor/math.hpp b/arbor/include/arbor/math.hpp index 17e12b3c2c..d9483f3501 100644 --- a/arbor/include/arbor/math.hpp +++ b/arbor/include/arbor/math.hpp @@ -101,7 +101,8 @@ template < > C round_up(T v, U b) { C m = v%b; - return v-m+signum(m)*impl::abs_if_signed(b, Signed{}); + C sign = signum(m); + return v - m + sign*impl::abs_if_signed(b, Signed{}); } // Returns 1/x if x != 0; 0 otherwise diff --git a/arbor/include/arbor/util/hash_def.hpp b/arbor/include/arbor/util/hash_def.hpp index 261e112948..4ea944bb3a 100644 --- a/arbor/include/arbor/util/hash_def.hpp +++ b/arbor/include/arbor/util/hash_def.hpp @@ -40,8 +40,9 @@ namespace detail { template inline constexpr std::size_t internal_hash(T&& data) { using D = std::decay_t; - constexpr std::size_t prime = 0x100000001b3; - constexpr std::size_t offset_basis = 0xcbf29ce484222325; + // Due to constexpr if we might never use these. + [[maybe_unused]] constexpr std::size_t prime = 0x100000001b3; + [[maybe_unused]] constexpr std::size_t offset_basis = 0xcbf29ce484222325; static_assert(!std::is_pointer_v || std::is_same_v || std::is_convertible_v, "Pointer types except void* will not be hashed."); if constexpr (std::is_convertible_v) { diff --git a/example/generators/generators.cpp b/example/generators/generators.cpp index 858fe05e6b..b0600175b9 100644 --- a/example/generators/generators.cpp +++ b/example/generators/generators.cpp @@ -82,8 +82,6 @@ class generator_recipe: public arb::recipe { std::vector event_generators(cell_gid_type gid) const override { assert(gid==0); // There is only one cell in the model - using RNG = std::mt19937_64; - auto hz_to_freq = [](double hz) { return hz*1e-3; }; time_type t0 = 0; diff --git a/modcc/io/prefixbuf.cpp b/modcc/io/prefixbuf.cpp index 6b85f907df..78771e6602 100644 --- a/modcc/io/prefixbuf.cpp +++ b/modcc/io/prefixbuf.cpp @@ -75,11 +75,13 @@ int indent_manip::xindex() { static void apply_indent_prefix(std::ios& s, int index) { if (auto pbuf = dynamic_cast(s.rdbuf())) { - indent_stack* stack_ptr = static_cast(s.pword(index)); - unsigned tabwidth = s.iword(index); - - unsigned tabs = (!stack_ptr || stack_ptr->empty())? 0: stack_ptr->top(); - pbuf->prefix = std::string(tabs*tabwidth, ' '); + if (auto ptr = static_cast(s.pword(index)); ptr && !ptr->empty()) { + unsigned n_tab = ptr->top(); + unsigned width = s.iword(index); + pbuf->prefix = std::string(n_tab*width, ' '); + } else { + pbuf->prefix = std::string(); + } } } diff --git a/python/stubs/arbor/_arbor/__init__.pyi b/python/stubs/arbor/_arbor/__init__.pyi index aabd4f3de2..a0ae1484c9 100644 --- a/python/stubs/arbor/_arbor/__init__.pyi +++ b/python/stubs/arbor/_arbor/__init__.pyi @@ -1,6 +1,7 @@ """ arbor: multicompartment neural network models. """ + from __future__ import annotations import typing from . import env @@ -164,11 +165,13 @@ class asc_morphology: """ The four canonical regions are labeled 'soma', 'axon', 'dend' and 'apic'. """ + @property def morphology(self) -> morphology: """ The cable cell morphology. """ + @property def segment_tree(self) -> segment_tree: """ @@ -235,6 +238,7 @@ class benchmark_cell: Construct a benchmark cell that generates spikes on 'source_label' at regular intervals. The cell has one source labeled 'source_label', and one target labeled 'target_label'. """ + @typing.overload def __init__( self, @@ -247,6 +251,7 @@ class benchmark_cell: Construct a benchmark cell that generates spikes on 'source_label' at a sequence of user-defined times. The cell has one source labeled 'source_label', and one target labeled 'target_label'. """ + @typing.overload def __init__( self, @@ -259,6 +264,7 @@ class benchmark_cell: Construct a benchmark cell that generates spikeson 'source_label' at times defined by a Poisson sequence. The cell has one source labeled 'source_label', and one target labeled 'target_label'. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @@ -273,11 +279,13 @@ class cable: """ The id of the branch on which the cable lies. """ + @property def dist(self) -> float: """ The relative position of the distal end of the cable on its branch ∈ [0,1]. """ + @property def prox(self) -> float: """ @@ -297,6 +305,7 @@ class cable_cell: """ Construct with a morphology, decor, and label dictionary. """ + @typing.overload def __init__( self, segment_tree: segment_tree, decor: decor, labels: label_dict | None = None @@ -304,16 +313,19 @@ class cable_cell: """ Construct with a morphology derived from a segment tree, decor, and label dictionary. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def cables(self, label: str) -> list[cable]: """ The cable segments of the cell morphology for a region label. """ + def locations(self, label: str) -> list[location]: """ The locations of the cell morphology for a locset label. """ + @property def num_branches(self) -> int: """ @@ -328,11 +340,13 @@ class cable_component: """ cable-cell component. """ + @property def meta_data(self) -> component_meta_data: """ cable-cell component meta-data. """ + @meta_data.setter def meta_data(self, arg0: component_meta_data) -> None: ... @@ -347,6 +361,7 @@ class cable_global_properties: """ Test whether all default parameters and ion species properties have been set. """ + def set_ion( self, ion: str, @@ -374,6 +389,7 @@ class cable_global_properties: reversal potential is global for all compartments in the cell, and can't be overriden locally. """ + def set_property( self, Vm: units.quantity | None = None, @@ -389,10 +405,12 @@ class cable_global_properties: * tempK: temperature [Kelvin]. These values can be overridden on specific regions using the paint interface. """ + def unset_ion(self, arg0: str) -> None: """ Remove ion species from properties. """ + @property def axial_resistivity(self) -> float | None: ... @axial_resistivity.setter @@ -402,6 +420,7 @@ class cable_global_properties: """ The mechanism catalogue. """ + @catalogue.setter def catalogue(self, arg0: catalogue) -> None: ... @property @@ -409,6 +428,7 @@ class cable_global_properties: """ Flag for enabling/disabling linear syanpse coalescing. """ + @coalesce_synapses.setter def coalesce_synapses(self, arg0: bool) -> None: ... @property @@ -422,6 +442,7 @@ class cable_global_properties: """ Return a view of all ion settings. """ + @property def membrane_capacitance(self) -> float | None: ... @membrane_capacitance.setter @@ -447,6 +468,7 @@ class cable_probe_point_info: """ Location of point process instance on cell. """ + @location.setter def location(self, arg0: location) -> None: ... @property @@ -454,6 +476,7 @@ class cable_probe_point_info: """ Number of coalesced point processes (linear synapses) associated with this instance. """ + @multiplicity.setter def multiplicity(self, arg0: int) -> None: ... @property @@ -461,6 +484,7 @@ class cable_probe_point_info: """ The target index of the point process instance on the cell. """ + @target.setter def target(self, arg0: int) -> None: ... @@ -469,6 +493,7 @@ class catalogue: """ Is 'name' in the catalogue? """ + def __getitem__(self, arg0: str) -> mechanism_info: ... @typing.overload def __init__(self) -> None: ... @@ -478,6 +503,7 @@ class catalogue: """ Return an iterator over all mechanism names in this catalogues. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def derive( @@ -491,18 +517,22 @@ class catalogue: """ Import another catalogue, possibly with a prefix. Will overwrite in case of name collisions. """ + def is_derived(self, name: str) -> bool: """ Is 'name' a derived mechanism or can it be implicitly derived? """ + def items(self) -> MechCatItemIterator: """ Return an iterator over all (name, mechanism) tuples in this catalogues. """ + def keys(self) -> MechCatKeyIterator: """ Return an iterator over all mechanism names in this catalogues. """ + def values(self) -> MechCatValueIterator: """ Return an iterator over all mechanism info values in this catalogues. @@ -523,14 +553,17 @@ class cell_cv_data: """ Return a list of cables representing the CV at the given index. """ + def children(self, index: int) -> list[int]: """ Return a list of indices of the CVs representing the children of the CV at the given index. """ + def parent(self, index: int) -> int: """ Return the index of the CV representing the parent of the CV at the given index. """ + @property def num_cv(self) -> int: """ @@ -552,6 +585,7 @@ class cell_global_label: Construct a cell_global_label identifier from a gid and a label argument identifying an item on the cell. The default round_robin policy is used for selecting one of possibly multiple items on the cell associated with the label. """ + @typing.overload def __init__(self, gid: int, label: cell_local_label) -> None: """ @@ -559,6 +593,7 @@ class cell_global_label: gid: The global identifier of the cell. label: The cell_local_label representing the label and selection policy of an item on the cell. """ + @typing.overload def __init__(self, arg0: tuple) -> None: """ @@ -566,6 +601,7 @@ class cell_global_label: gid: The global identifier of the cell. label: The cell_local_label representing the label and selection policy of an item on the cell. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -573,6 +609,7 @@ class cell_global_label: """ The global identifier of the cell. """ + @gid.setter def gid(self, arg0: int) -> None: ... @property @@ -580,6 +617,7 @@ class cell_global_label: """ The cell_local_label representing the label and selection policy of an item on the cell. """ + @label.setter def label(self, arg0: cell_local_label) -> None: ... @@ -635,6 +673,7 @@ class cell_local_label: Construct a cell_local_label identifier from a label argument identifying a group of one or more items on a cell. The default round_robin policy is used for selecting one of possibly multiple items associated with the label. """ + @typing.overload def __init__(self, label: str, policy: selection_policy) -> None: """ @@ -642,6 +681,7 @@ class cell_local_label: label: The identifier of a group of one or more items on a cell. policy: The policy for selecting one of possibly multiple items associated with the label. """ + @typing.overload def __init__(self, arg0: tuple) -> None: """ @@ -649,6 +689,7 @@ class cell_local_label: label: The identifier of a group of one or more items on a cell. policy: The policy for selecting one of possibly multiple items associated with the label. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -656,6 +697,7 @@ class cell_local_label: """ The identifier of a a group of one or more items on a cell. """ + @label.setter def label(self, arg0: str) -> None: ... @property @@ -663,6 +705,7 @@ class cell_local_label: """ The policy for selecting one of possibly multiple items associated with the label. """ + @policy.setter def policy(self, arg0: selection_policy) -> None: ... @@ -682,6 +725,7 @@ class cell_member: gid: The global identifier of the cell. index: The cell-local index of the item. """ + @typing.overload def __init__(self, arg0: tuple) -> None: """ @@ -689,6 +733,7 @@ class cell_member: gid: The global identifier of the cell. index: The cell-local index of the item. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -696,6 +741,7 @@ class cell_member: """ The global identifier of the cell. """ + @gid.setter def gid(self, arg0: int) -> None: ... @property @@ -703,6 +749,7 @@ class cell_member: """ Cell-local index of the item. """ + @index.setter def index(self, arg0: int) -> None: ... @@ -712,6 +759,7 @@ class component_meta_data: """ cable-cell component version. """ + @version.setter def version(self, arg0: str) -> None: ... @@ -735,6 +783,7 @@ class connection: weight: The weight delivered to the target synapse (unit defined by the type of synapse target). delay: The delay of the connection [ms]. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -742,6 +791,7 @@ class connection: """ The delay time of the connection [ms]. """ + @delay.setter def delay(self, arg0: float) -> None: ... @property @@ -749,6 +799,7 @@ class connection: """ The destination label of the connection. """ + @dest.setter def dest(self, arg0: cell_local_label) -> None: ... @property @@ -756,6 +807,7 @@ class connection: """ The source gid and label of the connection. """ + @source.setter def source(self, arg0: cell_global_label) -> None: ... @property @@ -763,6 +815,7 @@ class connection: """ The weight of the connection. """ + @weight.setter def weight(self, arg0: float) -> None: ... @@ -776,6 +829,7 @@ class context: """ Construct a local context with proc_allocation = env.default_allocation(). """ + @typing.overload def __init__( self, @@ -796,6 +850,7 @@ class context: bind_procs: Create process binding mask. bind_threads: Create thread binding mask. """ + @typing.overload def __init__( self, @@ -810,6 +865,7 @@ class context: mpi: The MPI communicator, None by default. Only available if arbor.__config__['mpi']==True. inter: An MPI intercommunicator used to connect to external simulations, None by default. Only available if arbor.__config__['mpi']==True. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -817,21 +873,25 @@ class context: """ Whether the context has a GPU. """ + @property def has_mpi(self) -> bool: """ Whether the context uses MPI for distributed communication. """ + @property def rank(self) -> int: """ The numeric id of the local domain (equivalent to MPI rank). """ + @property def ranks(self) -> int: """ The number of distributed domains (equivalent to the number of MPI ranks). """ + @property def threads(self) -> int: """ @@ -848,6 +908,7 @@ class cv_policy: """ A valid CV policy expression """ + def __or__(self, arg0: cv_policy) -> cv_policy: ... def __repr__(self) -> str: ... def __str__(self) -> str: ... @@ -884,31 +945,37 @@ class decor: """ Return a view of all defaults. """ + @typing.overload def discretization(self, policy: cv_policy) -> decor: """ A cv_policy used to discretise the cell into compartments for simulation """ + @typing.overload def discretization(self, policy: str) -> decor: """ An s-expression string representing a cv_policy used to discretise the cell into compartments for simulation """ + @typing.overload def paint(self, region: str, mechanism: density) -> decor: """ Associate a density mechanism with a region. """ + @typing.overload def paint(self, region: str, mechanism: voltage_process) -> decor: """ Associate a voltage process mechanism with a region. """ + @typing.overload def paint(self, region: str, mechanism: scaled_mechanism) -> None: """ Associate a scaled density mechanism with a region. """ + @typing.overload def paint( self, @@ -926,6 +993,7 @@ class decor: * rL: axial resistivity [Ω·cm]. * tempK: temperature [Kelvin]. """ + @typing.overload def paint( self, @@ -945,6 +1013,7 @@ class decor: * method: mechanism for calculating reversal potential. * diff: diffusivity [m^2/s]. """ + def paintings( self, ) -> list[ @@ -966,32 +1035,38 @@ class decor: """ Return a view of all painted items. """ + @typing.overload def place(self, locations: str, synapse: synapse, label: str) -> decor: """ Place one instance of 'synapse' on each location in 'locations'.The group of synapses has the label 'label', used for forming connections between cells. """ + @typing.overload def place(self, locations: str, junction: junction, label: str) -> decor: """ Place one instance of 'junction' on each location in 'locations'.The group of junctions has the label 'label', used for forming gap-junction connections between cells. """ + @typing.overload def place(self, locations: str, iclamp: iclamp, label: str) -> decor: """ Add a current stimulus at each location in locations.The group of current stimuli has the label 'label'. """ + @typing.overload def place(self, locations: str, detector: threshold_detector, label: str) -> decor: """ Add a voltage spike detector at each location in locations.The group of spike detectors has the label 'label', used for forming connections between cells. """ + def placements( self, ) -> list[tuple[str, iclamp | threshold_detector | synapse | junction, str]]: """ Return a view of all placed items. """ + def set_ion( self, ion: str, @@ -1017,6 +1092,7 @@ class decor: reversal potential is global for all compartments in the cell, and can't be overriden locally. """ + def set_property( self, Vm: units.quantity | None = None, @@ -1069,32 +1145,38 @@ class domain_decomposition: """ Query the domain id that a cell assigned to (using global identifier gid). """ + @property def domain_id(self) -> int: """ The index of the local domain. Always 0 for non-distributed models, and corresponds to the MPI rank for distributed runs. """ + @property def groups(self) -> list[group_description]: """ Descriptions of the cell groups on the local domain. """ + @property def num_domains(self) -> int: """ Number of domains that the model is distributed over. """ + @property def num_global_cells(self) -> int: """ Total number of cells in the global model (sum of num_local_cells over all domains). """ + @property def num_groups(self) -> int: """ Total number of cell groups in the local domain. """ + @property def num_local_cells(self) -> int: """ @@ -1111,6 +1193,7 @@ class event_generator: weight: The weight of events to deliver. sched: A schedule of the events. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1118,6 +1201,7 @@ class event_generator: """ The target synapse (gid, local_id). """ + @target.setter def target(self, arg0: cell_local_label) -> None: ... @property @@ -1125,6 +1209,7 @@ class event_generator: """ The weight of events to deliver. """ + @weight.setter def weight(self, arg0: float) -> None: ... @@ -1138,23 +1223,27 @@ class explicit_schedule(schedule_base): """ Construct an empty explicit schedule. """ + @typing.overload def __init__(self, times: list[units.quantity]) -> None: """ Construct an explicit schedule with argument: times: A list of times [ms], [] by default. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def events(self, arg0: float, arg1: float) -> list[float]: """ A view of monotonically increasing time values in the half-open interval [t0, t1) in [ms]. """ + @property def times_ms(self) -> list[float]: """ A list of times [ms]. """ + @times_ms.setter def times_ms(self, arg1: list[float]) -> None: ... @@ -1185,6 +1274,7 @@ class gap_junction_connection: local: local half of the gap junction connection. weight: Gap junction connection weight [unit-less]. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1192,6 +1282,7 @@ class gap_junction_connection: """ Local label of the gap junction connection. """ + @local.setter def local(self, arg0: cell_local_label) -> None: ... @property @@ -1199,6 +1290,7 @@ class gap_junction_connection: """ Remote gid and label of the gap junction connection. """ + @peer.setter def peer(self, arg0: cell_global_label) -> None: ... @property @@ -1206,6 +1298,7 @@ class gap_junction_connection: """ Gap junction connection weight [unit-less]. """ + @weight.setter def weight(self, arg0: float) -> None: ... @@ -1218,6 +1311,7 @@ class group_description: """ Construct a group description with cell kind, list of gids, and backend kind. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1225,11 +1319,13 @@ class group_description: """ The hardware backend on which the cell group will run. """ + @property def gids(self) -> list[int]: """ The list of gids of the cells in the group. """ + @property def kind(self) -> cell_kind: """ @@ -1254,6 +1350,7 @@ class iclamp: """ Construct finite duration current clamp, constant amplitude """ + @typing.overload def __init__( self, @@ -1265,6 +1362,7 @@ class iclamp: """ Construct constant amplitude current clamp """ + @typing.overload def __init__( self, @@ -1276,6 +1374,7 @@ class iclamp: """ Construct current clamp according to (time, amplitude) linear envelope """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1283,11 +1382,13 @@ class iclamp: """ List of (time [ms], amplitude [nA]) points comprising the piecewise linear envelope """ + @property def frequency(self) -> float: """ Oscillation frequency (kHz), zero implies DC stimulus. """ + @property def phase(self) -> float: """ @@ -1308,31 +1409,37 @@ class ion_data: """ Valence. """ + @property def diffusivity(self) -> float | None: """ Diffusivity. """ + @property def external_concentration(self) -> float | None: """ External concentration. """ + @property def internal_concentration(self) -> float | None: """ Internal concentration. """ + @property def reversal_concentration(self) -> float | None: """ Reversal potential. """ + @property def reversal_potential(self) -> float | None: """ Reversal potential. """ + @property def reversal_potential_method(self) -> str: """ @@ -1374,44 +1481,52 @@ class isometry: """ Construct a rotation isometry of angle theta about the axis in direction (x, y, z). """ + @staticmethod @typing.overload def rotate(theta: float, axis: tuple) -> isometry: """ Construct a rotation isometry of angle theta about the given axis in the direction described by a tuple. """ + @staticmethod @typing.overload def translate(x: float, y: float, z: float) -> isometry: """ Construct a translation isometry from displacements x, y, and z. """ + @staticmethod @typing.overload def translate(arg0: tuple) -> isometry: """ Construct a translation isometry from the first three components of a tuple. """ + @staticmethod @typing.overload def translate(arg0: mpoint) -> isometry: """ Construct a translation isometry from the x, y, and z components of an mpoint. """ + @typing.overload def __call__(self, arg0: mpoint) -> mpoint: """ Apply isometry to mpoint argument. """ + @typing.overload def __call__(self, arg0: tuple) -> tuple: """ Apply isometry to first three components of tuple argument. """ + def __init__(self) -> None: """ Construct a trivial isometry. """ + def __mul__(self, arg0: isometry) -> isometry: ... class junction: @@ -1450,6 +1565,7 @@ class label_dict: """ Import the entries of a another label dictionary with an optional prefix. """ + def __contains__(self, arg0: str) -> bool: ... def __getitem__(self, arg0: str) -> str: ... @typing.overload @@ -1457,21 +1573,25 @@ class label_dict: """ Create an empty label dictionary. """ + @typing.overload def __init__(self, arg0: dict[str, str]) -> None: """ Initialize a label dictionary from a dictionary with string labels as keys, and corresponding definitions as strings. """ + @typing.overload def __init__(self, arg0: label_dict) -> None: """ Initialize a label dictionary from another one """ + @typing.overload def __init__(self, arg0: typing.Iterator) -> None: """ Initialize a label dictionary from an iterable of key, definition pairs """ + def __iter__(self) -> typing.Iterator: ... def __len__(self) -> int: ... def __repr__(self) -> str: ... @@ -1485,18 +1605,21 @@ class label_dict: - dend: (tag 3) - apic: (tag 4) """ + def items(self) -> typing.Iterator: ... def keys(self) -> typing.Iterator: ... def update(self, other: label_dict) -> None: """ The label_dict to be importedImport the entries of a another label dictionary. """ + def values(self) -> typing.Iterator: ... @property def locsets(self) -> list[str]: """ The locset definitions. """ + @property def regions(self) -> list[str]: """ @@ -1529,6 +1652,7 @@ class lif_cell: * V_m: Initial value of the Membrane potential [mV]. * t_ref: Refractory period [ms]. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1536,6 +1660,7 @@ class lif_cell: """ Membrane capacitance [pF]. """ + @C_m.setter def C_m(self, arg0: units.quantity) -> None: ... @property @@ -1543,6 +1668,7 @@ class lif_cell: """ Resting potential [mV]. """ + @E_L.setter def E_L(self, arg0: units.quantity) -> None: ... @property @@ -1550,6 +1676,7 @@ class lif_cell: """ Reset potential [mV]. """ + @E_R.setter def E_R(self, arg0: units.quantity) -> None: ... @property @@ -1557,6 +1684,7 @@ class lif_cell: """ Initial value of the Membrane potential [mV]. """ + @V_m.setter def V_m(self, arg0: units.quantity) -> None: ... @property @@ -1564,6 +1692,7 @@ class lif_cell: """ Firing threshold [mV]. """ + @V_th.setter def V_th(self, arg0: units.quantity) -> None: ... @property @@ -1571,6 +1700,7 @@ class lif_cell: """ Label of the single build-in source on the cell. """ + @source.setter def source(self, arg0: str) -> None: ... @property @@ -1578,6 +1708,7 @@ class lif_cell: """ Refractory period [ms]. """ + @t_ref.setter def t_ref(self, arg0: units.quantity) -> None: ... @property @@ -1585,6 +1716,7 @@ class lif_cell: """ Label of the single build-in target on the cell. """ + @target.setter def target(self, arg0: str) -> None: ... @property @@ -1592,6 +1724,7 @@ class lif_cell: """ Membrane potential decaying constant [ms]. """ + @tau_m.setter def tau_m(self, arg0: units.quantity) -> None: ... @@ -1613,6 +1746,7 @@ class location: branch: The id of the branch. pos: The relative position (from 0., proximal, to 1., distal) on the branch. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1620,6 +1754,7 @@ class location: """ The id of the branch. """ + @property def pos(self) -> float: """ @@ -1632,6 +1767,7 @@ class mechanism: """ The name of the mechanism """ + @typing.overload def __init__(self, name: str, params: dict[str, float]) -> None: """ @@ -1644,6 +1780,7 @@ class mechanism: Example overriding a global parameter: m = arbor.mechanism('nernst/R=8.3145,F=96485') """ + @typing.overload def __init__(self, name: str, **kwargs) -> None: """ @@ -1656,17 +1793,20 @@ class mechanism: Example overriding a global parameter: m = arbor.mechanism('nernst/R=8.3145,F=96485') """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def set(self, name: str, value: float) -> None: """ Set parameter value. """ + @property def name(self) -> str: """ The name of the mechanism. """ + @property def values(self) -> dict[str, float]: """ @@ -1703,31 +1843,37 @@ class mechanism_info: """ Global fields have one value common to an instance of a mechanism, are constant in time and set at instantiation. """ + @property def ions(self) -> dict[str, ion_dependency]: """ Ion dependencies. """ + @property def kind(self) -> str: """ String representation of the kind of the mechanism. """ + @property def linear(self) -> bool: """ True if a synapse mechanism has linear current contributions so that multiple instances on the same compartment can be coalesced. """ + @property def parameters(self) -> dict[str, mechanism_field]: """ Parameter fields may vary across the extent of a mechanism, but are constant in time and set at instantiation. """ + @property def post_events(self) -> bool: """ True if a synapse mechanism has a `POST_EVENT` procedure defined. """ + @property def state(self) -> dict[str, mechanism_field]: """ @@ -1762,15 +1908,18 @@ class meter_manager: """ Create a new checkpoint. Records the time since the last checkpoint(or the call to start if no previous checkpoints exist),and restarts the timer for the next checkpoint. """ + def start(self, context: context) -> None: """ Start the metering. Records a time stamp, that marks the start of the first checkpoint timing region. """ + @property def checkpoint_names(self) -> list[str]: """ A list of all metering checkpoint names. """ + @property def times(self) -> list[float]: """ @@ -1798,23 +1947,28 @@ class morphology: """ The child branches of branch i. """ + def branch_parent(self, i: int) -> int: """ The parent branch of branch i. """ + def branch_segments(self, i: int) -> list[msegment]: """ A list of the segments in branch i, ordered from proximal to distal ends of the branch. """ + def to_segment_tree(self) -> segment_tree: """ Convert this morphology to a segment_tree. """ + @property def empty(self) -> bool: """ Whether the morphology is empty. """ + @property def num_branches(self) -> int: """ @@ -1826,10 +1980,12 @@ class morphology_provider: """ Construct a morphology provider. """ + def reify_locset(self, arg0: str) -> list[location]: """ Turn a locset into a list of locations. """ + def reify_region(self, arg0: str) -> extent: """ Turn a region into an extent. @@ -1843,11 +1999,13 @@ class mpoint: """ Create an mpoint object from parameters x, y, z, and radius, specified in µm. """ + @typing.overload def __init__(self, arg0: tuple) -> None: """ Create an mpoint object from a tuple (x, y, z, radius), specified in µm. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1855,16 +2013,19 @@ class mpoint: """ Radius of cable at sample location centred at coordinates [μm]. """ + @property def x(self) -> float: """ X coordinate [μm]. """ + @property def y(self) -> float: """ Y coordinate [μm]. """ + @property def z(self) -> float: """ @@ -1877,11 +2038,13 @@ class msegment: """ the location and radius of the distal end. """ + @property def prox(self) -> mpoint: """ the location and radius of the proximal end. """ + @property def tag(self) -> int: """ @@ -1893,22 +2056,26 @@ class neuroml: """ Construct NML morphology from filename or stream. """ + def cell_ids(self) -> list[str]: """ Query top-level cells. """ + def cell_morphology( self, cell_id: str, allow_spherical_root: bool = False ) -> neuroml_morph_data | None: """ Retrieve nml_morph_data associated with cell_id. """ + def morphology( self, morph_id: str, allow_spherical_root: bool = False ) -> neuroml_morph_data | None: """ Retrieve top-level nml_morph_data associated with morph_id. """ + def morphology_ids(self) -> list[str]: """ Query top-level standalone morphologies. @@ -1919,29 +2086,35 @@ class neuroml_morph_data: """ Label dictionary containing one region expression for each segmentGroup id. """ + def named_segments(self) -> label_dict: """ Label dictionary containing one region expression for each name applied to one or more segments. """ + def segments(self) -> label_dict: """ Label dictionary containing one region expression for each segment id. """ + @property def cell_id(self) -> str | None: """ Cell id, or empty if morphology was taken from a top-level element. """ + @property def group_segments(self) -> dict[str, list[int]]: """ Map from segmentGroup ids to their corresponding segment ids. """ + @property def id(self) -> str: """ Morphology id. """ + @property def morphology(self) -> morphology: """ @@ -1968,6 +2141,7 @@ class partition_hint: Must be positive, else set to default value. prefer_gpu: Whether GPU is preferred, True by default. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -1975,6 +2149,7 @@ class partition_hint: """ The size of cell group assigned to CPU. """ + @cpu_group_size.setter def cpu_group_size(self, arg0: int) -> None: ... @property @@ -1982,6 +2157,7 @@ class partition_hint: """ The size of cell group assigned to GPU. """ + @gpu_group_size.setter def gpu_group_size(self, arg0: int) -> None: ... @property @@ -1989,6 +2165,7 @@ class partition_hint: """ Whether GPU usage is preferred. """ + @prefer_gpu.setter def prefer_gpu(self, arg0: bool) -> None: ... @@ -1997,22 +2174,27 @@ class place_pwlin: """ Construct a piecewise-linear placement object from the given morphology and optional isometry. """ + def all_at(self, location: location) -> list[mpoint]: """ Return list of all possible interpolated mpoints corresponding to the location argument. """ + def all_segments(self, arg0: list[cable]) -> list[msegment]: """ Return maximal list of non-overlapping full or partial msegments whose union is coterminous with the extent of the given list of cables. """ + def at(self, location: location) -> mpoint: """ Return an interpolated mpoint corresponding to the location argument. """ + def closest(self, arg0: float, arg1: float, arg2: float) -> tuple: """ Find the location on the morphology that is closest to a 3d point. Returns the location and its distance from the point. """ + def segments(self, arg0: list[cable]) -> list[msegment]: """ Return minimal list of full or partial msegments whose union is coterminous with the extent of the given list of cables. @@ -2038,17 +2220,20 @@ class poisson_schedule(schedule_base): seed: The seed for the random number generator, 0 by default. tstop: No events delivered after this time [ms], None by default. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def events(self, arg0: units.quantity, arg1: units.quantity) -> list[float]: """ A view of monotonically increasing time values in the half-open interval [t0, t1). """ + @property def freq(self) -> units.quantity: """ The expected frequency [kHz]. """ + @freq.setter def freq(self, arg1: units.quantity) -> None: ... @property @@ -2056,6 +2241,7 @@ class poisson_schedule(schedule_base): """ The seed for the random number generator. """ + @seed.setter def seed(self, arg0: int) -> None: ... @property @@ -2063,6 +2249,7 @@ class poisson_schedule(schedule_base): """ The delivery time of the first event in the sequence [ms]. """ + @tstart.setter def tstart(self, arg1: units.quantity) -> None: ... @property @@ -2070,6 +2257,7 @@ class poisson_schedule(schedule_base): """ No events delivered after this time [ms]. """ + @tstop.setter def tstop(self, arg1: units.quantity) -> None: ... @@ -2097,6 +2285,7 @@ class proc_allocation: bind_procs: Create process binding mask. bind_threads: Create thread binding mask. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -2104,6 +2293,7 @@ class proc_allocation: """ Try to bind MPI procs? """ + @bind_procs.setter def bind_procs(self, arg1: bool) -> None: ... @property @@ -2111,6 +2301,7 @@ class proc_allocation: """ Try to bind threads? """ + @bind_threads.setter def bind_threads(self, arg1: bool) -> None: ... @property @@ -2119,6 +2310,7 @@ class proc_allocation: The identifier of the GPU to use. Corresponds to the integer parameter used to identify GPUs in CUDA API calls. """ + @gpu_id.setter def gpu_id(self, arg1: typing.Any) -> None: ... @property @@ -2126,11 +2318,13 @@ class proc_allocation: """ Whether a GPU is being used (True/False). """ + @property def threads(self) -> int: """ The number of threads available locally for execution. """ + @threads.setter def threads(self, arg1: int) -> None: ... @@ -2146,34 +2340,42 @@ class recipe: """ High level description of the cell with global identifier gid. """ + def cell_kind(self, gid: int) -> cell_kind: """ The kind of cell with global identifier gid. """ + def connections_on(self, gid: int) -> list[connection]: """ A list of all the incoming connections to gid, [] by default. """ + def event_generators(self, gid: int) -> list[typing.Any]: """ A list of all the event generators that are attached to gid, [] by default. """ + def external_connections_on(self, gid: int) -> list[connection]: """ A list of all the incoming connections from _remote_ locations to gid, [] by default. """ + def gap_junctions_on(self, gid: int) -> list[gap_junction_connection]: """ A list of the gap junctions connected to gid, [] by default. """ + def global_properties(self, kind: cell_kind) -> typing.Any: """ The default properties applied to all cells of type 'kind' in the model. """ + def num_cells(self) -> int: """ The number of cells in the model. """ + def probes(self, gid: int) -> list[probe]: """ The probes to allow monitoring. @@ -2197,23 +2399,27 @@ class regular_schedule(schedule_base): dt: The interval between time points [ms]. tstop: No events delivered after this time [ms], None by default. """ + @typing.overload def __init__(self, dt: units.quantity) -> None: """ Construct a regular schedule, starting from t = 0 and never terminating, with arguments: dt: The interval between time points [ms]. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def events(self, arg0: float, arg1: float) -> list[float]: """ A view of monotonically increasing time values in the half-open interval [t0, t1). """ + @property def dt(self) -> units.quantity: """ The interval between time points [ms]. """ + @dt.setter def dt(self, arg1: units.quantity) -> None: ... @property @@ -2221,6 +2427,7 @@ class regular_schedule(schedule_base): """ The delivery time of the first event in the sequence [ms]. """ + @tstart.setter def tstart(self, arg1: units.quantity) -> None: ... @property @@ -2228,6 +2435,7 @@ class regular_schedule(schedule_base): """ No events delivered after this time [ms]. """ + @tstop.setter def tstop(self, arg1: units.quantity | None) -> None: ... @@ -2278,11 +2486,13 @@ class segment_tree: """ Append a segment to the tree. """ + @typing.overload def append(self, parent: int, dist: mpoint, tag: int) -> int: """ Append a segment to the tree. """ + @typing.overload def append( self, parent: int, x: float, y: float, z: float, radius: float, tag: int @@ -2290,54 +2500,66 @@ class segment_tree: """ Append a segment to the tree, using the distal location of the parent segment as the proximal end. """ + def apply_isometry(self, arg0: isometry) -> segment_tree: """ Apply an isometry to all segments in the tree. """ + def equivalent(self, arg0: segment_tree) -> bool: """ Two trees are equivalent, but not neccessarily identical, ie they have the same segments and structure. """ + def is_fork(self, i: int) -> bool: """ True if segment has more than one child. """ + def is_root(self, i: int) -> bool: """ True if segment has no parent. """ + def is_terminal(self, i: int) -> bool: """ True if segment has no children. """ + def join_at(self, arg0: int, arg1: segment_tree) -> segment_tree: """ Join two subtrees at a given id, such that said id becomes the parent of the inserted sub-tree. """ + def reserve(self, arg0: int) -> None: ... def split_at(self, arg0: int) -> tuple[segment_tree, segment_tree]: """ Split into a pair of trees at the given id, such that one tree is the subtree rooted at id and the other is the original tree without said subtree. """ + def tag_roots(self, arg0: int) -> list[int]: """ Get roots of tag region of this segment tree. """ + @property def empty(self) -> bool: """ Indicates whether the tree is empty (i.e. whether it has size 0) """ + @property def parents(self) -> list[int]: """ A list with the parent index of each segment. """ + @property def segments(self) -> list[msegment]: """ A list of the segments. """ + @property def size(self) -> int: """ @@ -2404,83 +2626,101 @@ class simulation: according to the domain decomposition and computational resources described by a context. Initialize PRNG using seed """ + def clear_samplers(self) -> None: """ Clearing spike and sample information. restoring memory """ + @typing.overload def probe_metadata(self, probeset_id: cell_address) -> list: """ Retrieve metadata associated with given probe id. """ + @typing.overload def probe_metadata(self, addr: tuple[int, str]) -> list: """ Retrieve metadata associated with given probe id. """ + @typing.overload def probe_metadata(self, gid: int, tag: str) -> list: """ Retrieve metadata associated with given probe id. """ + def progress_banner(self) -> None: """ Show a text progress bar during simulation. """ + def record(self, arg0: spike_recording) -> None: """ Disable or enable local or global spike recording. """ + def remove_all_samplers(self, arg0: int) -> None: """ Remove all sampling on the simulatr. """ + def remove_sampler(self, handle: int) -> None: """ Remove sampling associated with the given handle. """ + def reset(self) -> None: """ Reset the state of the simulation to its initial state. """ + def run(self, tfinal: units.quantity, dt: units.quantity = ...) -> float: """ Run the simulation from current simulation time to tfinal [ms], with maximum time step size dt [ms]. """ + @typing.overload def sample(self, probeset_id: cell_address, schedule: schedule_base) -> int: """ Record data from probes with given probeset_id according to supplied schedule. Returns handle for retrieving data or removing the sampling. """ + @typing.overload def sample(self, gid: int, tag: str, schedule: schedule_base) -> int: """ Record data from probes with given probeset_id=(gid, tag) according to supplied schedule. Returns handle for retrieving data or removing the sampling. """ + @typing.overload def sample(self, probeset_id: tuple[int, str], schedule: schedule_base) -> int: """ Record data from probes with given probeset_id=(gid, tag) according to supplied schedule. Returns handle for retrieving data or removing the sampling. """ + def samples(self, handle: int) -> list: """ Retrieve sample data as a list, one element per probe associated with the query. """ + def serialize(self) -> str: """ Serialize the simulation object to a JSON string. """ + def set_remote_spike_filter(self, pred: typing.Callable[[spike], bool]) -> None: """ Add a callback to filter spikes going out over external connections. `pred` isa callable on the `spike` type. **Caution**: This will be extremely slow; use C++ if you want to make use of this. """ + def spikes(self) -> typing.Any: """ Retrieve recorded spikes as numpy array. """ + def update(self, recipe: recipe) -> None: """ Rebuild the connection table from recipe::connections_on and the eventgenerators based on recipe::event_generators. @@ -2498,6 +2738,7 @@ class single_cell_model: """ Build single cell model from cable cell components """ + @typing.overload def __init__( self, morph: morphology, decor: decor, labels: label_dict = ... @@ -2505,11 +2746,13 @@ class single_cell_model: """ Build single cell model from cable cell components """ + @typing.overload def __init__(self, cell: cable_cell) -> None: """ Initialise a single cell model for a cable cell. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... def event_generator(self, event_generator: event_generator) -> None: @@ -2517,6 +2760,7 @@ class single_cell_model: Register an event generator. event_generator: An Arbor event generator. """ + @typing.overload def probe(self, what: str, where: str, tag: str, frequency: units.quantity) -> None: """ @@ -2526,6 +2770,7 @@ class single_cell_model: tag: Unique name for this probe. frequency: The target frequency at which to sample [kHz]. """ + @typing.overload def probe( self, what: str, where: location, tag: str, frequency: units.quantity @@ -2537,20 +2782,24 @@ class single_cell_model: tag: Unique name for this probe. frequency: The target frequency at which to sample [kHz]. """ + def run(self, tfinal: units.quantity, dt: units.quantity = ...) -> None: """ Run model from t=0 to t=tfinal ms. """ + @property def cable_cell(self) -> cable_cell: """ The cable cell held by this model. """ + @property def properties(self) -> cable_global_properties: """ Global properties. """ + @properties.setter def properties(self, arg0: cable_global_properties) -> None: ... @property @@ -2558,6 +2807,7 @@ class single_cell_model: """ Holds spike times [ms] after a call to run(). """ + @property def traces(self) -> list[trace]: """ @@ -2573,6 +2823,7 @@ class spike: """ The global identifier of the cell. """ + @source.setter def source(self, arg0: cell_member) -> None: ... @property @@ -2580,6 +2831,7 @@ class spike: """ The time of spike. """ + @time.setter def time(self, arg0: float) -> None: ... @@ -2626,18 +2878,21 @@ class spike_source_cell: Construct a spike source cell with a single source labeled 'source_label'. The cell generates spikes on 'source_label' at regular intervals. """ + @typing.overload def __init__(self, source_label: str, schedule: explicit_schedule) -> None: """ Construct a spike source cell with a single source labeled 'source_label'. The cell generates spikes on 'source_label' at a sequence of user-defined times. """ + @typing.overload def __init__(self, source_label: str, schedule: poisson_schedule) -> None: """ Construct a spike source cell with a single source labeled 'source_label'. The cell generates spikes on 'source_label' at times defined by a Poisson sequence. """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @@ -2683,6 +2938,7 @@ class threshold_detector: """ Voltage threshold of spike detector [mV] """ + def __repr__(self) -> str: ... def __str__(self) -> str: ... @property @@ -2703,16 +2959,19 @@ class trace: """ Location on cell morphology. """ + @property def time(self) -> list[float]: """ Time stamps of samples [ms]. """ + @property def value(self) -> list[float]: """ Sample values. """ + @property def variable(self) -> str: """ diff --git a/python/stubs/arbor/_arbor/env.pyi b/python/stubs/arbor/_arbor/env.pyi index 103e233033..72be0ec6da 100644 --- a/python/stubs/arbor/_arbor/env.pyi +++ b/python/stubs/arbor/_arbor/env.pyi @@ -1,6 +1,7 @@ """ Wrappers for arborenv. """ + from __future__ import annotations import arbor._arbor import typing diff --git a/python/stubs/arbor/_arbor/units.pyi b/python/stubs/arbor/_arbor/units.pyi index f5a79e4944..aa56715574 100644 --- a/python/stubs/arbor/_arbor/units.pyi +++ b/python/stubs/arbor/_arbor/units.pyi @@ -1,6 +1,7 @@ """ Units and quantities for driving the user interface. """ + from __future__ import annotations import typing @@ -78,12 +79,14 @@ class quantity: """ Convert quantity to string. """ + def __rmul__(self, arg0: float) -> quantity: ... def __rtruediv__(self, arg0: float) -> quantity: ... def __str__(self) -> str: """ Convert quantity to string. """ + def __sub__(self, arg0: quantity) -> quantity: ... @typing.overload def __truediv__(self, arg0: quantity) -> quantity: ... @@ -95,11 +98,13 @@ class quantity: """ Convert quantity to given unit and return magnitude. """ + @property def units(self) -> unit: """ Return units. """ + @property def value(self) -> float: """ @@ -123,12 +128,14 @@ class unit: """ Convert unit to string. """ + def __rmul__(self, arg0: float) -> quantity: ... def __rtruediv__(self, arg0: float) -> quantity: ... def __str__(self) -> str: """ Convert unit to string. """ + @typing.overload def __truediv__(self, arg0: unit) -> unit: ... @typing.overload diff --git a/scripts/tsplot b/scripts/tsplot index ee0f839cf4..024bde08bd 100755 --- a/scripts/tsplot +++ b/scripts/tsplot @@ -11,7 +11,7 @@ import matplotlib as M import matplotlib.pyplot as P import numbers from functools import reduce -from itertools import chain, islice, cycle +from itertools import islice, cycle # Read timeseries data from multiple files, plot each in one panel, with common # time axis, and optionally sharing a vertical axis as governed by the configuration. diff --git a/test/unit/test_sde.cpp b/test/unit/test_sde.cpp index 87f19824f3..d0d8b65708 100644 --- a/test/unit/test_sde.cpp +++ b/test/unit/test_sde.cpp @@ -377,8 +377,8 @@ class sde_recipe: public simple_recipe_base { // generic advance method used for all pertinent mechanisms // first argument indicates the number of random variables void advance_common(unsigned int n_rv, arb_mechanism_ppack* pp) { - const auto width = pp->width; - arb_value_type* ptr = archive_ptr->claim(width * n_rv); + auto width = pp->width; + arb_value_type* ptr = archive_ptr->claim(width*n_rv); for (arb_size_type j=0; jrandom_numbers[j][i]; @@ -413,7 +413,7 @@ TEST(sde, reproducibility) { // simulation parameters unsigned ncells = 4; unsigned ncvs = 2; - auto const dt = 0.5*arb::units::ms; + auto const dt = 0.5*U::ms; unsigned nsteps = 6; // Decorations with a bunch of stochastic processes @@ -494,7 +494,7 @@ TEST(sde, normality) { unsigned ncells = 4; unsigned nsynapses = 100; unsigned ncvs = 100; - auto dt = 0.5*arb::units::ms;; + auto dt = 0.5*U::ms;; unsigned nsteps = 50; // make labels (and locations for synapses) @@ -651,7 +651,7 @@ TEST(sde, solver) { unsigned ncells = 4; unsigned nsynapses = 2000; unsigned ncvs = 1; - auto dt = 1.0/512*arb::units::ms; // need relatively small time steps due to low accuracy + auto dt = 1.0/512*U::ms; // need relatively small time steps due to low accuracy unsigned nsteps = 100; unsigned nsims = 4; @@ -806,7 +806,7 @@ TEST(sde, coupled) { unsigned ncells = 4; unsigned nsynapses = 2000; unsigned ncvs = 1; - auto dt = 1.0/512*arb::units::ms; // need relatively small time steps due to low accuracy + auto dt = 1.0/512*U::ms; // need relatively small time steps due to low accuracy unsigned nsteps = 100; unsigned nsims = 4;