.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/single/coupling.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_single_coupling.py: Coupling ======== This example demonstrates the process of computing the coupling efficiency of a scatterer to a detector using PyMieSim. .. GENERATED FROM PYTHON SOURCE LINES 7-66 .. rst-class:: sphx-glr-script-out .. code-block:: none Side coupling: 0.00671894873114585 watt Forward coupling: 2.2586562867587188 watt Ratio: 0.2974754844522124 dimensionless % | .. code-block:: Python from PyMieSim.units import ureg from PyMieSim.single.source import Gaussian from PyMieSim.polarization import PolarizationState from PyMieSim.single.scatterer import Sphere from PyMieSim.single.detector import Photodiode, IntegratingSphere from PyMieSim.single.setup import Setup polarization = PolarizationState(angle=30 * ureg.degree) source = Gaussian( wavelength=1000 * ureg.nanometer, polarization=polarization, optical_power=1 * ureg.watt, numerical_aperture=0.3, ) scatterer = Sphere( diameter=1500 * ureg.nanometer, material=1.45, medium=1.0, ) # First detector side_detector = Photodiode( numerical_aperture=0.3, phi_offset=90 * ureg.degree, gamma_offset=0 * ureg.degree, sampling=1000 ) setup = Setup( scatterer=scatterer, source=source, detector=side_detector ) side_coupling = setup.get("coupling") # Second detector forward_detector = IntegratingSphere( sampling=1000 ) setup = Setup( scatterer=scatterer, source=source, detector=forward_detector ) forward_coupling = setup.get("coupling") print(f"Side coupling: {side_coupling} \n Forward coupling: {forward_coupling} \n Ratio: {side_coupling / forward_coupling * 100} %") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.041 seconds) .. _sphx_glr_download_gallery_single_coupling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: coupling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: coupling.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: coupling.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_