Caustics

Caustics: A Python Package for Accelerated Strong Gravitational Lensing Simulations - Published in JOSS (2024)

https://github.com/ciela-institute/caustics

Science Score: 100.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org, joss.theoj.org, zenodo.org
  • Committers with academic emails
    2 of 14 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

gravitational-lensing pytorch

Keywords from Contributors

mesh hydrology energy-system exoplanet closember community-driven icesat-2 hydraulic-modelling polygon geoscience

Scientific Fields

Mathematics Computer Science - 84% confidence
Last synced: 4 months ago · JSON representation ·

Repository

A gravitational lensing simulator for the machine learning era.

Basic Info
Statistics
  • Stars: 44
  • Watchers: 5
  • Forks: 14
  • Open Issues: 39
  • Releases: 27
Topics
gravitational-lensing pytorch
Created over 3 years ago · Last pushed 4 months ago
Metadata Files
Readme Contributing License Code of conduct Citation

README.md

caustics logo

ssec CI pre-commit.ci status Documentation Status PyPI version coverage status Zenodo arXiv

Caustics

The lensing pipeline of the future: GPU-accelerated, automatically-differentiable, highly modular. Currently under heavy development: expect interface changes and some imprecise/untested calculations.

Installation

Simply install caustics from PyPI:

bash pip install caustics

Note: Python 3.9 through 3.12 are recommended; compatibility with versions >=3.13 is currently untested.

Minimal Example

```python

fmt: off

import matplotlib.pyplot as plt import caustics import torch

cosmology = caustics.FlatLambdaCDM() sie = caustics.SIE(cosmology=cosmology, name="lens", zl=0.5, zs=1.0, x0=-0.2, y0=0.0, q=0.4, phi=1.5708, Rein=1.7) src = caustics.Sersic(name="source", x0=0.0, y0=0.0, q=0.5, phi=-0.985, n=1.3, Re=1.0, Ie=5.0) lnslt = caustics.Sersic(name="lenslight", x0=-0.2, y0=0.0, q=0.8, phi=0.0, n=1.0, Re=1.0, Ie=10.0)

sim = caustics.LensSource(lens=sie, source=src, lenslight=lnslt, pixelscale=0.05, pixelsx=100)

plt.imshow(sim(), origin="lower") plt.axis("off") plt.show() ```

Caustics lensed image

Batched simulator

```python sim.todynamic(False) cosmology.tostatic() x = sim.buildparamstensor() newx = x.repeat(20, 1) newx += torch.normal(mean=0, std=0.1 * torch.ones_like(newx))

images = torch.vmap(sim)(newx)

fig, axarr = plt.subplots(4, 5, figsize=(20, 16)) for ax, im in zip(axarr.flatten(), images): ax.imshow(im, origin="lower") plt.show() ```

Batched Caustics lensed images

Automatic Differentiation

```python J = torch.func.jacfwd(sim)(x)

Plot the new images

fig, axarr = plt.subplots(3, 7, figsize=(20, 9)) for i, ax in enumerate(axarr.flatten()): ax.imshow(J[..., i], origin="lower") plt.show() ```

Jacobian Caustics lensed image

Documentation

Please see our documentation page for more detailed information.

Contribution

We welcome contributions from collaborators and researchers interested in our work. If you have improvements, suggestions, or new findings to share, please submit an issue or pull request. Your contributions help advance our research and analysis efforts.

To get started with your development (or fork), click the "Open with GitHub Codespaces" button below to launch a fully configured development environment with all the necessary tools and extensions.

Open in GitHub Codespaces

Instruction on how to contribute to this project can be found in the CONTRIBUTION.md

Some guidelines:

  • Please use isort and black to format your code.
  • Use CamelCase for class names and snake_case for variable and method names.
  • Open up issues for bugs/missing features.
  • Use pull requests for additions to the code.
  • Write tests that can be run by pytest.

Thanks to our contributors so far!

Contributors

Owner

  • Name: Ciela-Institute
  • Login: Ciela-Institute
  • Kind: organization

JOSS Publication

Caustics: A Python Package for Accelerated Strong Gravitational Lensing Simulations
Published
November 22, 2024
Volume 9, Issue 103, Page 7081
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
M. J. Yantovski-Barth 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
Andreas Filipp 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
Landung Setiawan ORCID
eScience Institute Scientific Software Engineering Center, 1410 NE Campus Pkwy, Seattle, WA 98195, USA
Cordero Core ORCID
eScience Institute Scientific Software Engineering Center, 1410 NE Campus Pkwy, Seattle, WA 98195, USA
Ronan Legin 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
Charles Wilson 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
Gabriel Missael Barco 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
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
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
Editor
Ivelina Momcheva ORCID
Tags
astronomy gravitational lensing PyTorch

Citation (CITATION.cff)

cff-version: "1.2.0"
authors:
- family-names: Stone
  given-names: Connor
  orcid: "https://orcid.org/0000-0002-9086-6398"
- family-names: Adam
  given-names: Alexandre
  orcid: "https://orcid.org/0000-0001-8806-7936"
- family-names: Coogan
  given-names: Adam
  orcid: "https://orcid.org/0000-0002-0055-1780"
- family-names: Yantovski-Barth
  given-names: M. J.
  orcid: "https://orcid.org/0000-0001-5200-4095"
- family-names: Filipp
  given-names: Andreas
  orcid: "https://orcid.org/0000-0003-4701-3469"
- family-names: Setiawan
  given-names: Landung
  orcid: "https://orcid.org/0000-0002-1624-2667"
- family-names: Core
  given-names: Cordero
  orcid: "https://orcid.org/0000-0002-3531-3221"
- family-names: Legin
  given-names: Ronan
  orcid: "https://orcid.org/0000-0001-9459-6316"
- family-names: Wilson
  given-names: Charles
  orcid: "https://orcid.org/0000-0001-7071-5528"
- family-names: Barco
  given-names: Gabriel Missael
  orcid: "https://orcid.org/0009-0008-5839-5937"
- family-names: Hezaveh
  given-names: Yashar
  orcid: "https://orcid.org/0000-0002-8669-5733"
- family-names: Perreault-Levasseur
  given-names: Laurence
  orcid: "https://orcid.org/0000-0003-3544-3939"
contact:
- family-names: Stone
  given-names: Connor
  orcid: "https://orcid.org/0000-0002-9086-6398"
doi: 10.5281/zenodo.10806382
message: If you use this software, please cite our article in the
  Journal of Open Source Software.
preferred-citation:
  authors:
  - family-names: Stone
    given-names: Connor
    orcid: "https://orcid.org/0000-0002-9086-6398"
  - family-names: Adam
    given-names: Alexandre
    orcid: "https://orcid.org/0000-0001-8806-7936"
  - family-names: Coogan
    given-names: Adam
    orcid: "https://orcid.org/0000-0002-0055-1780"
  - family-names: Yantovski-Barth
    given-names: M. J.
    orcid: "https://orcid.org/0000-0001-5200-4095"
  - family-names: Filipp
    given-names: Andreas
    orcid: "https://orcid.org/0000-0003-4701-3469"
  - family-names: Setiawan
    given-names: Landung
    orcid: "https://orcid.org/0000-0002-1624-2667"
  - family-names: Core
    given-names: Cordero
    orcid: "https://orcid.org/0000-0002-3531-3221"
  - family-names: Legin
    given-names: Ronan
    orcid: "https://orcid.org/0000-0001-9459-6316"
  - family-names: Wilson
    given-names: Charles
    orcid: "https://orcid.org/0000-0001-7071-5528"
  - family-names: Barco
    given-names: Gabriel Missael
    orcid: "https://orcid.org/0009-0008-5839-5937"
  - family-names: Hezaveh
    given-names: Yashar
    orcid: "https://orcid.org/0000-0002-8669-5733"
  - family-names: Perreault-Levasseur
    given-names: Laurence
    orcid: "https://orcid.org/0000-0003-3544-3939"
  date-published: 2024-11-22
  doi: 10.21105/joss.07081
  issn: 2475-9066
  issue: 103
  journal: Journal of Open Source Software
  publisher:
    name: Open Journals
  start: 7081
  title: "Caustics: A Python Package for Accelerated Strong
    Gravitational Lensing Simulations"
  type: article
  url: "https://joss.theoj.org/papers/10.21105/joss.07081"
  volume: 9
title: "Caustics: A Python Package for Accelerated Strong Gravitational
  Lensing Simulations"

GitHub Events

Total
  • Create event: 52
  • Release event: 8
  • Issues event: 56
  • Watch event: 12
  • Delete event: 22
  • Member event: 2
  • Issue comment event: 123
  • Push event: 290
  • Pull request review comment event: 43
  • Pull request event: 154
  • Pull request review event: 82
  • Fork event: 3
Last Year
  • Create event: 52
  • Release event: 8
  • Issues event: 56
  • Watch event: 12
  • Delete event: 22
  • Member event: 2
  • Issue comment event: 123
  • Push event: 290
  • Pull request review comment event: 43
  • Pull request event: 154
  • Pull request review event: 82
  • Fork event: 3

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 676
  • Total Committers: 14
  • Avg Commits per committer: 48.286
  • Development Distribution Score (DDS): 0.543
Past Year
  • Commits: 170
  • Committers: 8
  • Avg Commits per committer: 21.25
  • Development Distribution Score (DDS): 0.429
Top Committers
Name Email Commits
Connor Stone c****8@g****m 309
Adam Coogan d****n@g****m 130
AlexandreAdam a****3@g****m 52
pre-commit-ci[bot] 6****] 51
mjyb16 m****9@p****u 33
Alexandre Adam a****3@g****m 25
Don Setiawan l****s@u****u 21
dependabot[bot] 4****] 21
Andreas Filipp 9****p 21
Cordero Core 1****c 8
Nicolas Payot 1****b 2
sachapf 1****f 1
Nolan Smyth N****h@g****m 1
Gabriel Missael Barco m****o@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 61
  • Total pull requests: 220
  • Average time to close issues: 5 months
  • Average time to close pull requests: 9 days
  • Total issue authors: 10
  • Total pull request authors: 12
  • Average comments per issue: 0.69
  • Average comments per pull request: 1.0
  • Merged pull requests: 183
  • Bot issues: 2
  • Bot pull requests: 74
Past Year
  • Issues: 34
  • Pull requests: 141
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 9 days
  • Issue authors: 4
  • Pull request authors: 7
  • Average comments per issue: 0.53
  • Average comments per pull request: 1.05
  • Merged pull requests: 124
  • Bot issues: 1
  • Bot pull requests: 48
Top Authors
Issue Authors
  • ConnorStoneAstro (49)
  • mjyb16 (6)
  • andreasfilipp (3)
  • AlexandreAdam (3)
  • adam-coogan (2)
  • Jammy2211 (2)
  • andigu (2)
  • le-zouave (1)
  • uwcdc (1)
  • lsetiawan (1)
  • pre-commit-ci[bot] (1)
Pull Request Authors
  • ConnorStoneAstro (128)
  • pre-commit-ci[bot] (69)
  • dependabot[bot] (27)
  • lsetiawan (14)
  • mjyb16 (12)
  • uwcdc (7)
  • AlexandreAdam (4)
  • rouzib (2)
  • warrickball (2)
  • sachapf (2)
  • andreasfilipp (1)
  • GabrielMissael (1)
  • NolanSmyth (1)
Top Labels
Issue Labels
feat (12) docs (9) bug (7) enhancement (6) question (6) refactor (5) build (3) good first issue (3) perf (3) tests (2) user experience (2) new lens (2) dependencies (1) ci (1) fix (1) chore (1) wontfix (1) style (1)
Pull Request Labels
dependencies (33) docs (28) feat (18) fix (17) refactor (12) perf (8) bug (8) chore (7) tests (7) user experience (4) ci (3) revert (1) build (1) enhancement (1) github_actions (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 791 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 18
  • Total maintainers: 3
pypi.org: caustics

The lensing pipeline of the future: GPU-accelerated, automatically-differentiable, highly modular. Currently under heavy development: expect interface changes and some imprecise/untested calculations.

  • Homepage: https://mila.quebec/en/
  • Documentation: https://caustics.readthedocs.io/en/latest/
  • License: MIT License Copyright (c) [2023] [caustics authors] 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: 1.5.1
    published 5 months ago
  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 791 Last month
Rankings
Dependent packages count: 10.0%
Stargazers count: 16.5%
Forks count: 19.1%
Average: 28.3%
Dependent repos count: 67.6%
Maintainers (3)
Last synced: 4 months ago

Dependencies

requirements.txt pypi
  • astropy ==5.2.1
  • h5py ==3.8.0
  • icecream ==2.1.3
  • lenstronomy ==1.10.3
  • matplotlib ==3.6.3
  • numpy ==1.23.5
  • scipy ==1.10.0
  • setuptools ==67.2.0
  • torch ==1.13.1
  • torchinterp1d ==1.1
docs/requirements.txt pypi
  • nbsphinx *
  • sphinx *
  • sphinx_rtd_theme *
  • wheel *
.github/workflows/cd.yml actions
  • actions/checkout v4 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish v1.8.11 composite
.github/workflows/ci.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • codecov/codecov-action v3 composite
pyproject.toml pypi
.devcontainer/Dockerfile docker
  • pangeo/base-notebook latest build
.github/workflows/image_ci.yml actions
  • actions/checkout v4 composite
  • docker/build-push-action v5 composite
  • docker/login-action v3 composite
  • docker/metadata-action v5 composite
  • docker/setup-buildx-action v3 composite
resources/docker/Dockerfile docker
  • mambaorg/micromamba focal-cuda-${CUDA_VERSION} build