Analog Event Threshold

Overview

This transform detects moments in time (events) when an analog signal crosses a specified value, which is useful for identifying significant occurrences in the data.

Detailed Description

Thresholding is a fundamental method for event detection in time-series data. This operation identifies every point in time where the signal’s amplitude crosses a defined threshold in a specific direction (either rising above it, falling below it, or crossing it in either direction).

A “lockout” period can also be set. After an event is detected, the algorithm will ignore any further threshold crossings for the duration of this period, which helps prevent a single, noisy event from being counted multiple times.

This transform takes an analog time series as input and produces a digital event series as output, where each event corresponds to a single point in time when a threshold crossing was detected.

Neuroscience Use Cases

In neuroscience, thresholding is a common technique for identifying meaningful events in continuous data streams:

  • Spike Detection: In extracellular recordings, thresholding can be used to identify action potentials (spikes) that stand out from the background noise. A lockout time is critical here to avoid detecting the same spike multiple times as it repolarizes.
  • Behavioral Event Marking: For data from sensors like accelerometers or force transducers, thresholding can mark the onset of specific behaviors, such as a mouse starting to run on a wheel or a bird pecking a key.
  • Calcium Imaging Analysis: In calcium imaging data, which reflects neural activity, thresholding can be used to detect significant calcium transients that indicate a neuron or a group of neurons are firing.

Parameters

This transform has the following parameters:

  • threshold_value: The amplitude value the signal must cross to be considered an event.
  • direction: Specifies the direction of the crossing required to trigger an event. This can be:
    • Positive (Rising): An event is detected when the signal crosses the threshold from a lower to a higher value.
    • Negative (Falling): An event is detected when the signal crosses the threshold from a higher to a lower value.
    • Absolute: An event is detected whenever the absolute value of the signal crosses the threshold value (useful for detecting deviations from baseline in either direction).
  • lockout_time: A duration (in the same time units as the data, e.g., seconds) after each detected event during which no new events will be registered. This is useful for preventing multiple detections of a single, noisy event.

Example Configuration

Here is a complete example of a JSON configuration file that could be used to run this transformation. This example detects events where the signal rises above an amplitude of 1.0, with no lockout period.

[
{
    "transformations": {
        "metadata": {
            "name": "Threshold Detection Pipeline",
            "description": "Test threshold event detection on analog signal",
            "version": "1.0"
        },
        "steps": [
            {
                "step_id": "1",
                "transform_name": "Analog Event Threshold",
                "phase": "analysis",
                "input_key": "test_signal",
                "output_key": "detected_events",
                "parameters": {
                    "threshold_value": 1.0,
                    "direction": "Positive",
                    "lockout_time": 0.0
                }
            }
        ]
    }
}
]