Installation

Katsu may be installed via PyPI

pip install katsu --upgrade

Or by cloning the Katsu repository on Github

git clone https://github.com/Jashcraf/katsu

Running Automated Testing

To run Katsu’s automated tests, please install the pytest package

pip install --upgrade pytest

then navigate to your clone of the Katsu repository and run

pytest tests/

See Optional Dependecies for how to run pytest with Jax installed.

Requirements

The base implementation of Katsu just requires the following, which will install when running the katsu installation

  • Python 3.8+

  • Numpy

  • Scipy

  • pyserial

Optional Dependecies

If you wish to extend Katsu’s functionality, please install the following into your Python environemnt

  • Jax: enables differentiable Mueller matrix models

  • Cupy: enables computation on GPUs, suitable for handling large datasets

To enable these options the appropriate backend method must be called, as shown in the code snippet below

from katsu.katsu_math import set_backend_to_jax, set_backend_to_cupy, set_backend_to_numpy

# sets numpy backend to cupy
set_backend_to_cupy()

# sets numpy backend to jax
set_backend_to_jax()

# resets to numppy
set_backend_to_numpy()

In this snippet, the katsu backend will be set from the default (Numpy) to Cupy, then Jax, then Numpy.

To ensure that Katsu works with Jax, please install Jax before running pytest tests/, otherwise the Jax tests will be skipped.