hologradpy.calibrate_slm ======================== .. py:module:: hologradpy.calibrate_slm .. autoapi-nested-parse:: Module to measure the constant amplitude and phase at the SLM. Functions --------- .. autoapisummary:: hologradpy.calibrate_slm.find_camera_position hologradpy.calibrate_slm.get_aperture_indices hologradpy.calibrate_slm.measure_slm_intensity hologradpy.calibrate_slm.measure_slm_wavefront Module Contents --------------- .. py:function:: find_camera_position(slm_disp_obj, cam_obj, pms_obj, lin_phase, exp_time=100, aperture_diameter=25, roi=[500, 500]) This function generates a spot on the camera by displaying a circular aperture on the SLM containing a linear phase gradient. The position of the spot is found by fitting a Gaussian to the camera image. :param slm_disp_obj: Instance of your own subclass of ``hardware.SlmBase`` :param cam_obj: :param pms_obj: :param npix: Number of used SLM pixels :param lin_phase: x and y gradient of the linear phase :param cam_name: Name of the camera to be used :param exp_time: Exposure time :param aperture_diameter: Diameter of the circular aperture :param roi: Width and height of the region of interest on the camera to remove the zeroth-order diffraction spot :return: x and y coordinates of the spot on the camera .. py:function:: get_aperture_indices(nx, ny, x_start, x_stop, y_start, y_stop, aperture_width, aperture_height) This function calculates a grid of ``nx * ny`` rectangular regions in an array and returns the start and end indices of each region. All units are in pixels. :param nx: Number of rectangles along x. :param ny: Number of rectangles along y. :param x_start: Start index for first rectangle along x. :param x_stop: End index for last rectangle along x. :param y_start: Start index for first rectangle along y. :param y_stop: End index for last rectangle along y. :param aperture_width: Width of rectangle. :param aperture_height: Height of rectangle. :return: List with four entries for the start and end index along x and y: [idx_start_y, idx_end_y, idx_start_x, idx_end_x]. Each list entry is a vector of length ``nx * ny`` containing the start/end index for each rectangle along x/y. .. py:function:: measure_slm_intensity(slm_disp_obj, cam_obj, pms_obj, aperture_number, aperture_width, exp_time, spot_pos, roi_width) This function measures the intensity profile of the laser beam incident onto the SLM by displaying a sequence of rectangular phase masks on the SLM. The phase mask contains a linear phase which creates a diffraction spot on the camera. The position of the phase mask is varied across the entire area of the SLM and the intensity of each diffraction spot is measured using the camera. Read the SI of https://doi.org/10.1038/s41598-023-30296-6 for details. :param slm_disp_obj: Instance of your own subclass of ``hardware.SlmBase``. :param cam_obj: Instance of your own subclass of ``hardware.CameraBase``. :param aperture_number: Number of square regions along x/ y. :param aperture_width: Width of square regions [px]. :param exp_time: Exposure time. :param spot_pos: x/y position of the diffraction spot in th computational Fourier plane [Fourier pixels]. :param roi_width: Width of the region of interest on the camera [camera pixels]. :return: .. py:function:: measure_slm_wavefront(slm_disp_obj, cam_obj, pms_obj, aperture_number, aperture_width, img_size, exp_time, spot_pos, n_avg_frames=10, benchmark=False, phi_load_path=None, roi_min_x=16, roi_min_y=16, roi_n=8) This function measures the constant phase at the SLM by displaying a sequence of rectangular phase masks on the SLM. This scheme was adapted from this Phillip Zupancic's work (https://doi.org/10.1364/OE.24.013881). For details of our implementation, read the SI of https://doi.org/10.1038/s41598-023-30296-6. :param slm_disp_obj: Instance of your own subclass of ``hardware.SlmBase``. :param cam_obj: Instance of your own subclass of ``hardware.CameraBase``. :param pms_obj: Instance of your own subclass of ``hardware.Parameters``. :param aperture_number: Number of square regions along x/ y. :param aperture_width: Width of square regions [px]. :param img_size: Width of the roi in the camera image [camera pixels]. :param exp_time: Exposure time. :param spot_pos: x/y position of the diffraction spot in th computational Fourier plane [Fourier pixels]. :param n_avg_frames: Number of camera frames to average per shot. :param bool benchmark: Load previously measured constant phase and display it on the SLM to check for flatness. :param phi_load_path: Path to previously measured constant phase. :param roi_min_x: Aperture column number to display the first phase mask. :param roi_min_y: Aperture row number to display the first phase mask. :param roi_n: Number of apertures to display (roi_n * roi_n), starting at roi_min_x, roi_min_y. :return: Path to measured constant phase at the SLM.