.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/tutorials/pre_defined_workflow.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_tutorials_pre_defined_workflow.py: Workflow ======== This tutorial demonstrates how to simulate a flow cytometry experiment using the FlowCyPy library. The simulation involves configuring a flow setup, defining a single population of particles, and analyzing scattering signals from two detectors to produce a 2D density plot of scattering intensities. Overview: --------- 1. Configure the flow cell and particle population. 2. Define the laser source and detector parameters. 3. Simulate the flow cytometry experiment. 4. Analyze the generated signals and visualize results. .. GENERATED FROM PYTHON SOURCE LINES 19-23 Step 0: Import Necessary Libraries ----------------------------------- Here, we import the necessary libraries and units for the simulation. The units module helps us define physical quantities like meters, seconds, and watts in a concise and consistent manner. .. GENERATED FROM PYTHON SOURCE LINES 23-95 .. code-block:: Python from FlowCyPy import units from FlowCyPy import GaussianBeam from FlowCyPy.flow_cell import FlowCell from FlowCyPy import ScattererCollection from FlowCyPy.population import Exosome, HDL from FlowCyPy.detector import PMT from FlowCyPy.signal_digitizer import SignalDigitizer from FlowCyPy import FlowCytometer, TransimpedanceAmplifier source = GaussianBeam( numerical_aperture=0.3 * units.AU, # Numerical aperture wavelength=200 * units.nanometer, # Wavelength optical_power=20 * units.milliwatt # Optical power ) flow_cell = FlowCell( sample_volume_flow=0.02 * units.microliter / units.second, sheath_volume_flow=0.1 * units.microliter / units.second, width=20 * units.micrometer, height=10 * units.micrometer, ) scatterer_collection = ScattererCollection(medium_refractive_index=1.33 * units.RIU) # Add an Exosome and HDL population scatterer_collection.add_population( Exosome(particle_count=5e9 * units.particle / units.milliliter), HDL(particle_count=5e9 * units.particle / units.milliliter) ) scatterer_collection.dilute(factor=1) # Initialize the scatterer with the flow cell df = scatterer_collection.get_population_dataframe(total_sampling=600, use_ratio=False) # Visualize the particle population df.plot(x='Diameter', bins='auto') digitizer = SignalDigitizer( bit_depth='14bit', saturation_levels='auto', sampling_rate=60 * units.megahertz, ) detector_0 = PMT(name='forward', phi_angle=0 * units.degree, numerical_aperture=0.3 * units.AU) detector_1 = PMT(name='side', phi_angle=90 * units.degree, numerical_aperture=0.3 * units.AU) transimpedance_amplifier = TransimpedanceAmplifier( gain=100 * units.volt / units.ampere, bandwidth = 10 * units.megahertz ) cytometer = FlowCytometer( source=source, transimpedance_amplifier=transimpedance_amplifier, scatterer_collection=scatterer_collection, digitizer=digitizer, detectors=[detector_0, detector_1], flow_cell=flow_cell, background_power=0.001 * units.milliwatt ) # Run the flow cytometry simulation cytometer.prepare_acquisition(run_time=0.1 * units.millisecond) cytometer.scatterer_dataframe.plot( x='side', y='forward', z='RefractiveIndex' ) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /gallery/tutorials/images/sphx_glr_pre_defined_workflow_001.png :alt: Distribution of Diameter :srcset: /gallery/tutorials/images/sphx_glr_pre_defined_workflow_001.png :class: sphx-glr-multi-img * .. image-sg:: /gallery/tutorials/images/sphx_glr_pre_defined_workflow_002.png :alt: Scatterer Sampling Distribution :srcset: /gallery/tutorials/images/sphx_glr_pre_defined_workflow_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none /opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/site-packages/FlowCyPy/source.py:269: UserWarning: Transverse distribution of particle flow exceed the waist of the source warnings.warn('Transverse distribution of particle flow exceed the waist of the source') /opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/site-packages/FlowCyPy/source.py:269: UserWarning: Transverse distribution of particle flow exceed the waist of the source warnings.warn('Transverse distribution of particle flow exceed the waist of the source')
.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.568 seconds) .. _sphx_glr_download_gallery_tutorials_pre_defined_workflow.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: pre_defined_workflow.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: pre_defined_workflow.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: pre_defined_workflow.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_