Installation#

PyPI#

Install the stable version of slmsuite from PyPI using:

pip install slmsuite

GitHub#

Install the latest version of slmsuite from GitHub using:

pip install git+https://github.com/slmsuite/slmsuite

One can also clone slmsuite directly and add its directory to the Python path. Remember to install the dependencies (next sections).

git clone https://github.com/slmsuite/slmsuite

Required Dependencies#

The following python packages are necessary to run slmsuite. These are listed as PyPI dependencies and thus are installed automatically if PyPI (pip) is used to install.

One can also install these dependencies directly.

pip install -r requirements.txt

Hardware Dependencies#

The following python packages are optional acceleration or hardware requirements, which the user can install selectively.

  • GPU
    • cupy, highly recommended for GPU-accelerated holography. Sometimes, installation is made complicated by a pre-installed version of CUDA. You can find the CUDA version with nvcc –version in a terminal, and then install an installation of cupy specific to CUDA version YY with pip install cupy-cudaYYx.

  • Gradients
    • pytorch, required for conjugate gradient hologram optimization, either in GPU or CPU mode. Uses cupy - torch interoperability to pass data between modules without copying overhead, even on the GPU.

  • Cameras
  • SLMs
    • pyglet

    • Other SLMs are loaded directly via .dll.

  • Image saving
    • For most images and videos, imageio

    • Many video formats additionally require pyav

    • For .gif optimization, pygifsicle

Jupyter#

We highly recommended using Jupyter notebooks for interactive computing, and also list useful packages for code profiling which can be included via IPython magic, along with other features like %autoreload 2 or %matplotlib inline which are packaged with IPython.

If Jupyter is not used, the default matplotlib plots will block further execution, so the user should avoid plotting with plot=False flags on functions or develop a workaround.

Use the following to install recommended jupyter-related packages.

pip install -r requirements_ipython.txt