From d0b31a6fe7dd25be34bf8177f34d2a191cb3d70e Mon Sep 17 00:00:00 2001
From: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com>
Date: Fri, 16 Sep 2022 09:25:57 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8D=20=20Rename=20spike=20detector=20-?=
 =?UTF-8?q?>=20threshold=20detector=20(#1976)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- BREAKING: Rename spike detector -> threshold detector in Python
- `spike_detector` is still around, will throw a deprecation error; will be removed 0.9
- this brings Python closer to the C++ API and removes lots of ambiguities in the docs.
---
 doc/concepts/cable_cell.rst                   |  2 +-
 doc/concepts/cell.rst                         |  2 +-
 doc/concepts/decor.rst                        | 14 +++++++-------
 doc/concepts/domdec.rst                       |  4 ++--
 doc/concepts/interconnectivity.rst            |  2 +-
 doc/concepts/probe_sample.rst                 |  4 ++--
 doc/concepts/recipe.rst                       |  4 ++--
 doc/dev/communication.rst                     |  2 +-
 doc/dev/mechanism_abi.rst                     |  2 +-
 doc/python/decor.rst                          |  2 +-
 doc/python/interconnectivity.rst              | 11 +++++------
 doc/python/simulation.rst                     |  2 +-
 doc/tutorial/network_ring.rst                 |  2 +-
 doc/tutorial/single_cell_allen.rst            |  4 ++--
 doc/tutorial/single_cell_detailed.rst         | 10 +++++-----
 doc/tutorial/single_cell_model.rst            | 10 +++++-----
 python/cells.cpp                              | 11 +++++++++--
 python/example/gap_junctions.py               |  4 ++--
 python/example/network_ring.py                |  4 ++--
 python/example/network_ring_gpu.py            |  4 ++--
 python/example/network_ring_mpi.py            |  4 ++--
 python/example/plasticity.py                  |  2 +-
 python/example/single_cell_allen.py           |  4 ++--
 python/example/single_cell_detailed.py        |  4 ++--
 python/example/single_cell_detailed_recipe.py |  4 ++--
 python/example/single_cell_model.py           |  2 +-
 python/example/single_cell_nml.py             |  2 +-
 python/example/single_cell_recipe.py          |  2 +-
 python/example/single_cell_stdp.py            |  2 +-
 python/example/single_cell_swc.py             |  2 +-
 python/test/fixtures.py                       |  2 +-
 31 files changed, 68 insertions(+), 62 deletions(-)

diff --git a/doc/concepts/cable_cell.rst b/doc/concepts/cable_cell.rst
index 60ffdce9..a6190512 100644
--- a/doc/concepts/cable_cell.rst
+++ b/doc/concepts/cable_cell.rst
@@ -5,7 +5,7 @@ Cable cells
 
 An Arbor *cable cell* is a full :ref:`description <modelcelldesc>` of a cell
 with morphology and cell dynamics like ion species and their properties, ion
-channels, synapses, gap junction mechanisms, stimuli and spike detectors.
+channels, synapses, gap junction mechanisms, stimuli and threshold detectors.
 
 Cable cells are constructed from three components:
 
diff --git a/doc/concepts/cell.rst b/doc/concepts/cell.rst
index eaef2c43..117b1960 100644
--- a/doc/concepts/cell.rst
+++ b/doc/concepts/cell.rst
@@ -26,7 +26,7 @@ Cells interact with each other via spike exchange and gap junctions.
 Cell interactions via :ref:`connections <modelconnections>` and :ref:`gap junctions <modelgapjunctions>` occur
 between **source**, **target** and **gap junction site** locations on a cell. Connections are formed from sources
 to targets. Gap junctions are formed between two gap junction sites. An example of a source on a
-:ref:`cable cell<modelcablecell>` is a :ref:`threshold detector <cablecell-threshold-detectors>` (spike detector);
+:ref:`cable cell<modelcablecell>` is a :ref:`threshold detector <cablecell-threshold-detectors>`;
 an example of a target on a cable cell is a :ref:`synapse <cablecell-synapses>`.
 
 **Sources**, **targets** and **gap junction sites** are placed on sets of one or more locations on a cell.
diff --git a/doc/concepts/decor.rst b/doc/concepts/decor.rst
index db6264c7..62f2690e 100644
--- a/doc/concepts/decor.rst
+++ b/doc/concepts/decor.rst
@@ -22,7 +22,7 @@ The choice of region or locset is reflected in the two broad classes of dynamics
 
   * :ref:`Synapse mechanisms <cablecell-synapses>`.
   * :ref:`Gap junction mechanisms <cablecell-gj-mechs>`.
-  * :ref:`Threshold detectors <cablecell-threshold-detectors>` (spike detectors).
+  * :ref:`Threshold detectors <cablecell-threshold-detectors>`
   * :ref:`Stimuli <cablecell-stimuli>`.
   * :ref:`Probes <cablecell-probes>`.
 
@@ -353,19 +353,19 @@ A point mechanism (synapse) can form the target of a :term:`connection` on a cel
 
 .. _cablecell-threshold-detectors:
 
-2. Threshold detectors (spike detectors).
+2. Threshold detectors.
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-Spike detectors have a dual use: they can be used to record spike times, but are also used in propagating signals
+Threshold detectors have a dual use: they can be used to record spike times, but are also used in propagating signals
 between cells. An example where we're interested in when a threshold of ``-10 mV`` is reached:
 
 .. code-block:: Python
 
-    # Placing a spike detector might look like this.
+    # Placing a threshold detector might look like this.
     decor = arbor.decor()
-    decor.place('"root"', arbor.spike_detector(-10), "my_spike_detector")
+    decor.place('"root"', arbor.threshold_detector(-10), "detector")
 
-    # At this point, "my_spike_detector" could be connected to another cell,
+    # At this point, "detector" could be connected to another cell,
     # and it would transmit events upon the voltage crossing the threshold.
 
     # Just printing those spike times goes as follows.
@@ -376,7 +376,7 @@ between cells. An example where we're interested in when a threshold of ``-10 mV
     for sp in sim.spikes():
         print(" ", sp)
 
-See also :term:`spike detector`.
+See also :term:`threshold detector`.
 
 .. _cablecell-gj-mechs:
 
diff --git a/doc/concepts/domdec.rst b/doc/concepts/domdec.rst
index f4dac781..bc9ea903 100644
--- a/doc/concepts/domdec.rst
+++ b/doc/concepts/domdec.rst
@@ -37,8 +37,8 @@ We define some terms as used in the context of connectivity
    connection
       Tuple of ``(source, target, weight, delay)`` describing an
       axon/synapse connection as travelling time (`delay`) and attenuation
-      (`weight`) between two sites `source = (gid, spike_detector)` and `target
-      = (gid, synapse)` where `spike_detector` and `synapse` are string labels.
+      (`weight`) between two sites `source = (gid, threshold_detector)` and `target
+      = (gid, synapse)` where `threshold_detector` and `synapse` are string labels.
 
    cell_group
       List of same-kinded cells that share some information. Must not be split
diff --git a/doc/concepts/interconnectivity.rst b/doc/concepts/interconnectivity.rst
index 8c560648..a88e44eb 100644
--- a/doc/concepts/interconnectivity.rst
+++ b/doc/concepts/interconnectivity.rst
@@ -105,7 +105,7 @@ full recipe.
    action potential
       Spikes travel over :term:`connections <connection>`. In a synapse, they generate an event.
 
-   spike detector
+   threshold detector
       :ref:`Placed <cablecell-place>` on a cell. Possible source of a connection.
       Detects crossing of a fixed threshold and generates corresponding events.
       Also used to :ref:`record spikes <>` for analysis. See :ref:`here
diff --git a/doc/concepts/probe_sample.rst b/doc/concepts/probe_sample.rst
index cdd480c4..0e3b0fcf 100644
--- a/doc/concepts/probe_sample.rst
+++ b/doc/concepts/probe_sample.rst
@@ -61,8 +61,8 @@ Definitions
 Spiking
 *******
 
-Spike detectors have a dual use: they can be used to record spike times, but are also used in propagating signals
-between cells. See also :term:`spike detector` and :ref:`cablecell-threshold-detectors`.
+Threshold detectors have a dual use: they can be used to record spike times, but are also used in propagating signals
+between cells. See also :term:`threshold detector` and :ref:`cablecell-threshold-detectors`.
 
 
 API
diff --git a/doc/concepts/recipe.rst b/doc/concepts/recipe.rst
index c3b98ecf..c6ad21a0 100644
--- a/doc/concepts/recipe.rst
+++ b/doc/concepts/recipe.rst
@@ -23,11 +23,11 @@ An example model
 To better illustrate the content of a recipe, let's consider the following network of
 three cells:
 
-- ``Cell 0``: Is a single soma, with ``hh`` (Hodgkin-huxley) dynamics. A spike detector
+- ``Cell 0``: Is a single soma, with ``hh`` (Hodgkin-huxley) dynamics. A threshold detector
   labelled "detector_0" is attached to the middle of the soma. The detector will generate a
   spike event when the voltage goes above 10 mV. At the same spot on the soma, a current clamp
   is also attached, with the intention of triggering some spikes. All of the preceding info —
-  the morphology, dynamics, spike detector and current clamp — constitute what is termed the
+  the morphology, dynamics, threshold detector and current clamp — constitute what is termed the
   **description** of the cell.
   ``Cell 0`` should be modelled as a :ref:`cable cell<modelcablecell>`,
   (because cable cells allow complex dynamics such as ``hh``). This is referred to as
diff --git a/doc/dev/communication.rst b/doc/dev/communication.rst
index 81661345..5ac1c5f3 100644
--- a/doc/dev/communication.rst
+++ b/doc/dev/communication.rst
@@ -11,7 +11,7 @@ reduced to a simple time value. The connection is abstracted into a weight and a
 delay; modelling all axonal processes. While this may seem crude, it is a well
 supported model and commonly used in neuronal simulations.
 
-Connections are formed between sources (cable cell: spike detectors) and targets
+Connections are formed between sources (cable cell: threshold detectors) and targets
 (cable cell: synapses). During runtime, events from all sources are concatenated
 on all MPI ranks using ``Allgatherv`` and targets are responsible for selecting
 events they have subscribed to. This is optimised for by sorting events locally
diff --git a/doc/dev/mechanism_abi.rst b/doc/dev/mechanism_abi.rst
index 6c866051..7fe829c9 100644
--- a/doc/dev/mechanism_abi.rst
+++ b/doc/dev/mechanism_abi.rst
@@ -177,7 +177,7 @@ fully formed to the interface. At this point:
 
   .. c:member:: arb_index_type n_detectors
 
-    Number of spike detectors
+    Number of threshold detectors
 
   .. c:member:: arb_index_type* vec_ci
 
diff --git a/doc/python/decor.rst b/doc/python/decor.rst
index f8fbc43e..bf7fe413 100644
--- a/doc/python/decor.rst
+++ b/doc/python/decor.rst
@@ -152,7 +152,7 @@ Cable cell decoration
     .. method:: place(locations, d, label)
         :noindex:
 
-        Add a voltage spike detector at each location in ``locations`` and label the group of detectors with ``label``.
+        Add a voltage threshold detector at each location in ``locations`` and label the group of detectors with ``label``.
         The label can be used to form connections from one of the detectors in the :py:class:`arbor.recipe` by creating
         a :py:class:`arbor.connection`.
 
diff --git a/doc/python/interconnectivity.rst b/doc/python/interconnectivity.rst
index 971147f7..e5c40905 100644
--- a/doc/python/interconnectivity.rst
+++ b/doc/python/interconnectivity.rst
@@ -54,10 +54,10 @@ Interconnectivity
             labels['synapse_site'] = '(location 1 0.5)'
             labels['root'] = '(root)'
 
-            # Place 'expsyn' mechanism on "synapse_site", and a spike detector at "root"
+            # Place 'expsyn' mechanism on "synapse_site", and a threshold detector at "root"
             decor = arbor.decor()
             decor.place('"synapse_site"', 'expsyn', 'syn')
-            decor.place('"root"', arbor.spike_detector(-10), 'detector')
+            decor.place('"root"', arbor.threshold_detector(-10), 'detector')
 
             # Implement the connections_on() function on a recipe as follows:
             def connections_on(gid):
@@ -104,12 +104,11 @@ Interconnectivity
 
         The unit-less weight of the gap junction connection.
 
-.. class:: spike_detector
+.. class:: threshold_detector
 
-    A spike detector, generates a spike when voltage crosses a threshold. Can be used as source endpoint for an
+    A threshold detector, generates a spike when voltage crosses a threshold. Can be used as source endpoint for an
     :class:`arbor.connection`.
 
     .. attribute:: threshold
 
-        Voltage threshold of spike detector [mV]
-
+        Voltage threshold of threshold detector [mV]
diff --git a/doc/python/simulation.rst b/doc/python/simulation.rst
index 818c7363..76531eff 100644
--- a/doc/python/simulation.rst
+++ b/doc/python/simulation.rst
@@ -232,7 +232,7 @@ spikes generated by any MPI rank.
 
 Spikes recorded during a simulation are returned as a NumPy structured datatype with two fields,
 ``source`` and ``time``. The ``source`` field itself is a structured datatype with two fields,
-``gid`` and ``index``, identifying the spike detector that generated the spike.
+``gid`` and ``index``, identifying the threshold detector that generated the spike.
 
 .. Note::
 
diff --git a/doc/tutorial/network_ring.rst b/doc/tutorial/network_ring.rst
index e7170c12..06e73c39 100644
--- a/doc/tutorial/network_ring.rst
+++ b/doc/tutorial/network_ring.rst
@@ -51,7 +51,7 @@ The synapse is given the label ``'syn'``, which is later used to form :py:class:
    (see :py:class:`arbor.mechanism`). In particular, the ``e`` parameter of ``expsyn`` defaults to ``0``, which makes it,
    given the typical resting potential of cell membranes of ``-70 mV``, an excitatory synapse.
 
-Step **(4)** places a spike detector at the ``'root'``. The detector is given the label ``'detector'``, which is later used to form
+Step **(4)** places a threshold detector at the ``'root'``. The detector is given the label ``'detector'``, which is later used to form
 :py:class:`arbor.connection` objects originating *from* the cell.
 
 .. Note::
diff --git a/doc/tutorial/single_cell_allen.rst b/doc/tutorial/single_cell_allen.rst
index 16c53748..292e2afc 100644
--- a/doc/tutorial/single_cell_allen.rst
+++ b/doc/tutorial/single_cell_allen.rst
@@ -107,7 +107,7 @@ Step **(8)** assigns the regional mechanisms.
 Now that the electro-physiology is all set up, let's move on to the experimental setup.
 
 Step **(9)** configures the :class:`stimulus <arbor.iclamp>` of 150 nA for a duration of 1 s, starting after 200 ms
-of the start of the simulation. We'll also install a :class:`arbor.spike_detector` that triggers at -40 mV. (The
+of the start of the simulation. We'll also install a :class:`arbor.threshold_detector` that triggers at -40 mV. (The
 location is usually the soma, as is confirmed by coordinates found in the experimental dataset at
 ``488683423.nwb/general/intracellular_ephys/Electrode 1/location``)
 
@@ -147,7 +147,7 @@ Then, we extract Arbor's output, accessible after the simulation ran at
     :width: 400
     :align: center
 
-    Plot of experiment 35 of the Allen model, compared to the reference generated by the AllenSDK. In green: the spike detector output; in shaded grey: the stimulus.
+    Plot of experiment 35 of the Allen model, compared to the reference generated by the AllenSDK. In green: the threshold detector output; in shaded grey: the stimulus.
 
 .. note::
 
diff --git a/doc/tutorial/single_cell_detailed.rst b/doc/tutorial/single_cell_detailed.rst
index c61ad387..d7cc8f08 100644
--- a/doc/tutorial/single_cell_detailed.rst
+++ b/doc/tutorial/single_cell_detailed.rst
@@ -281,9 +281,9 @@ mechanism has a custom 'gbar' parameter.
    :language: python
    :lines: 8,56-59
 
-The decor object is also used to *place* stimuli and spike detectors on the cell using :meth:`arbor.decor.place`.
+The decor object is also used to *place* stimuli and threshold detectors on the cell using :meth:`arbor.decor.place`.
 We place 3 current clamps of 2 nA on the "root" locset defined earlier, starting at time = 10, 30, 50 ms and
-lasting 1ms each. As well as spike detectors on the "axon_terminal" locset for voltages above -10 mV.
+lasting 1ms each. As well as threshold detectors on the "axon_terminal" locset for voltages above -10 mV.
 Every placement gets a label. The labels of detectors and synapses are used to form connection from and to them
 in the recipe.
 
@@ -385,7 +385,7 @@ The probes
 ^^^^^^^^^^
 
 The model is almost ready for simulation. Except that the only output we would be able to
-measure at this point is the spikes from the spike detectors placed in the decor.
+measure at this point is the spikes from the threshold detectors placed in the decor.
 
 The :class:`arbor.single_cell_model` can also measure the voltage on specific locations of the cell.
 We can indicate the location we would like to probe using labels from the :class:`label_dict`:
@@ -406,9 +406,9 @@ The cell and model descriptions are now complete and we can run the simulation:
 The results
 ^^^^^^^^^^^
 
-Finally we move on to the data collection segment of the example. We have added a spike detector
+Finally we move on to the data collection segment of the example. We have added a threshold detector
 on the "axon_terminal" locset. The :class:`arbor.single_cell_model` automatically registers all
-spikes on the cell from all spike detectors on the cell and saves the times at which they occurred.
+spikes on the cell from all threshold detectors on the cell and saves the times at which they occurred.
 
 .. literalinclude:: ../../python/example/single_cell_detailed.py
    :language: python
diff --git a/doc/tutorial/single_cell_model.rst b/doc/tutorial/single_cell_model.rst
index 252c596a..e0f5394f 100644
--- a/doc/tutorial/single_cell_model.rst
+++ b/doc/tutorial/single_cell_model.rst
@@ -32,7 +32,7 @@ and a current clamp stimulus, then run the model for 30 ms.
 The first step is to construct the cell. In Arbor, the abstract representation used to
 define a cell with branching cable morphology is a ``cable_cell``, which holds a
 description of the cell's morphology, named regions and locations on the morphology, and
-descriptions of ion channels, synapses, spike detectors and electrical properties.
+descriptions of ion channels, synapses, threshold detectors and electrical properties.
 
 Our *single-segment HH cell* has a simple morphology and dynamics, constructed as follows:
 
@@ -73,9 +73,9 @@ following way:
   HH dynamics on the region we previously named ``"soma"`` in our label dictionary.
 * :meth:`arbor.decor.place` is used to add objects on a precise
   :class:`arbor.location` on a cell. Examples of objects that are *placed* are synapses,
-  spike detectors, current stimuli, and probes. In the above example we place a current stimulus
+  threshold detectors, current stimuli, and probes. In the above example we place a current stimulus
   :class:`arbor.iclamp` with a duration of 2 ms and a current of 0.8 nA, starting at 10 ms
-  on the location we previously labelled ``"midpoint"``. We also place a :class:`arbor.spike_detector`
+  on the location we previously labelled ``"midpoint"``. We also place a :class:`arbor.threshold_detector`
   with a threshold of -10 mV on the same location.
 
 Step **(4)** constructs the :class:`arbor.cable_cell` from the segment tree and dictionary of labelled regions and locations.
@@ -93,7 +93,7 @@ The single cell model has 4 main functions:
 1. It holds the **global properties** of the model
 2. It registers **probes** on specific locations on the cell to measure the voltage.
 3. It **runs** the simulation.
-4. It collects **spikes** from spike detectors and voltage **traces** from registered probes.
+4. It collects **spikes** from threshold detectors and voltage **traces** from registered probes.
 
 Right now, we'll only set a probe and run the simulation.
 
@@ -115,7 +115,7 @@ The results
 -----------
 
 Our cell and model have been defined and we have run our simulation. Now we can look at what
-the spike detector and a voltage probes from our model have produced.
+the threshold detector and a voltage probes from our model have produced.
 
 .. literalinclude:: ../../python/example/single_cell_model.py
    :language: python
diff --git a/python/cells.cpp b/python/cells.cpp
index 9ac0a32d..6baa9498 100644
--- a/python/cells.cpp
+++ b/python/cells.cpp
@@ -577,8 +577,15 @@ void register_cells(pybind11::module& m) {
             return util::pprintf("<arbor.iclamp: frequency {} Hz>", c.frequency);});
 
     // arb::threshold_detector
-
-    pybind11::class_<arb::threshold_detector> detector(m, "spike_detector",
+    struct spike_detector {};
+    pybind11::class_<spike_detector> sd(m, "spike_detector", "Deprecated, please use 'threshold_detector'");
+    sd.def(pybind11::init(
+               [](pybind11::object) -> spike_detector {
+                   throw arb::arbor_exception{"Deprecated, please use 'threshold_detector' instead."};
+                   return {}; // unreachable
+               }));
+
+    pybind11::class_<arb::threshold_detector> detector(m, "threshold_detector",
             "A spike detector, generates a spike when voltage crosses a threshold. Can be used as source endpoint for an arbor.connection.");
     detector
         .def(pybind11::init(
diff --git a/python/example/gap_junctions.py b/python/example/gap_junctions.py
index 2f93e224..dcdbbfa5 100644
--- a/python/example/gap_junctions.py
+++ b/python/example/gap_junctions.py
@@ -51,8 +51,8 @@ def make_cable_cell(gid):
         # Attach one synapse and gap junction each on their labeled sites
         .place('"synapse_site"', arbor.synapse("expsyn"), "syn")
         .place('"gj_site"', arbor.junction("gj"), "gj")
-        # Attach spike detector to cell root
-        .place('"root"', arbor.spike_detector(-10), "detector")
+        # Attach detector to cell root
+        .place('"root"', arbor.threshold_detector(-10), "detector")
     )
 
     return arbor.cable_cell(tree, labels, decor)
diff --git a/python/example/network_ring.py b/python/example/network_ring.py
index 60131310..3e0f3de6 100755
--- a/python/example/network_ring.py
+++ b/python/example/network_ring.py
@@ -64,8 +64,8 @@ def make_cable_cell(gid):
         .paint('"soma"', arbor.density("hh")).paint('"dend"', arbor.density("pas"))
         # (4) Attach a single synapse.
         .place('"synapse_site"', arbor.synapse("expsyn"), "syn")
-        # Attach a spike detector with threshold of -10 mV.
-        .place('"root"', arbor.spike_detector(-10), "detector")
+        # Attach a detector with threshold of -10 mV.
+        .place('"root"', arbor.threshold_detector(-10), "detector")
     )
 
     return arbor.cable_cell(tree, labels, decor)
diff --git a/python/example/network_ring_gpu.py b/python/example/network_ring_gpu.py
index 3d071d16..61b7be3e 100644
--- a/python/example/network_ring_gpu.py
+++ b/python/example/network_ring_gpu.py
@@ -66,8 +66,8 @@ def make_cable_cell(gid):
     # (4) Attach a single synapse.
     decor.place('"synapse_site"', arbor.synapse("expsyn"), "syn")
 
-    # Attach a spike detector with threshold of -10 mV.
-    decor.place('"root"', arbor.spike_detector(-10), "detector")
+    # Attach a detector with threshold of -10 mV.
+    decor.place('"root"', arbor.threshold_detector(-10), "detector")
 
     cell = arbor.cable_cell(tree, labels, decor)
 
diff --git a/python/example/network_ring_mpi.py b/python/example/network_ring_mpi.py
index 6892a498..dc1b0d2c 100644
--- a/python/example/network_ring_mpi.py
+++ b/python/example/network_ring_mpi.py
@@ -66,8 +66,8 @@ def make_cable_cell(gid):
         .paint('"soma"', arbor.density("hh")).paint('"dend"', arbor.density("pas"))
         # (4) Attach a single synapse.
         .place('"synapse_site"', arbor.synapse("expsyn"), "syn")
-        # Attach a spike detector with threshold of -10 mV.
-        .place('"root"', arbor.spike_detector(-10), "detector")
+        # Attach a detector with threshold of -10 mV.
+        .place('"root"', arbor.threshold_detector(-10), "detector")
     )
 
     return arbor.cable_cell(tree, labels, decor)
diff --git a/python/example/plasticity.py b/python/example/plasticity.py
index ee20edcc..ba4c2099 100644
--- a/python/example/plasticity.py
+++ b/python/example/plasticity.py
@@ -54,7 +54,7 @@ class recipe(A.recipe):
         #   - synapse to receive incoming spikes from the source cell.
         decor.place("(location 0 0.5)", A.synapse("expsyn"), "synapse")
         #   - detector for reporting spikes on the cable cells.
-        decor.place("(location 0 0.5)", A.spike_detector(-10.0), "detector")
+        decor.place("(location 0 0.5)", A.threshold_detector(-10.0), "detector")
         # return the cable cell description
         return A.cable_cell(tree, A.label_dict(), decor)
 
diff --git a/python/example/single_cell_allen.py b/python/example/single_cell_allen.py
index 359b62e2..1296a29b 100644
--- a/python/example/single_cell_allen.py
+++ b/python/example/single_cell_allen.py
@@ -107,9 +107,9 @@ def make_cell(swc, fit):
             else:
                 vs[k] = v
         decor.paint(f'"{region}"', arbor.density(arbor.mechanism(nm, vs)))
-    # (9) attach stimulus and spike detector
+    # (9) attach stimulus and detector
     decor.place('"midpoint"', arbor.iclamp(200, 1000, 0.15), "ic")
-    decor.place('"midpoint"', arbor.spike_detector(-40), "sd")
+    decor.place('"midpoint"', arbor.threshold_detector(-40), "sd")
     # (10) discretisation strategy: max compartment length
     decor.discretization(arbor.cv_policy_max_extent(20))
 
diff --git a/python/example/single_cell_detailed.py b/python/example/single_cell_detailed.py
index b9f85fd9..37873eba 100755
--- a/python/example/single_cell_detailed.py
+++ b/python/example/single_cell_detailed.py
@@ -57,11 +57,11 @@ decor.paint('"soma"', Vm=-50)
 decor.paint('"all"', density("pas"))
 decor.paint('"custom"', density("hh"))
 decor.paint('"dend"', density("Ih", {"gbar": 0.001}))
-# Place stimuli and spike detectors.
+# Place stimuli and detectors.
 decor.place('"root"', arbor.iclamp(10, 1, current=2), "iclamp0")
 decor.place('"root"', arbor.iclamp(30, 1, current=2), "iclamp1")
 decor.place('"root"', arbor.iclamp(50, 1, current=2), "iclamp2")
-decor.place('"axon_terminal"', arbor.spike_detector(-10), "detector")
+decor.place('"axon_terminal"', arbor.threshold_detector(-10), "detector")
 # Set discretisation: Soma as one CV, 1um everywhere else
 decor.discretization('(replace (single (region "soma")) (max-extent 1.0))')
 
diff --git a/python/example/single_cell_detailed_recipe.py b/python/example/single_cell_detailed_recipe.py
index 4443b9f3..ac01e73a 100644
--- a/python/example/single_cell_detailed_recipe.py
+++ b/python/example/single_cell_detailed_recipe.py
@@ -56,11 +56,11 @@ decor = (
     .paint('"all"', density("pas"))
     .paint('"custom"', density("hh"))
     .paint('"dend"', density("Ih", {"gbar": 0.001}))
-    # Place stimuli and spike detectors.
+    # Place stimuli and detectors.
     .place('"root"', arbor.iclamp(10, 1, current=2), "iclamp0")
     .place('"root"', arbor.iclamp(30, 1, current=2), "iclamp1")
     .place('"root"', arbor.iclamp(50, 1, current=2), "iclamp2")
-    .place('"axon_terminal"', arbor.spike_detector(-10), "detector")
+    .place('"axon_terminal"', arbor.threshold_detector(-10), "detector")
     # Set discretisation: Soma as one CV, 1um everywhere else
     .discretization('(replace (single (region "soma")) (max-extent 1.0))')
 )
diff --git a/python/example/single_cell_model.py b/python/example/single_cell_model.py
index 28d52b1c..229862ab 100755
--- a/python/example/single_cell_model.py
+++ b/python/example/single_cell_model.py
@@ -19,7 +19,7 @@ decor = (
     .set_property(Vm=-40)
     .paint('"soma"', arbor.density("hh"))
     .place('"midpoint"', arbor.iclamp(10, 2, 0.8), "iclamp")
-    .place('"midpoint"', arbor.spike_detector(-10), "detector")
+    .place('"midpoint"', arbor.threshold_detector(-10), "detector")
 )
 
 # (4) Create cell and the single cell model based on it
diff --git a/python/example/single_cell_nml.py b/python/example/single_cell_nml.py
index 7e0f63fe..0061e72b 100755
--- a/python/example/single_cell_nml.py
+++ b/python/example/single_cell_nml.py
@@ -63,7 +63,7 @@ decor = (
     .place('"stim_site"', arbor.iclamp(10, 1, current=0.5), "iclamp2")
     .place('"stim_site"', arbor.iclamp(8, 1, current=4), "iclamp3")
     # Detect spikes at the soma with a voltage threshold of -10 mV.
-    .place('"axon_end"', arbor.spike_detector(-10), "detector")
+    .place('"axon_end"', arbor.threshold_detector(-10), "detector")
     # Set discretisation: Soma as one CV, 1um everywhere else
     .discretization('(replace (single (region "soma")) (max-extent 1.0))')
 )
diff --git a/python/example/single_cell_recipe.py b/python/example/single_cell_recipe.py
index 315d0a08..6b780009 100644
--- a/python/example/single_cell_recipe.py
+++ b/python/example/single_cell_recipe.py
@@ -23,7 +23,7 @@ decor = (
     .set_property(Vm=-40)
     .paint('"soma"', arbor.density("hh"))
     .place('"midpoint"', arbor.iclamp(10, 2, 0.8), "iclamp")
-    .place('"midpoint"', arbor.spike_detector(-10), "detector")
+    .place('"midpoint"', arbor.threshold_detector(-10), "detector")
 )
 
 cell = arbor.cable_cell(tree, labels, decor)
diff --git a/python/example/single_cell_stdp.py b/python/example/single_cell_stdp.py
index 4330b9c2..a2079748 100755
--- a/python/example/single_cell_stdp.py
+++ b/python/example/single_cell_stdp.py
@@ -32,7 +32,7 @@ class single_recipe(arbor.recipe):
             arbor.decor()
             .set_property(Vm=-40)
             .paint("(all)", arbor.density("hh"))
-            .place('"center"', arbor.spike_detector(-10), "detector")
+            .place('"center"', arbor.threshold_detector(-10), "detector")
             .place('"center"', arbor.synapse("expsyn"), "synapse")
             .place(
                 '"center"',
diff --git a/python/example/single_cell_swc.py b/python/example/single_cell_swc.py
index aa0e2df7..43e76cdb 100755
--- a/python/example/single_cell_swc.py
+++ b/python/example/single_cell_swc.py
@@ -52,7 +52,7 @@ decor = (
     .place('"stim_site"', arbor.iclamp(10, 1, current=0.5), "iclamp2")
     .place('"stim_site"', arbor.iclamp(8, 1, current=4), "iclamp3")
     # Detect spikes at the soma with a voltage threshold of -10 mV.
-    .place('"axon_end"', arbor.spike_detector(-10), "detector")
+    .place('"axon_end"', arbor.threshold_detector(-10), "detector")
     # Create the policy used to discretise the cell into CVs.
     # Use a single CV for the soma, and CVs of maximum length 1 μm elsewhere.
     .discretization('(replace (single (region "soma")) (max-extent 1.0))')
diff --git a/python/test/fixtures.py b/python/test/fixtures.py
index 1e82a8b0..72633215 100644
--- a/python/test/fixtures.py
+++ b/python/test/fixtures.py
@@ -206,7 +206,7 @@ class art_spiker_recipe(arbor.recipe):
         decor.set_property(Vm=-40)
         decor.paint('"soma"', arbor.density("hh"))
         decor.place('"midpoint"', arbor.iclamp(10, 2, 0.8), "iclamp")
-        decor.place('"midpoint"', arbor.spike_detector(-10), "detector")
+        decor.place('"midpoint"', arbor.threshold_detector(-10), "detector")
 
         # return tuple of tree, labels, and decor for creating a cable cell (can still be modified before calling arbor.cable_cell())
         return tree, labels, decor
-- 
GitLab