Skip to main content

Zodiax

PyPI version License integration codecov Documentation


Zodiax is an differentiable object-oriented framework geared towards scientific programming and physical modelling. Its built on the JAX + Equinox ecosystem, inherits all of their functionality, and adds a series of extra methods to make working with physically representative classes simple and flexible. On top of that, it also adds a number of helpful optimisation and statistics tools often found in the physical sciences but not in the machine learning field. Zodiax was spun out from the development of dLux, a differentiable optics framework that still uses Zodiax as its core class structure.

Documentation: louisdesdoigts.github.io/zodiax/

Note: The Zodiax tutorials live in a separate repo. This allows users to directly download and run the notebooks, ensuring that the correct packages needed to run them are installed! It also allows for new tutorials and examples to be added quite easily, without needing to update the core library.

Contributors: Louis Desdoigts

Requires: Python 3.10+, Jax 0.4.25+

Installation:

pip install zodiax

Development installation:

pip install "zodiax[dev]"

Quickstart

Create a regular class that inherits from zodiax.Base

import jax
import zodiax as zdx
import jax.numpy as np

class Linear(zdx.Base):
    m : jax.Array
    b : jax.Array

    def __init__(self, m, b):
        self.m = m
        self.b = b

    def __call__(self, x):
        return self.m * x + self.b

linear = Linear(1., 1.)

Its that simple! The linear class is now a fully differentiable object that gives us all the benefits of jax with an object-oriented interface!

Manipulating leaves

Zodiax provides a number of methods to manipulate the leaves of a class. These methods allow you to update, add, multiply, divide, and perform other operations on the parameters of a class in a flexible and intuitive way. These update methods support three equivalent input styles:

  1. (parameters, values) positional style
  2. {parameter: value} dictionary style
  3. param=value keyword style
# 1) Positional: (parameters, values)
linear = linear.set(["m", "b"], [2.0, 0.5])

# 2) Dictionary: {parameter: value}
linear = linear.add({"m": 0.1, "b": -0.2})

# 3) Keyword: param=value
linear = linear.multiply(m=2.0, b=0.5)

Use whichever style is clearest for your workflow. The operations remain immutable and return new objects.

Next steps

There are two main tutorials for Zodiax. The first is the Building Classes tutorial, which give s a detailed overview of how to construct classes, how neasted object and paths work, and how to manipulate them. The second is the Optimisation and Inference tutorial, which gives an relatively complete overview of the how to perform the most common optimisation and inference problems using Zodiax objects, and introduces a lot of the various tools and methods provided by the repo. If you are familiar with both of those, then you pretty much know all of Zodiax!

Metadata

Release files for zodiax 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zodiax 0.5.0
File Size Uploaded Provenance Actions
zodiax-0.5.0.tar.gz 20.0 kB Without provenance Details for zodiax-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zodiax 0.5.0
File Interpreter ABI Platform Actions
zodiax-0.5.0-py3-none-any.whl Python 3 none any Details for zodiax-0.5.0-py3-none-any.whl

Total release size: 35.6 kB

Release files / zodiax-0.5.0.tar.gz

Download URL zodiax-0.5.0.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1d630483a6189c1cb65b90285537259f2ce4cf206407d0f7aece316e6a97ec22
BLAKE2b-256 checksum
How to use checksums
75faa26cbb8896b6a98d1b2b7242491768f87152601c49b9ce3a61da85168dc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / zodiax-0.5.0-py3-none-any.whl

Download URL zodiax-0.5.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b823e8f532848e76adab5c36adfc9617f836add5d43f1c1e71c2ba7cabea09a
BLAKE2b-256 checksum
How to use checksums
9940943c96d5ea9f691488d476a1adb791a37e63cf756277fddc25d6584f827a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for zodiax 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page