caskade
Build scientific simulators, treating them as a directed acyclic graph. Handles argument passing for complex nested simulators.
Install
pip install caskade
This will give you the numpy version of caskade. More details on the docs page.
if you want to use caskade with jax then run:
pip install caskade[jax]
if you want to use caskade with torch then run:
pip install caskade[torch]
Don't worry if you got the wrong one. Just install the appropriate
jax/torch directly if you want to add the option.
Usage
Make a Module object which may have some Params. Define a forward method
using the decorator.
from caskade import Module, Param, forward
class MySim(Module):
def __init__(self, a, b=None):
super().__init__()
self.a = a
self.b = Param("b", b)
@forward
def myfun(self, x, b=None):
return x + self.a + b
We may now create instances of the simulator and pass the dynamic parameters.
import torch
sim = MySim(1.0)
params = [torch.tensor(2.0)]
print(sim.myfun(3.0, params=params))
Which will print 6 by automatically filling b with the value from params.
Why do this?
The above example is not very impressive, the real power comes from the fact
that Module objects can be nested, making an arbitrarily complicated
analysis graph. Some other features include:
- Unroll parameters into 1D vector to interface with other packages (emcee, scipy.optimize, dynesty, etc.)
- Link parameters by value or functional relationship
- Reparametrize (e.g. between polar and cartesian) without modifying underlying code
- Save and load sampling chains automatically in HDF5
- Track metadata alongside parameters
- And much more! Beginner tutorial and Advanced tutorial
Use different backends
caskade can be run with different backends for torch, numpy, and jax.
See the Beginners Guide
tutorial
to learn more!
Documentation
The caskade interface has lots of flexibility, check out the
docs to learn more. For a quick start, jump
right to the Jupyter notebook
tutorial!
The caustics package can serve
as a project template utilizing the many features of caskade.
The caskade package maintains 100% coverage for unit testing, ensuring
reliability as the backbone of a research project.
Metadata
Release files for caskade 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| caskade-1.1.5.tar.gz | 283.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| caskade-1.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 326.9 kB
Release files / caskade-1.1.5.tar.gz
| Download URL | caskade-1.1.5.tar.gz |
|---|---|
| Size | 283.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf901badfca33a27a13c219e3a88640867b6ca9a1abfda7f428ad32986631d78
|
|
BLAKE2b-256 checksum How to use checksums |
06f4c1912d689a7f43daf2f61d14831505bef63fb043d6a0d5df0c8e06b9cb46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.
Transparency logRelease files / caskade-1.1.5-py3-none-any.whl
| Download URL | caskade-1.1.5-py3-none-any.whl |
|---|---|
| Size | 43.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89c54775efd1be83ba5f699583a7476e7c8a96c0f50e62a10b5cccb485f413be
|
|
BLAKE2b-256 checksum How to use checksums |
f2cb2abc4a1469d5c375c8b2fcfebefcb35ef1f63df9c1b917065618557504d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.
Transparency log