This project provides Python toolkits for controlling Spatial Light Modulators (SLMs) and synchronized camera acquisition.
It enables both wavefront sensing and Look-Up Table (LUT)-based corrections through pupil segmentation techniques.
This module generates and manipulates various gratings and masks on a 2D canvas.
Key Features:
- Generate blazed and binary gratings
- Position gratings accurately and apply circular or rectangular masks
- Create rotational coordinates for complex arrangements
This module controls Hamamatsu Photonics SLMs through two main classes:
HPC_SLM
: Manages window display and transfers gray-scale images (np.ndarray
) to the SLM via DVI..HPC_SLM_Calib
: Extends the base class, adding calibration capabilities using local or global LUTs to convert phase data into gray values.
Key Features:
- SLM initialization and window management
- Calibration data loading and application
- Phase-to-gray value conversion with correction options
This module provides an interface for controlling Daheng USB Vision3 cameras.
Key Features:
- Camera initialization and configuration
- Trigger mode control and exposure time adjustment
- Image acquisition (single and multiple frames)
Two Jupyter notebooks are included, demonstrating pupil segmentation techniques in different scenarios.
Demonstrates a 'FullyRot' pattern for local and non-linear LUT correction, where a mask rotates while applying the LUT.
Key Features:
- Utilizes a binary grating on the SLM
- Implements LUT adjustments to the rotating mask
Demonstrates a 'CenterFix' pattern for wavefront sensing, where a mask is fixed in the center, and another rotates while applying phase shifts.
Key Features:
- Uses a full blazed grating on the SLM
- Applies phase shifts to the rotating mask
These interactive notebooks make parameter adjustment and data visualization straightforward during experiments.
- Install all required dependencies (see the Requirements section).
- Open the desired Jupyter notebook (
pupilseg_lut.ipynb
orpupilseg_ps.ipynb
). - Adjust parameters according to your setup.
- Execute the cells to run the pupil segmentation experiments.
-
Python 3.12
-
Jupyter Notebook
-
Required libraries:
numpy
,matplotlib
,scipy
,tqdm
Note: For the Daheng camera interface, two versions of the
gxipy
library are available:- The official version provided by Daheng (included in this project).
- An unofficial version on PyPI:
iai-gxipy
(use with caution).
Acquired images and experiment parameters are saved in MATLAB (.mat) files with timestamped filenames.
This project is tailored to work with specific hardware, namely Daheng cameras and Hamamatsu Photonics SLMs.
If you are using different camera or SLM models, you may need to modify the respective modules (MyGxCam.py
for cameras and hpc_slm.py
for SLMs) or adjust the relevant sections in the Jupyter notebooks for compatibility with your hardware.