.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/hello_wfs.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_auto_examples_hello_wfs.py: Hello wavefront shaping =============================================== This script demonstrates how to use OpenWFS to perform a simple wavefront shaping experiment. To run this script, you need to have a GenICam-compatible camera connected to your computer, and a spatial light modulator (SLM) connected to the secondary video output. .. GENERATED FROM PYTHON SOURCE LINES 10-34 .. code-block:: Python import numpy as np from openwfs.algorithms import StepwiseSequential from openwfs.devices import SLM, Camera from openwfs.processors import SingleRoi # Display the SLM patterns on the secondary monitor slm = SLM(monitor_id=2) # Connect to a GenICam camera, average pixels to get feedback signal camera = Camera(R"C:\Program Files\Basler\pylon 7\Runtime\x64\ProducerU3V.cti") feedback = SingleRoi(camera, pos=(320, 320), mask_type="disk", radius=2.5) # Run the algorithm alg = StepwiseSequential(feedback=feedback, slm=slm, n_x=10, n_y=10, phase_steps=4) result = alg.execute() # Measure intensity with flat and shaped wavefronts slm.set_phases(0) before = feedback.read() slm.set_phases(-np.angle(result.t)) after = feedback.read() print(f"Intensity in the target increased from {before} to {after}") .. _sphx_glr_download_auto_examples_hello_wfs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: hello_wfs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: hello_wfs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: hello_wfs.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_