Name | caustics JSON |
Version |
1.5.0
JSON |
| download |
home_page | None |
Summary | The lensing pipeline of the future: GPU-accelerated, automatically-differentiable, highly modular. Currently under heavy development: expect interface changes and some imprecise/untested calculations. |
upload_time | 2025-08-01 01:09:28 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
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. |
keywords |
astronomy
astrophysics
caustics
differentiable programming
gravitational lensing
lensing
pytorch
strong lensing
|
VCS |
 |
bugtrack_url |
|
requirements |
astropy
caskade
graphviz
h5py
mpmath
numpy
safetensors
scipy
torch
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/Ciela-Institute/caustics/blob/main/media/caustics_logo.png?raw=true">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/Ciela-Institute/caustics/blob/main/media/caustics_logo_white.png?raw=true">
<img alt="caustics logo" src="media/caustics_logo.png" width="70%">
</picture>
[](https://escience.washington.edu/software-engineering/ssec/)
[](https://github.com/Ciela-Institute/caustics/actions/workflows/ci.yml)
[](https://results.pre-commit.ci/latest/github/Ciela-Institute/caustics/main)
[](https://caustics.readthedocs.io/en/latest/?badge=latest)
[](https://pypi.org/project/caustics/)
[](https://app.codecov.io/gh/Ciela-Institute/caustics)
[](https://joss.theoj.org/papers/995fa98462eb534a32952549ef2244f8)
[](https://zenodo.org/doi/10.5281/zenodo.10806382)
[](https://arxiv.org/abs/2406.15542)
# 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", z_l=0.5, z_s=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, lens_light=lnslt, pixelscale=0.05, pixels_x=100)
plt.imshow(sim(), origin="lower")
plt.axis("off")
plt.show()
```

### Batched simulator
```python
sim.to_dynamic(False)
cosmology.to_static()
x = sim.build_params_tensor()
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()
```

### 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()
```

## Documentation
Please see our [documentation page](https://caustics.readthedocs.io/en/latest/)
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.
[](https://codespaces.new/uw-ssec/caustics?quickstart=1)
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`](https://docs.pytest.org/).
Thanks to our contributors so far!
[](https://github.com/Ciela-Institute/caustics/graphs/contributors)
Raw data
{
"_id": null,
"home_page": null,
"name": "caustics",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "astronomy, astrophysics, caustics, differentiable programming, gravitational lensing, lensing, pytorch, strong lensing",
"author": null,
"author_email": "Connor Stone <connor.stone@mila.quebec>, Alexandre Adam <alexandre.adam@mila.quebec>, UW SSEC <ssec@uw.edu>",
"download_url": "https://files.pythonhosted.org/packages/07/d7/269d95eca0935a69fb5087d35dd1e0c6254360c7a663eb6ed4adf4dee698/caustics-1.5.0.tar.gz",
"platform": null,
"description": "<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/Ciela-Institute/caustics/blob/main/media/caustics_logo.png?raw=true\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://github.com/Ciela-Institute/caustics/blob/main/media/caustics_logo_white.png?raw=true\">\n <img alt=\"caustics logo\" src=\"media/caustics_logo.png\" width=\"70%\">\n</picture>\n\n[](https://escience.washington.edu/software-engineering/ssec/)\n[](https://github.com/Ciela-Institute/caustics/actions/workflows/ci.yml)\n[](https://results.pre-commit.ci/latest/github/Ciela-Institute/caustics/main)\n[](https://caustics.readthedocs.io/en/latest/?badge=latest)\n[](https://pypi.org/project/caustics/)\n[](https://app.codecov.io/gh/Ciela-Institute/caustics)\n[](https://joss.theoj.org/papers/995fa98462eb534a32952549ef2244f8)\n[](https://zenodo.org/doi/10.5281/zenodo.10806382)\n[](https://arxiv.org/abs/2406.15542)\n\n# Caustics\n\nThe lensing pipeline of the future: GPU-accelerated,\nautomatically-differentiable, highly modular. Currently under heavy development:\nexpect interface changes and some imprecise/untested calculations.\n\n## Installation\n\nSimply install `caustics` from PyPI:\n\n```bash\npip install caustics\n```\n\nNote: `Python 3.9` through `3.12` are recommended; compatibility with\nversions >=3.13 is currently untested.\n\n## Minimal Example\n\n```python\n# fmt: off\nimport matplotlib.pyplot as plt\nimport caustics\nimport torch\n\ncosmology = caustics.FlatLambdaCDM()\nsie = caustics.SIE(cosmology=cosmology, name=\"lens\", z_l=0.5, z_s=1.0, x0=-0.2, y0=0.0, q=0.4, phi=1.5708, Rein=1.7)\nsrc = 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)\nlnslt = 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)\n\nsim = caustics.LensSource(lens=sie, source=src, lens_light=lnslt, pixelscale=0.05, pixels_x=100)\n\nplt.imshow(sim(), origin=\"lower\")\nplt.axis(\"off\")\nplt.show()\n```\n\n\n\n### Batched simulator\n\n```python\nsim.to_dynamic(False)\ncosmology.to_static()\nx = sim.build_params_tensor()\nnewx = x.repeat(20, 1)\nnewx += torch.normal(mean=0, std=0.1 * torch.ones_like(newx))\n\nimages = torch.vmap(sim)(newx)\n\nfig, axarr = plt.subplots(4, 5, figsize=(20, 16))\nfor ax, im in zip(axarr.flatten(), images):\n ax.imshow(im, origin=\"lower\")\nplt.show()\n```\n\n\n\n### Automatic Differentiation\n\n```python\nJ = torch.func.jacfwd(sim)(x)\n\n# Plot the new images\nfig, axarr = plt.subplots(3, 7, figsize=(20, 9))\nfor i, ax in enumerate(axarr.flatten()):\n ax.imshow(J[..., i], origin=\"lower\")\nplt.show()\n```\n\n\n\n## Documentation\n\nPlease see our [documentation page](https://caustics.readthedocs.io/en/latest/)\nfor more detailed information.\n\n## Contribution\n\nWe welcome contributions from collaborators and researchers interested in our\nwork. If you have improvements, suggestions, or new findings to share, please\nsubmit an issue or pull request. Your contributions help advance our research\nand analysis efforts.\n\nTo get started with your development (or fork), click the \"Open with GitHub\nCodespaces\" button below to launch a fully configured development environment\nwith all the necessary tools and extensions.\n\n[](https://codespaces.new/uw-ssec/caustics?quickstart=1)\n\nInstruction on how to contribute to this project can be found in the\nCONTRIBUTION.md\n\nSome guidelines:\n\n- Please use `isort` and `black` to format your code.\n- Use `CamelCase` for class names and `snake_case` for variable and method\n names.\n- Open up issues for bugs/missing features.\n- Use pull requests for additions to the code.\n- Write tests that can be run by [`pytest`](https://docs.pytest.org/).\n\nThanks to our contributors so far!\n\n[](https://github.com/Ciela-Institute/caustics/graphs/contributors)\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) [2023] [caustics authors]\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "The lensing pipeline of the future: GPU-accelerated, automatically-differentiable, highly modular. Currently under heavy development: expect interface changes and some imprecise/untested calculations.",
"version": "1.5.0",
"project_urls": {
"Documentation": "https://caustics.readthedocs.io/en/latest/",
"Homepage": "https://mila.quebec/en/",
"Issues": "https://github.com/Ciela-Institute/caustics/issues",
"Repository": "https://github.com/Ciela-Institute/caustics"
},
"split_keywords": [
"astronomy",
" astrophysics",
" caustics",
" differentiable programming",
" gravitational lensing",
" lensing",
" pytorch",
" strong lensing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bbb767e12ac3e10199a225f3182372089595e3fbe8cb7d65587d0de28d892768",
"md5": "6c1dee4364e390a38f5e8ff8945eceb8",
"sha256": "aaef0039da4f47657473a77ac3d8853d9ffcb9962ac7029bfdbfae57cc24e736"
},
"downloads": -1,
"filename": "caustics-1.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6c1dee4364e390a38f5e8ff8945eceb8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 100601,
"upload_time": "2025-08-01T01:09:27",
"upload_time_iso_8601": "2025-08-01T01:09:27.475622Z",
"url": "https://files.pythonhosted.org/packages/bb/b7/67e12ac3e10199a225f3182372089595e3fbe8cb7d65587d0de28d892768/caustics-1.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "07d7269d95eca0935a69fb5087d35dd1e0c6254360c7a663eb6ed4adf4dee698",
"md5": "edc753a506ec85129a9b421a500a8061",
"sha256": "9a82337413981c97ab9b78a92b8d99312eb55266a4a42816ecb70dd7e1f61970"
},
"downloads": -1,
"filename": "caustics-1.5.0.tar.gz",
"has_sig": false,
"md5_digest": "edc753a506ec85129a9b421a500a8061",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 7515150,
"upload_time": "2025-08-01T01:09:28",
"upload_time_iso_8601": "2025-08-01T01:09:28.823181Z",
"url": "https://files.pythonhosted.org/packages/07/d7/269d95eca0935a69fb5087d35dd1e0c6254360c7a663eb6ed4adf4dee698/caustics-1.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-01 01:09:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Ciela-Institute",
"github_project": "caustics",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "astropy",
"specs": [
[
"<",
"7.0.0"
],
[
">=",
"6.0.0"
]
]
},
{
"name": "caskade",
"specs": [
[
">=",
"0.9.0"
]
]
},
{
"name": "graphviz",
"specs": [
[
"==",
"0.20.1"
]
]
},
{
"name": "h5py",
"specs": [
[
">=",
"3.8.0"
]
]
},
{
"name": "mpmath",
"specs": [
[
"<",
"1.4.0"
],
[
">=",
"1.3.0"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.23.5"
]
]
},
{
"name": "safetensors",
"specs": [
[
">=",
"0.4.1"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.8.0"
]
]
},
{
"name": "torch",
"specs": [
[
">=",
"2.0.0"
]
]
}
],
"lcname": "caustics"
}