Skip to content

v0.5.0

Latest

Choose a tag to compare

@cpanuski cpanuski released this 05 Oct 05:13
· 19 commits to main since this release

Changelog

v0.5.0 (October 2026)

Summary: v0.5.0 is a large release focused on GPU-first SLMs, a reworked camera geometry model (windowing, binning, color), a new Aperture/ZernikeBasis framework, package-wide logging, and a live viewer. The examples have been reworked, with new tutorials on simulated hardware and pixel calibration. It contains many breaking changes and correctness fixes, so please read Breaking Changes before upgrading. Fourier calibrations taken with 0.4 should be redone.

New Features

  • GPU-First SLMs (slm.py): SLM data stays on the GPU when cupy is installed (gpu= to control).
    • set_gamma(), plot_gamma(), and get_realized_phase() model a measured, nonlinear phase response.
    • SegmentedSLM and SLM.segment() split one SLM into independently addressable regions.
    • set_phase(settle=) accepts a time in seconds as well as True/False.
  • Enhanced Calibration (cameraslms/):
    • wavefront_calibrate_zernike_get() interpolates wavefront calibrations across the field of view.
    • Pixel calibration measures the pixel phase response (phase shift vs. display/control value) and saves it as the SLM's gamma.
    • Fourier calibration survives changes to the camera's window, binning, and orientation.
  • Aperture and ZernikeBasis (toolbox): one Aperture class describes the SLM's illuminated region, set with SLM.set_aperture() or measured with SLM.fit_aperture(). ZernikeBasis caches mode images so Zernike sums and fits are a single matrix product, and image_zernike_fit(gradient=True) fits wrapped phase in #195.
  • Camera Windowing and Binning (camera.py): set_woi() and set_binning() work on every camera, falling back to software where the hardware can't. New properties (sensor_shape, origin, center) locate the image on the sensor, and OrientationTransform handles flips and rotations in #192.
  • Simulation (simulated.py): simulated SLMs and cameras now run on the GPU when cupy is installed, significantly accelerating simulated hardware. FourierSLM.simulate() carries over all calibrations and brightness, so simulations match the real setup. Saved setups reload as simulations, and SimulatedCamera gains a noise model fit from a dark frame.
  • Live Viewer (_viewer.py, _pyglet.py): .live() now works on SLMs, exports .png/.h5, and supports zoom and pan in #195. A new pyglet backend opens a standalone window for use outside Jupyter.
  • Performance: batched FFTs for like-sized planes in MultiplaneHologram (#195), cached Zernike bases, GPU-resident camera feedback, faster viewer zoom and pan, and direct GPU-to-display writes in ScreenMirrored via pinned memory and cupy-OpenGL interop.
  • Holography and Analysis:
    • Camera feedback can be restricted to a sub-image with FeedbackHologram.set_target(roi=).
    • Holograms can be named, logged, and saved with save().
    • New analysis functions image_aperture_fit(), image_lattice_detect(), and image_strehl().
    • New phase patterns triangle(), ince_gaussian(), mathieu_gaussian(), and airy().
  • Logging (_logging.py): slmsuite now uses standard Python logging in place of print() and per-driver verbose= flags, with extras on top. Console output is color-coded and tagged with the object that produced it, configure_logging() sets verbosity, and get_log() returns the session's log for the package or for a single object, which is also written into that object's saved files in #190, #194.
  • Testing: new test coverage for simulated hardware, remote control, the viewer, logging, plotting, and pickling.
  • Plotting (_plotting.py): configure_plotting() chooses whether plots are shown, suppressed, saved to a folder, or passed to a custom handler, which is useful for headless runs in #190.
  • Color Cameras (camera.py): select a channel with color_channel= in #191.
  • Multi-PLM Support (texasinstruments.py): PLM.open_all() configures and opens every connected TI PLM in one call in #195.
  • Array Backend (misc/xp.py): helpers such as as_numpy() and is_gpu_array() for moving data between numpy and cupy.

Examples

The example notebooks have been overhauled for the 0.5.0 API.

  • New: Simulated Hardware ports a calibrated experiment into simulation with .simulate(), then compares spot power and shape against the hardware to show what limits uniformity.
  • New: Pixel Calibration measures the phase response of a 4-bit TI PLM, compares it with the vendor LUT, and covers settle calibration.
  • Multipoint Calibration is rewritten around the new Zernike tools. It fits a multipoint wavefront calibration to Zernike polynomials and interpolates the correction across the field of view.
  • Zernike Holography adds sections on the SLM Aperture, the ZernikeBasis, and interpolated Zernike holography.
  • Wavefront Calibration adds the live viewer and scores the result on simulated hardware.
  • The remaining examples are updated for the new API, with new analysis and visualizations throughout.

Breaking Changes

  • GPU arrays: with cupy installed, slm.phase, display, grid, source[...], and FeedbackHologram.img_ij are cupy arrays. Use gpu=False or xp.as_numpy() before passing them to matplotlib, OpenCV, or SciPy.
  • Fourier calibration is stored relative to the raw sensor. Redo 0.4 calibrations taken with any rotation, window, or binning in #192.
  • Superpixel calibration: r2_fit and contrast_fit were swapped in 0.4.
  • Positional arguments moved in Camera, PLM, Webcam, Server, set_binning(), autoexpose(), pixel_calibrate(), settle_calibrate(), and image_zernike_fit(). Pass arguments by keyword.
  • verbose= is replaced by slmsuite.configure_logging(), and most warnings are now log messages in #190, #194.
  • Camera WOI and binning: Camera.woi is now read-only (use set_woi()), default_shape is renamed sensor_shape, and binning moved from ThorCam to the base class in #192.
  • Aperture: zernike_aperture() and the SLM.get_source_*() methods are replaced by Aperture. Apertures default to "cropped", and the default beam radius (SLM.source_radius) changes laguerre_gaussian(), hermite_gaussian(), axicon(), and Zernike scaling in #195.
  • slm.source no longer has the "amplitude_*" keys, and fit_source_amplitude() now forwards to fit_aperture().
  • Imports: slmsuite.hardware is now a namespace package, and slmsuite.hardware.cameraslms no longer re-exports toolbox, analysis, Hologram, or cv2.
  • New defaults: MRAF is on by default (null_region_radius_frac=sqrt(2)). pixel_calibrate() now samples 32 levels and 2 orders, and settle_calibrate() autoexposes before measuring.
  • reset_phase() no longer adds random phase by default by @philip-rk in #198.
  • Phase functions: laguerre_gaussian() and hermite_gaussian() were wrong in 0.4. sinusoid() is now a cosine, binary() and bahtinov() start each period at a, axicon() honors negative focal lengths, and Noll indexing is fixed.
  • lens() with only one finite focal length returns a cylindrical lens instead of a flat pattern by @philip-rk in #197.
  • get_spot_radius_kxy() was π too large in 0.4, so default spot sizes in SpotHologram and Fourier calibration shrink.
  • Analysis: window_slice() includes the far edge, take()/imprint(clip=False) raise on overhang, and blob_array_detect() defaults to autocorrelation. image_ellipticity_angle() and image_variances(grid=) were wrong in 0.4.
  • Cameras: autoexpose() returns at the exposure limit instead of raising, and pitch_um/bitresolution account for binning and orientation.
  • Holography: unsupported feedback= raises, and the "WGS-Wu"/"WGS-tanh" weightings are fixed.
  • TI PLM: texas_instruments.yaml is renamed texasinstruments.yaml, and legacy LUT loading is removed.
  • Remote errors no longer include the server traceback.

Renamed and removed:

0.4 0.5
blob_detect(img=), blob_array_detect(img=, size=) image=, array_shape=
image_zernike_fit(iterations=, unwrap=) leastsquares=
zernike_sum(use_mask="return") Aperture.mask
Camera.autoexposure() autoexpose() (alias kept)
fourier_calibrate(autoexposure=) autoexpose= (alias kept)
Camera.default_shape sensor_shape
Camera.woi = ... set_woi()
SLM.grid = ... read-only
ThorCam.set_binning(bx=, by=) Camera.set_binning(binning=)
Webcam.set_woi() base-class software crop
ScreenMirrored(slm_shape=), .display_resolution slm_resolution=, display_shape
FeedbackHologram.update_target() set_target()
SpotHologram.set_target(plot=), ALGORITHM_INDEX removed
Hologram._remove_vortices() remove_vortices()
settle_calibrate(settle_time_s=) removed
SLM.get_source_center(), get_source_radius(), get_source_zernike_scaling(), set_source_aperture() SLM.source_radius, set_aperture()
toolbox.phase.zernike_aperture() toolbox.Aperture
matheui_gaussian() mathieu_gaussian()
verbose= slmsuite.configure_logging()
Cheetah640.autoexpose_xenics() set_autoexposure()

Bug Fixes

  • remove_vortices() drew a plot but never actually removed vortices by @SAY-5 in #207 (fixes #205).
  • Quadratic initial phase: reset_phase(quadratic_phase=True) crashed on a Hologram built without amp (fixes #209).
  • Hamamatsu: added the missing close() and fixed the mode conversion and buffer size by @philip-rk in #178.
  • ThorCam: SDK crash on Windows from a missing DLL path by @tpr0p in #201.
  • Basler: cameras that name their exposure ExposureTimeAbs now work by @philip-rk in #184 (fixes #179).
  • null_region: the mask was transposed relative to the phase pattern by @philip-rk in #185.
  • Autoexposure and binning: an autoexposure bug and an integer overflow when binning in #192.
  • Zernike masking and beam waist are now consistent between the SLM and the phase functions (addresses #108).
  • Vendor SLM install: the wheel was missing the SLM model database, and the slms extra was missing pyyaml.
  • Conjugate gradient optimization did nothing under experimental feedback, and crashed with a scalar amp, with MultiplaneHologram, or with MRAF targets.
  • SDK bindings: Cheetah640 could not be constructed, and Santec bound SLM_Ctrl_ReadTM twice.
  • Camera capture: failed captures raise clear errors on ThorCam, MindVision, FLIR, and Basler. Also fixed ImagingSource transforming twice, Instrumental exposure units, FLIR software triggering, and a Santec init hang.
  • Superpixel calibration skipped some superpixels when exclude_superpixels was set.
  • Analysis: smallest_distance() gave wrong results above 400 points, lloyds_points() swapped x and y, and zernike_convert_index() now accepts every indexing.
  • Crashes in plot_farfield(axs=, cbar=True), Hologram(propagation_kernel=<float>), optimize() after load_stats(), save_stats(include_state=True), image_remove_field(), polynomial(), and higher derivatives of zernike_sum().
  • Remote: unreachable servers raise TimeoutError, sockets no longer leak, the pickle command can't read arbitrary attributes, and NumPy 2 dtypes encode correctly.

All Merged Pull Requests

  • Fixed the Hamamatsu SLM functionality by @philip-rk in #178
  • Added test for name of the Exposure time variable by @philip-rk in #184
  • Fix null_region meshgrid axis order by @philip-rk in #185
  • Logging & Plotting Globals in #190
  • Color camera support in #191
  • WOI & Binning Revamp in #192
  • Refactor logging for package-level/singleton logging in #194
  • Add ZernikeBasis and aperture in #195
  • Fixes condition for creating lens patterns by @philip-rk in #197
  • Changed default random_phase value from True to False in holo.reset_phase() by @philip-rk in #198
  • Fix TLCameraSDK access violation by @tpr0p in #201
  • Make Hologram.remove_vortices actually remove vortices without plotting by @SAY-5 in #207
  • Merge common development branch into main in #211

New Contributors

Full Changelog: v0.4.1...v0.5.0