Why slmsuite?

Because using a spatial light modulator (SLM) should be as easy as buying an SLM.

The flourishing applications of SLMs—ranging from deep-brain imaging to quantum control—have motivated commensurate growth in affordable, high-performance commercial hardware. Harnessing the practical advantages of these SLMs in demanding applications, however, is often limited by the outdated, proprietary, or otherwise incomplete control software available to users. Our Quantum Photonics research group at MIT developed slmsuite to address these issues.

Simply put, the goal of slmsuite is to enable any SLM user to efficiently project high-precision, computer-generated holograms (compensated for non-ideal experimental conditions!) using the latest algorithms from research. It features:

  • Simple interface for controlling various SLMs and cameras,

  • Automated Fourier- to image-space coordinate transformations: point to a camera pixel, and the Fourier-domain SLM will direct light there!

  • Automated wavefront calibration to compensate for aberrations along the SLM imaging train,

  • A growing suite of GPU-accelerated iterative phase retreival algorithms (e.g. weighted Gerchberg-Saxton) with experimental feedback,

  • Automated evaluation metrics to monitor diffraction efficiency and image tolerances,

  • … and more to come!

During the initial development alone, slmsuite enabled us to tune arrays of micro-scale optical cavities into resonance with picometer-precision, dynamically address clusters of artificial atoms in diamond, and efficiently fan-out input activations in optical neural networks. We’re excited to see what you come up with next!

Tuned Microcavity Arrays

Dynamic Quantum Control

Optical Neural Networks

Cavity Array Trimming

Dynamic Artificial Atom Addressing

Optical Neural Networks

Why Python?

Python is a simple and fast programming language. With easy-to-learn syntax and good readability, Python is ideal for scientists and experimentalists interested in quick development and refinement. Itself being open-source, Python is a goto language for open-source projects, to the point that it is the most pull-requested language on GitHub.

The default implementation of the Python language, CPython, is built on top of C. Scientific computing packages such as numpy and scipy implement algorithms in fast C code, leading to a paradigm where ‘heavy lifting’ is done in C, while higher-level logic or ‘heavy coding’ is done in the more user-friendly Python. Importantly, the accessiblity of the C backend means that hardware interfaces (often written in C) are easy to implement in Python. This is critical for the slmsuite package, which focuses on experimental holography using physical cameras and SLMs.

We find jupyter notebooks with autoreload to be exceptionally useful for experimentation and debugging, as this produces MATLAB-like interactivity with editable scripting. See the jupyter notebooks in Examples to try it out!

Why cupy?

Core algorithms in slmsuite make heavy use of fast Fourier transforms on large arrays. These problems are ideal for GPU-based acceleration, implemented here with cupy. In most cases, cupy is a drop-in replacement for numpy and scipy, which are used as a backup if a GPU is not present. We repeatably measure around two orders of magnitude speedup for standard optimization when using cupy, compared with the numpy equivalent.