FlowCytometer#
Classes related to the overall configuration of a flow cytometry system.
- class FlowCytometer(opto_electronics, fluidics, signal_processing, background_power=<Quantity(0, 'milliwatt')>)[source]#
Bases:
object
A simulation class for modeling flow cytometer signals, including Forward Scatter (FSC) and Side Scatter (SSC) channels.
The FlowCytometer class integrates optical and flow dynamics to simulate signal generation in a flow cytometer. It handles particle distributions, flow cell properties, laser source configurations, and detector behavior to replicate realistic cytometry conditions. This includes the generation of synthetic signal pulses for each particle event and noise modeling for accurate signal representation.
- Parameters:
opto_electronics (OptoElectronics) – An instance of the OptoElectronics class, which contains the configuration of detectors, digitizer, source, and amplifier.
fluidics (Fluidics) – An instance of the Fluidics class, which manages the flow cell and scatterer collection.
background_power (pint.Quantity, optional) – The background power level in the system, defaulting to 0 mW. This represents the constant background signal that is present in the system, which can affect the detection of actual signals.
signal_processing (SignalProcessing)
- Raises:
AssertionError – If the number of detectors provided is not exactly two, or if both detectors share the same name.
- compute_analog()[source]#
Simulates the analog optical signal response for all detected events.
This method generates Gaussian-shaped optical pulses based on particle event data (time, width, amplitude), adds background optical power, and propagates the resulting signal through the detector chain: - Optical power → photocurrent → amplified voltage - Includes optional noise models (e.g., dark current) - Final output is voltage signals stored in an AcquisitionDataFrame
- Returns:
Structured DataFrame representing the multi-detector analog voltage signals.
- Return type:
AcquisitionDataFrame
- Raises:
ValueError – If the event DataFrame is missing required columns (‘Widths’, ‘Time’).
- compute_events(compute_cross_section=False)[source]#
Generates a DataFrame of events based on the scatterer collection and flow cell properties.
This method samples particle events from the fluidics system and prepares a DataFrame containing the event times, positions, and other relevant properties.
- Parameters:
run_time (pint.Quantity) – The duration of the acquisition in seconds.
compute_cross_section (bool)
- Returns:
A DataFrame containing event data for the scatterers.
- Return type:
pd.DataFrame
- compute_peaks()[source]#
Runs the triggering system and extracts signal segments corresponding to detected events.
The method identifies regions in the analog voltage signals where the threshold condition is met (based on triggering_system). It then digitizes the triggered signal segments and applies peak detection, if configured.
- Returns:
The internal results object populated with: - triggered_analog_acquisition - digital_acquisition - peaks (if peak_algorithm is provided)
- Return type:
Result
- initialize(run_time)[source]#
Initializes the flow cytometer simulation.
- Parameters:
run_time (pint.Quantity) – The duration of the acquisition in seconds.
- Returns:
An instance of the Result class containing initialization data.
- Return type:
Result
- run(run_time, compute_cross_section=False)[source]#
Runs a complete flow cytometry simulation for the specified acquisition duration.
The pipeline includes: 1. Initialization and setup of fluidic/optical components 2. Particle event simulation and optical signal generation 3. Analog and digital signal processing 4. Triggered signal extraction and peak feature detection
- Parameters:
run_time (Quantity) – Duration of the simulated acquisition (e.g., 1.0 * units.millisecond).
compute_cross_section (bool)
- Returns:
Simulation output containing all analog, digital, and peak-level data.
- Return type:
Result