caskade: building Pythonic scientific simulators

caskade: building Pythonic scientific simulators - Published in JOSS (2025)

https://github.com/connorstoneastro/caskade

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software
Last synced: 8 months ago · JSON representation

Repository

Build scientific simulators, treating them as a directed acyclic graph

Basic Info
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 0
  • Open Issues: 12
  • Releases: 36
Created over 1 year ago · Last pushed 9 months ago
Metadata Files
Readme Contributing License

README.md

caskade logo

caskade

CI CD codecov PyPI - Version Documentation Status DOI

Build scientific simulators, treating them as a directed acyclic graph. Handles argument passing for complex nested simulators.

Install

bash pip install caskade

More details on the docs page. if you want to use caskade with jax then run:

bash pip install caskade[jax]

Alternately, just pip install jax/jaxlib separately as they are the only extra requirements.

Usage

Make a Module object which may have some Params. Define a forward method using the decorator.

``` python 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.

``` python 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.

Owner

  • Name: Connor Stone, PhD
  • Login: ConnorStoneAstro
  • Kind: user
  • Company: Université de Montréal

I'm an Astrophysics Postdoctoral Fellow at Université de Montréal and Mila. I study Galaxy evolution and strong lensing.

JOSS Publication

caskade: building Pythonic scientific simulators
Published
September 15, 2025
Volume 10, Issue 113, Page 8786
Authors
Connor Stone ORCID
Ciela Institute - Montréal Institute for Astrophysical Data Analysis and Machine Learning, Montréal, Québec, Canada, Department of Physics, Université de Montréal, Montréal, Québec, Canada, Mila - Québec Artificial Intelligence Institute, Montréal, Québec, Canada
Alexandre Adam ORCID
Ciela Institute - Montréal Institute for Astrophysical Data Analysis and Machine Learning, Montréal, Québec, Canada, Department of Physics, Université de Montréal, Montréal, Québec, Canada, Mila - Québec Artificial Intelligence Institute, Montréal, Québec, Canada
Adam Coogan ORCID
Ciela Institute - Montréal Institute for Astrophysical Data Analysis and Machine Learning, Montréal, Québec, Canada, Department of Physics, Université de Montréal, Montréal, Québec, Canada, Mila - Québec Artificial Intelligence Institute, Montréal, Québec, Canada, Work done while at UdeM, Ciela, and Mila
Laurence Perreault-Levasseur ORCID
Ciela Institute - Montréal Institute for Astrophysical Data Analysis and Machine Learning, Montréal, Québec, Canada, Department of Physics, Université de Montréal, Montréal, Québec, Canada, Mila - Québec Artificial Intelligence Institute, Montréal, Québec, Canada, Center for Computational Astrophysics, Flatiron Institute, 162 5th Avenue, 10010, New York, NY, USA, Perimeter Institute for Theoretical Physics, Waterloo, Canada, Trottier Space Institute, McGill University, Montréal, Canada
Yashar Hezaveh ORCID
Ciela Institute - Montréal Institute for Astrophysical Data Analysis and Machine Learning, Montréal, Québec, Canada, Department of Physics, Université de Montréal, Montréal, Québec, Canada, Mila - Québec Artificial Intelligence Institute, Montréal, Québec, Canada, Center for Computational Astrophysics, Flatiron Institute, 162 5th Avenue, 10010, New York, NY, USA, Perimeter Institute for Theoretical Physics, Waterloo, Canada, Trottier Space Institute, McGill University, Montréal, Canada
Editor
Vincent Knight ORCID
Tags
astronomy inference simulation

GitHub Events

Total
  • Create event: 63
  • Issues event: 27
  • Release event: 31
  • Watch event: 6
  • Delete event: 16
  • Member event: 1
  • Issue comment event: 56
  • Push event: 182
  • Pull request review event: 8
  • Pull request review comment event: 6
  • Pull request event: 64
Last Year
  • Create event: 63
  • Issues event: 27
  • Release event: 31
  • Watch event: 6
  • Delete event: 16
  • Member event: 1
  • Issue comment event: 56
  • Push event: 182
  • Pull request review event: 8
  • Pull request review comment event: 6
  • Pull request event: 64

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 20
  • Total pull requests: 31
  • Average time to close issues: 4 days
  • Average time to close pull requests: 2 days
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.4
  • Average comments per pull request: 0.77
  • Merged pull requests: 25
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 20
  • Pull requests: 31
  • Average time to close issues: 4 days
  • Average time to close pull requests: 2 days
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.4
  • Average comments per pull request: 0.77
  • Merged pull requests: 25
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ConnorStoneAstro (19)
  • avapolzin (1)
Pull Request Authors
  • ConnorStoneAstro (30)
  • danielskatz (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
enhancement (2) bug (2) documentation (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 2,129 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 36
  • Total maintainers: 1
pypi.org: caskade

Package for building scientific simulators, with dynamic arguments arranged in a directed acyclic graph.

  • Homepage: https://github.com/ConnorStoneAstro/caskade
  • Documentation: https://github.com/ConnorStoneAstro/caskade
  • License: MIT License Copyright (c) 2024 Connor Stone, PhD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.11.0
    published 9 months ago
  • Versions: 36
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 2,129 Last month
Rankings
Dependent packages count: 10.2%
Average: 33.8%
Dependent repos count: 57.3%
Maintainers (1)
Last synced: 9 months ago

Dependencies

.github/workflows/cd.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
  • pypa/gh-action-pypi-publish v1.10.3 composite
.github/workflows/ci.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • codecov/codecov-action v4 composite
pyproject.toml pypi
requirements.txt pypi
  • torch *
docs/requirements.txt pypi
  • graphviz *
  • ipywidgets *
  • jupyter-book *
  • matplotlib *
  • sphinx *
  • sphinx_rtd_theme *