FlowCytometer#

Classes related to the overall configuration of a flow cytometry system.

class FlowCytometer(**kwargs)[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.

Raises:

AssertionError – If the number of detectors provided is not exactly two, or if both detectors share the same name.

compute_analog(run_time, events)[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’).

Parameters:
  • run_time (Time)

  • events (DataFrame)

compute_events(run_record, 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_record (RunRecord) – The RunRecord instance containing the run time for the simulation.

  • compute_cross_section (bool, optional) – Whether to compute the scattering cross-section for each event. Default is False.

Returns:

A DataFrame containing event data for the scatterers.

Return type:

pd.DataFrame

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 (Time) – Duration of the simulated acquisition (e.g., 1.0 * ureg.millisecond).

  • compute_cross_section (bool, optional) – Whether to compute the scattering cross-section for each event. Default is False.

Returns:

Simulation output containing all analog, digital, and peak-level data.

Return type:

RunRecord