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.

  • signal_processing (SignalProcessing) – An instance of the SignalProcessing class, which handles the processing of analog and digital signals.

  • 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, event_collection)[source]#

Simulates the complete analog optical response generated by all detected particle events.

This function builds the full analog waveform that emerges from the optical and opto electronic chain of the cytometer. It proceeds in three major stages:

1. Optical domain - Creates an optical power time series for each detector - For explicit sampling models, generates Gaussian shaped pulses directly - For gamma models, draws a gamma distributed power trace that matches the

expected total particle contribution and optionally smooths it with a Gaussian convolution

  • Adds the constant background optical power

2. Conversion to photocurrent - Converts optical power to photocurrent using the detector responsivity

and the illumination wavelength

  • Applies bandwidth dependent effects from the digitizer

3. Current domain to voltage domain - Adds optional dark current noise when enabled in simulation settings - Passes all photocurrents through the analog amplifier model - Applies final analog conditioning and filtering steps

The output is returned as an AcquisitionDataFrame, which contains voltage waveforms for all detectors on a shared time base, formatted with a clear multi level index.

Parameters:
  • run_time (Time) – Total simulated duration of the acquisition

  • event_collection (pandas.DataFrame) – Collection of detected particle events, where each entry contains the event time, width, amplitude, velocity, and sampling method

Returns:

Structured representation of the final analog voltage signals for all detectors, including the time axis and processed analog waveforms

Return type:

AcquisitionDataFrame

Raises:

ValueError – If required event fields are missing, including Sigmas or Time for explicit pulse generation

generate_event_collection(**kwargs)#
run(run_time)[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