Digital processing#
The FlowCyPy.digital_processing package defines the digital analysis stage applied to sampled detector traces.
It is responsible for isolating candidate events from continuous signals and extracting numerical features from each detected segment.
In a typical workflow, the digitized waveforms are first segmented by a discriminator and then summarized by a peak locator.
The typical workflow is:
define a discriminator to extract relevant signal segments
define a peak locator to compute event features within each segment
combine both into a
FlowCyPy.digital_processing.DigitalProcessingobject
This configuration is then passed to the cytometer processing pipeline to transform raw sampled traces into event level measurements.
Digital processing configuration#
The FlowCyPy.digital_processing.DigitalProcessing class groups the discriminator and peak extraction algorithm into a single processing configuration.
- class DigitalProcessing(discriminator=None, peak_algorithm=None)[source]#
Bases:
objectContainer for analog and digital signal processing stages in a simulated flow cytometry pipeline.
This class orchestrates the application of analog electronic filtering, digitization, triggering, and peak detection algorithms. It integrates key building blocks of the signal acquisition chain in a modular and extensible way.
- Parameters:
discriminator (discriminator.BaseDiscriminator) – Component responsible for extracting signal segments based on threshold-crossing or window-based logic applied to the analog signal.
peak_algorithm (peak_locator.BasePeakLocator) – Peak detection algorithm that locates and characterizes peaks in the digitized signal (e.g., based on amplitude, area, or width).
Discriminators#
Discriminators are responsible for selecting relevant signal segments from continuous detector traces.
They define the criteria used to initiate and terminate event windows, typically through threshold crossings, buffered extraction, or dual threshold logic.
These classes isolate candidate particle events prior to feature extraction.
Fixed window#
The fixed window discriminator extracts segments using a fixed length window around each threshold crossing or trigger condition.
It is useful when a constant event support is desired for all detected segments.
- class FixedWindow#
Bases:
BaseDiscriminator- run(self: FlowCyPy.digital_processing.discriminator.FixedWindow) None#
Execute fixed window trigger detection.
- property threshold#
Threshold object storing the symbolic expression and resolved numeric value.
Dynamic window#
The dynamic window discriminator defines segment boundaries from the signal itself.
It supports threshold based extraction with configurable pre and post buffering and is useful when event duration varies across the dataset.
- class DynamicWindow#
Bases:
BaseDiscriminator- run(self: FlowCyPy.digital_processing.discriminator.DynamicWindow) None#
Execute dynamic window trigger detection.
- property threshold#
Threshold object storing the symbolic expression and resolved numeric value.
Double threshold#
The double threshold discriminator uses separate start and stop criteria.
This is useful when more stable event opening and closing behavior is needed, especially in noisy traces or when hysteresis is desirable.
- class DoubleThreshold#
Bases:
BaseDiscriminator- property lower_threshold#
Threshold object storing the symbolic expression and resolved numeric value.
- run(self: FlowCyPy.digital_processing.discriminator.DoubleThreshold) None#
Execute double threshold trigger detection.
- set_debounce_enabled(self: FlowCyPy.digital_processing.discriminator.DoubleThreshold, debounce_enabled: bool) None#
Update debounce behavior after construction.
- set_min_window_duration(self: FlowCyPy.digital_processing.discriminator.DoubleThreshold, min_window_duration: SupportsInt | SupportsIndex) None#
Update minimum window duration after construction.
- property threshold#
Threshold object storing the symbolic expression and resolved numeric value.
Peak locators#
Peak locators compute numerical descriptors from each segmented event.
Typical outputs include peak position, peak height, width, area, or other summary metrics derived from the extracted waveform support.
Different algorithms can be used depending on whether the goal is global maximum extraction, local peak detection, or more specialized pulse analysis.
Global peak locator#
The global peak locator identifies the dominant peak within each event segment and computes summary features from that support.
- class GlobalPeakLocator#
Bases:
BasePeakLocatorGlobal peak detector for 1D signals.
This locator identifies a single event over the full signal, then measures its amplitude according to configurable polarity, height, and baseline conventions.
Width and area semantics are controlled by the supplied support object.
- property baseline_mode#
Baseline convention used by baseline-aware measurement modes.
- property height_mode#
Height measurement mode used for the reported event amplitude.
- property polarity#
Measurement polarity used to select the event sample.
Sliding window peak locator#
The sliding window peak locator searches for peaks using a moving support window.
It is useful when feature extraction should be tied to localized signal structure rather than the full event segment.
- class SlidingWindowPeakLocator#
Bases:
BasePeakLocatorSliding window peak detector for 1D signals.
One local maximum is extracted per window. The resulting peaks are sorted by descending height, and the strongest peaks are returned in fixed-size output arrays.
Width and area semantics are controlled by the supplied support object.
Example#
The example below shows a typical digital processing configuration using a fixed window discriminator and a global peak locator.
from FlowCyPy.digital_processing import (
DigitalProcessing,
peak_locator,
discriminator,
)
triggering = discriminator.FixedWindow(
trigger_channel="side",
threshold="4sigma",
pre_buffer=40,
post_buffer=40,
max_triggers=-1,
)
peak_algorithm = peak_locator.GlobalPeakLocator()
digital_processing = DigitalProcessing(
discriminator=triggering,
peak_algorithm=peak_algorithm,
)