PyAETNA 4.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. pyaetna-4.0.0/LICENSE +21 -0
  2. pyaetna-4.0.0/PKG-INFO +269 -0
  3. pyaetna-4.0.0/README.md +218 -0
  4. pyaetna-4.0.0/VERSION +1 -0
  5. pyaetna-4.0.0/pyproject.toml +238 -0
  6. pyaetna-4.0.0/setup.cfg +4 -0
  7. pyaetna-4.0.0/src/PyAETNA/__init__.py +9 -0
  8. pyaetna-4.0.0/src/PyAETNA/__main__.py +5 -0
  9. pyaetna-4.0.0/src/PyAETNA/_device_config.py +57 -0
  10. pyaetna-4.0.0/src/PyAETNA/_xla_flags.py +50 -0
  11. pyaetna-4.0.0/src/PyAETNA/body_models.py +2336 -0
  12. pyaetna-4.0.0/src/PyAETNA/cli.py +52 -0
  13. pyaetna-4.0.0/src/PyAETNA/gp.py +791 -0
  14. pyaetna-4.0.0/src/PyAETNA/gp_parallel.py +172 -0
  15. pyaetna-4.0.0/src/PyAETNA/kernels/factory.py +823 -0
  16. pyaetna-4.0.0/src/PyAETNA/kernels/multichannel.py +417 -0
  17. pyaetna-4.0.0/src/PyAETNA/logger.py +73 -0
  18. pyaetna-4.0.0/src/PyAETNA/model_utils.py +282 -0
  19. pyaetna-4.0.0/src/PyAETNA/outputs.py +260 -0
  20. pyaetna-4.0.0/src/PyAETNA/physics/__init__.py +6 -0
  21. pyaetna-4.0.0/src/PyAETNA/physics/orbital.py +479 -0
  22. pyaetna-4.0.0/src/PyAETNA/physics/plotting.py +767 -0
  23. pyaetna-4.0.0/src/PyAETNA/physics/priors.py +89 -0
  24. pyaetna-4.0.0/src/PyAETNA/physics/spectra.py +483 -0
  25. pyaetna-4.0.0/src/PyAETNA/physics/stellar.py +369 -0
  26. pyaetna-4.0.0/src/PyAETNA/planet_phys.py +1414 -0
  27. pyaetna-4.0.0/src/PyAETNA/provenance.py +163 -0
  28. pyaetna-4.0.0/src/PyAETNA/py.typed +0 -0
  29. pyaetna-4.0.0/src/PyAETNA/reporting/__init__.py +64 -0
  30. pyaetna-4.0.0/src/PyAETNA/reporting/confidence_bands.py +1238 -0
  31. pyaetna-4.0.0/src/PyAETNA/reporting/corner_plot.py +1204 -0
  32. pyaetna-4.0.0/src/PyAETNA/reporting/data_validation.py +116 -0
  33. pyaetna-4.0.0/src/PyAETNA/reporting/diagnostics.py +580 -0
  34. pyaetna-4.0.0/src/PyAETNA/reporting/gp_plotting.py +942 -0
  35. pyaetna-4.0.0/src/PyAETNA/reporting/grid_builder.py +1257 -0
  36. pyaetna-4.0.0/src/PyAETNA/reporting/model_components.py +894 -0
  37. pyaetna-4.0.0/src/PyAETNA/reporting/model_math.py +1096 -0
  38. pyaetna-4.0.0/src/PyAETNA/reporting/multigp_plots.py +1681 -0
  39. pyaetna-4.0.0/src/PyAETNA/reporting/noise_plots.py +406 -0
  40. pyaetna-4.0.0/src/PyAETNA/reporting/panel_detrended.py +188 -0
  41. pyaetna-4.0.0/src/PyAETNA/reporting/panel_nontime_residuals.py +467 -0
  42. pyaetna-4.0.0/src/PyAETNA/reporting/panel_overlay.py +745 -0
  43. pyaetna-4.0.0/src/PyAETNA/reporting/panel_residuals.py +109 -0
  44. pyaetna-4.0.0/src/PyAETNA/reporting/param_sorting.py +155 -0
  45. pyaetna-4.0.0/src/PyAETNA/reporting/pdf_report.py +2119 -0
  46. pyaetna-4.0.0/src/PyAETNA/reporting/periodogram_plots.py +1467 -0
  47. pyaetna-4.0.0/src/PyAETNA/reporting/phase_plots.py +1529 -0
  48. pyaetna-4.0.0/src/PyAETNA/reporting/plot_data_prep.py +1123 -0
  49. pyaetna-4.0.0/src/PyAETNA/reporting/plot_models.py +177 -0
  50. pyaetna-4.0.0/src/PyAETNA/reporting/plot_styling.py +468 -0
  51. pyaetna-4.0.0/src/PyAETNA/reporting/residual_plotting.py +419 -0
  52. pyaetna-4.0.0/src/PyAETNA/reporting/trend_detection.py +128 -0
  53. pyaetna-4.0.0/src/PyAETNA/reporting/ttv_plots.py +1226 -0
  54. pyaetna-4.0.0/src/PyAETNA/run.py +813 -0
  55. pyaetna-4.0.0/src/PyAETNA/sampling/__init__.py +19 -0
  56. pyaetna-4.0.0/src/PyAETNA/sampling/centering.py +331 -0
  57. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/__init__.py +602 -0
  58. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/_constants.py +14 -0
  59. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/detrending.py +825 -0
  60. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/gp.py +386 -0
  61. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/multigp.py +697 -0
  62. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/ordering.py +154 -0
  63. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/planets.py +699 -0
  64. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/prior_refs.py +157 -0
  65. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/scoping.py +465 -0
  66. pyaetna-4.0.0/src/PyAETNA/sampling/config/parser/star.py +647 -0
  67. pyaetna-4.0.0/src/PyAETNA/sampling/config/priors.py +266 -0
  68. pyaetna-4.0.0/src/PyAETNA/sampling/config/section.py +51 -0
  69. pyaetna-4.0.0/src/PyAETNA/sampling/config/validation.py +231 -0
  70. pyaetna-4.0.0/src/PyAETNA/sampling/data.py +243 -0
  71. pyaetna-4.0.0/src/PyAETNA/sampling/eccentricity.py +65 -0
  72. pyaetna-4.0.0/src/PyAETNA/sampling/energy.py +431 -0
  73. pyaetna-4.0.0/src/PyAETNA/sampling/engine/checkpoint.py +461 -0
  74. pyaetna-4.0.0/src/PyAETNA/sampling/engine/context.py +24 -0
  75. pyaetna-4.0.0/src/PyAETNA/sampling/engine/convergence.py +126 -0
  76. pyaetna-4.0.0/src/PyAETNA/sampling/engine/data_loader.py +335 -0
  77. pyaetna-4.0.0/src/PyAETNA/sampling/engine/eiv.py +458 -0
  78. pyaetna-4.0.0/src/PyAETNA/sampling/engine/ensemble_kernels.py +238 -0
  79. pyaetna-4.0.0/src/PyAETNA/sampling/engine/exceptions.py +47 -0
  80. pyaetna-4.0.0/src/PyAETNA/sampling/engine/execution.py +500 -0
  81. pyaetna-4.0.0/src/PyAETNA/sampling/engine/numpyro_model.py +1031 -0
  82. pyaetna-4.0.0/src/PyAETNA/sampling/engine/runner.py +150 -0
  83. pyaetna-4.0.0/src/PyAETNA/sampling/engine/sampler_settings.py +192 -0
  84. pyaetna-4.0.0/src/PyAETNA/sampling/engine/sampler_utils.py +404 -0
  85. pyaetna-4.0.0/src/PyAETNA/sampling/engine/sampling_logging.py +292 -0
  86. pyaetna-4.0.0/src/PyAETNA/sampling/engine/sampling_utils.py +707 -0
  87. pyaetna-4.0.0/src/PyAETNA/sampling/model/core.py +774 -0
  88. pyaetna-4.0.0/src/PyAETNA/sampling/model/detrending.py +315 -0
  89. pyaetna-4.0.0/src/PyAETNA/sampling/nested_sampling.py +1457 -0
  90. pyaetna-4.0.0/src/PyAETNA/sampling/peaks.py +1225 -0
  91. pyaetna-4.0.0/src/PyAETNA/sampling/precision.py +393 -0
  92. pyaetna-4.0.0/src/PyAETNA/sampling/protocols.py +140 -0
  93. pyaetna-4.0.0/src/PyAETNA/sampling/utils.py +299 -0
  94. pyaetna-4.0.0/src/PyAETNA/utils/__init__.py +4 -0
  95. pyaetna-4.0.0/src/PyAETNA/utils/constants.py +26 -0
  96. pyaetna-4.0.0/src/PyAETNA/version.py +21 -0
  97. pyaetna-4.0.0/src/PyAETNA.egg-info/PKG-INFO +269 -0
  98. pyaetna-4.0.0/src/PyAETNA.egg-info/SOURCES.txt +100 -0
  99. pyaetna-4.0.0/src/PyAETNA.egg-info/dependency_links.txt +1 -0
  100. pyaetna-4.0.0/src/PyAETNA.egg-info/entry_points.txt +2 -0
  101. pyaetna-4.0.0/src/PyAETNA.egg-info/requires.txt +29 -0
  102. pyaetna-4.0.0/src/PyAETNA.egg-info/top_level.txt +1 -0
pyaetna-4.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gaetano Scandariato
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pyaetna-4.0.0/PKG-INFO ADDED
@@ -0,0 +1,269 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyAETNA
3
+ Version: 4.0.0
4
+ Summary: Python Accelerated Exoplanet Toolkit and Noise Analysis - JAX-accelerated joint modelling of exoplanet light curves and radial velocities
5
+ Author-email: Gaetano Scandariato <gaetano.scandariato@inaf.it>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://www.ict.inaf.it/gitlab/gaetano.scandariato/pyaetna
8
+ Project-URL: Documentation, https://www.ict.inaf.it/gitlab/gaetano.scandariato/pyaetna/-/tree/main/docs
9
+ Project-URL: Repository, https://www.ict.inaf.it/gitlab/gaetano.scandariato/pyaetna.git
10
+ Project-URL: Issues, https://www.ict.inaf.it/gitlab/gaetano.scandariato/pyaetna/-/issues
11
+ Keywords: exoplanets,astronomy,mcmc,bayesian,jax,numpyro,transit,phase-curve
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: jax<0.12,>=0.7
24
+ Requires-Dist: jaxlib<0.12,>=0.7
25
+ Requires-Dist: equinox>=0.11
26
+ Requires-Dist: jaxoplanet>=0.1.0
27
+ Requires-Dist: numpyro>=0.22.0
28
+ Requires-Dist: numpy>=2.0
29
+ Requires-Dist: scipy>=1.7.0
30
+ Requires-Dist: astropy>=5.0
31
+ Requires-Dist: matplotlib>=3.5.0
32
+ Requires-Dist: pyyaml>=5.4.0
33
+ Requires-Dist: corner>=2.2.0
34
+ Requires-Dist: tqdm>=4.62.0
35
+ Requires-Dist: dill>=0.3.0
36
+ Requires-Dist: tinygp>=0.3.0
37
+ Requires-Dist: beartype>=0.18.0
38
+ Requires-Dist: blackjax>=1.6.2
39
+ Requires-Dist: optax>=0.2.4
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
42
+ Requires-Dist: pytest-cov>=3.0.0; extra == "dev"
43
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
44
+ Requires-Dist: black>=24.0.0; extra == "dev"
45
+ Requires-Dist: mypy>=1.10; extra == "dev"
46
+ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
47
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
48
+ Provides-Extra: gpu
49
+ Requires-Dist: jax[cuda12]; extra == "gpu"
50
+ Dynamic: license-file
51
+
52
+ <div align="center">
53
+ <img src="logo.jpg" alt="PyAETNA Logo" width="400"/>
54
+
55
+ <!-- # PyAETNA -->
56
+
57
+ **Python Accelerated Exoplanet Toolkit and Noise Analysis**
58
+
59
+ A JAX-based Bayesian framework for modeling and analyzing exoplanet light curves and radial velocities with advanced systematics treatment.
60
+
61
+ **Version:** 4.0.0
62
+
63
+ **Release note (v3.7.0):** named priors and cross-section parameter tying
64
+ implemented via a top-level `priors:` section and `@name` references.
65
+
66
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
67
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
68
+
69
+ </div>
70
+
71
+ ---
72
+
73
+ ## What's PyAETNA?
74
+
75
+ PyAETNA is a configuration-driven pipeline that fits transit and phase-curve light curves, radial velocities and
76
+ transit timing variations in a Bayesian framework, on a CPU or a GPU. It is built on JAX, NumPyro and BlackJAX; one
77
+ YAML file describes the whole analysis, and the same model runs unchanged on any device. Instrument systematics are
78
+ handled with polynomials, Fourier series or Gaussian processes, and a run ends with diagnostic reports ready to read.
79
+
80
+ ### Features
81
+
82
+ - **Models**: transits, secondary eclipses and phase curves (with hotspot offset, ellipsoidal variation and Doppler
83
+ beaming), the Rossiter–McLaughlin effect, Keplerian radial velocities, and free transit times (TTVs)
84
+ - **Systematics and noise**: polynomials, Fourier series, errors-in-variables detrending, Gaussian processes
85
+ (including multi-dimensional ones shared between light curves and activity indicators), white and correlated noise
86
+ - **Joint fits**: several instruments and data types at once, with shared orbital parameters and independent
87
+ systematics; parameters can be shared across components through named priors
88
+ - **Bayesian inference**: nested sampling, which returns the posterior and the Bayesian evidence for model
89
+ comparison, and the NUTS and ensemble samplers for parameter estimation; you choose the sampler, and a peak search
90
+ before sampling checks that the posterior has a single peak (or hands you one configuration per peak)
91
+ - **Reports and derived physics**: PDF reports with fits, residuals, corner and trace plots, periodograms and goodness
92
+ of fit, and the physical quantities derived from the posterior (stellar and planetary properties, energy balance,
93
+ albedos)
94
+ - **Reproducible and restartable**: checkpointed runs, portable result files, full provenance of every run
95
+
96
+ ## Why Use PyAETNA?
97
+
98
+ > **Evidence-based model comparison and realistic noise models on a laptop.** On a consumer GPU, a joint fit of
99
+ > K2-140 with its Bayesian evidence takes under a minute (56 s), and one GPU-day holds about 1500 such fits.
100
+
101
+ - **One file, one command.** The data, priors, systematics, sampler and post-processing are set in a single readable
102
+ configuration file, which an [online configurator](http://pyaetna-e92eeb.pages.ict.inaf.it/) can write for you; no
103
+ scripting is needed, and a run ends with the reports ready to read.
104
+ - **Fast on a GPU, even a consumer one.** The forward model and its derivatives are compiled with JAX and evaluated
105
+ on many points at once. On a laptop GPU, PyAETNA fits K2-140 2.1 times faster than juliet and 1.6 times faster than
106
+ PyORBIT (each running on the CPUs of the same laptop), and 3.1 to 137 times faster than allesfitter. Sixteen pairs of
107
+ runs of the two Pi Men models, with evidences, take 16 minutes against an estimated 35 hours for allesfitter. The
108
+ same configuration also runs on CPUs: it is 1.7 to 50 times faster than allesfitter there, and 1.2 times faster than
109
+ pyaneti with the same MCMC.
110
+ - **Evidences you can compare.** Its nested sampler returns the evidence together with the posterior, with a bias of
111
+ 0.1 to 0.2 nats on near-Gaussian posteriors, against 0.7 to 1.5 nats for dynesty, and within 0.5 nats of a
112
+ reference nested sampler on the benchmark data. That makes it affordable to compute the evidence of every candidate
113
+ model and to repeat it over seeds.
114
+ - **Realistic noise, at no extra setup.** Single, per-visit and multi-dimensional Gaussian processes, and
115
+ errors-in-variables detrending, run inside the same compiled likelihood; the quasiseparable GP solver handles
116
+ 10⁵ points on a laptop GPU, and PLATO-length transit light curves are tractable on one.
117
+ - **Agrees with the established codes.** On the published data sets of juliet, allesfitter, pyaneti and PyORBIT,
118
+ posterior medians agree within 0.7 sigma for almost all parameters, and injection-and-recovery tests give 68 % and
119
+ 95 % intervals that contain the true value in 69 % and 96 % of the cases.
120
+ - **Reproducible and robust.** Numerical precision is chosen automatically where it matters (transit times), runs
121
+ resume after a crash, and results are plain `.npz` and `.json` files with their provenance, readable with NumPy
122
+ alone.
123
+
124
+ For the cases where other codes are faster or better (CPU-only runs against juliet and PyORBIT, separate posterior
125
+ peaks) and for every number above, see **[How PyAETNA compares with other codes](docs/benchmarks.md)**.
126
+
127
+ ## Quick Start
128
+
129
+ ### Installation
130
+
131
+ ```bash
132
+ # Clone the repository
133
+ git clone https://www.ict.inaf.it/gitlab/gaetano.scandariato/pyaetna.git
134
+ cd pyaetna
135
+
136
+ # Create a virtual environment (an isolated, disposable copy of Python for this project)
137
+ python -m venv pyaetna-env
138
+ source pyaetna-env/bin/activate # On Windows: pyaetna-env\Scripts\activate
139
+
140
+ # Install PyAETNA — this reads pyproject.toml and pulls in every dependency it needs
141
+ pip install --upgrade pip
142
+ pip install -e .
143
+ ```
144
+
145
+ Check the installation with the quickstart example, a one-planet RV fit by
146
+ nested sampling that takes about 20 s on a laptop CPU, report included:
147
+
148
+ ```bash
149
+ cd examples && pyaetna quickstart.yaml # outputs in examples/PyAETNAouts/quickstart_*
150
+ ```
151
+
152
+ That's the whole install for CPU use. On a Linux machine with an NVIDIA GPU,
153
+ `pip install -e ".[gpu]"` instead also installs JAX's CUDA 12 wheels, which
154
+ bring their own CUDA libraries (no system CUDA toolkit is needed). For GPU support, platform-specific
155
+ notes (Linux/macOS/Windows), troubleshooting, and everything else about
156
+ setting up your environment, see the
157
+ **[Installation & Environment Guide](docs/dependencies.md)** — it's written
158
+ for first-time Python users and experienced developers alike.
159
+
160
+ ### Running an Example
161
+
162
+ Installing PyAETNA adds a `pyaetna` command:
163
+
164
+ ```bash
165
+ pyaetna examples/test_rv_only.yaml # one configuration
166
+ pyaetna examples/test_rv_only.yaml examples/test_lc_only.yaml # several, in turn
167
+ python -m PyAETNA examples/test_rv_only.yaml # equivalent, if the command is not on PATH
168
+ ```
169
+
170
+ This runs the example configured in `examples/test_rv_only.yaml`. The data file
171
+ (`data.working_dir` / `data.file_path` in the YAML) is looked up relative to the
172
+ configuration file, and results are written to `PyAETNAouts/` next to it.
173
+
174
+ For detailed examples of calling PyAETNA from Python code, see the
175
+ [programmatic usage guide](docs/programmatic_usage.md).
176
+
177
+ ## Documentation
178
+
179
+ PyAETNA is presented in the software paper Scandariato et al. (in preparation). Additional documentation is available at the following pages:
180
+
181
+ - **[How PyAETNA compares with other codes](docs/benchmarks.md)** - Speed, evidence reliability and agreement with juliet, allesfitter, pyaneti and PyORBIT, with the cases where other codes are better
182
+
183
+ - **[Installation & Environment Guide](docs/dependencies.md)** - Everything about setting up PyAETNA
184
+ - Installation instructions (CPU and GPU)
185
+ - Platform-specific notes (Linux, macOS, Windows)
186
+ - Version compatibility and troubleshooting
187
+ - Conda and Docker alternatives
188
+
189
+ - **[Configuration Guide](docs/config/index.md)** - Complete reference for all YAML configuration fields
190
+ - Samplers (nested sampling, NUTS, ensemble samplers), the peak search and convergence targets
191
+ - Prior distributions (uniform, normal, truncnorm, lognormal, beta)
192
+ - Detrending options (polynomials, Fourier, Gaussian Processes)
193
+ - Best practices and troubleshooting
194
+
195
+ - **[Online configurator](http://pyaetna-e92eeb.pages.ict.inaf.it/)** - Write or edit a configuration file in the browser
196
+ - The INAF Pages server does not offer HTTPS yet; if your browser or network refuses plain HTTP, open `docs/config-generator.html` from a copy of the repository (cloned, or downloaded over HTTPS from the repository page): it is a single static page and works offline
197
+
198
+ - **[Output & Diagnostics](docs/outputs/index.md)** - What a run writes and how to read it
199
+ - The run log, the results and sample files, the peaks of the posterior and the PDF reports
200
+ - Guides to [reading the run log](docs/outputs/run_log.md) and [the PDF reports](docs/outputs/report.md)
201
+ - Loading the results without PyAETNA
202
+
203
+ Additional resources:
204
+ - Test files in `tests/`
205
+ - Inline documentation and docstrings in source code
206
+
207
+ ## Contributing
208
+
209
+ Contributions are very welcome! Whether you are fixing a bug, adding a new physics or detrending model, improving performance, or enhancing the documentation, your help is appreciated.
210
+
211
+ Before changing the models or the samplers, read the [notes for developers](docs/developer_notes.md): the
212
+ numerical-precision constraints, the workarounds for upstream faults, and how to test a change with both samplers.
213
+
214
+ ### Setting Up a Development Environment
215
+
216
+ Fork and clone the repository, then follow the
217
+ [Development Environment](docs/dependencies.md#development-environment)
218
+ section of the Installation & Environment Guide — it walks through creating
219
+ the environment, installing the `dev` extra (`pytest`, `ruff`, `black`,
220
+ `mypy`), and enabling `pre-commit`.
221
+
222
+ ### Code Style & Quality Standards
223
+
224
+ PyAETNA enforces automated code formatting, linting, and static type safety:
225
+
226
+ - **Formatting (`black`)**: Code must conform to Black's standard style (line length 88). Check and format with:
227
+ ```bash
228
+ black PyAETNA/ tests/
229
+ ```
230
+ - **Linting (`ruff`)**: Code must pass Ruff linter checks cleanly. Check with:
231
+ ```bash
232
+ ruff check PyAETNA/ tests/
233
+ ```
234
+ - **Static Type Checking (`mypy`)**: Function signatures should include Python type hints (`from __future__ import annotations`). Verify static types with:
235
+ ```bash
236
+ mypy PyAETNA/
237
+ ```
238
+ - **Runtime Type Checks (`beartype`)**: Public API and configuration entry points use `@beartype` to enforce contract safety for user inputs.
239
+ - **Unit & Integration Tests (`pytest`)**: Always verify the test suite passes before submitting a Pull Request:
240
+ ```bash
241
+ pytest tests/ -v
242
+ ```
243
+
244
+ ### Submitting a Pull Request
245
+
246
+ 1. Create a feature branch off `main` (`git checkout -b feat/your-feature-name`).
247
+ 2. Implement your changes along with corresponding unit tests in `tests/`.
248
+ 3. Verify that `black`, `ruff`, `mypy`, and `pytest` all pass locally.
249
+ 4. Commit your work with concise, descriptive commit messages and open a Pull Request.
250
+
251
+ ## Citation
252
+
253
+ If you use PyAETNA in your research, please add the following citation in your publication:
254
+
255
+ #TODO add bibtex citation to PyAETNA
256
+
257
+ Please also cite the relevant works
258
+ listed in [docs/CITATIONS.md](docs/CITATIONS.md). For your convenience, at the end of every run the
259
+ log prints a tailored list of references based on the modules and
260
+ features activated in your analysis, together with a pointer to the
261
+ BibTeX entries.
262
+
263
+ ## License
264
+
265
+ This project is licensed under the MIT License — see the [LICENSE](LICENSE) file.
266
+
267
+ ## Contact
268
+
269
+ gaetano.scandariato [at] inaf.it
@@ -0,0 +1,218 @@
1
+ <div align="center">
2
+ <img src="logo.jpg" alt="PyAETNA Logo" width="400"/>
3
+
4
+ <!-- # PyAETNA -->
5
+
6
+ **Python Accelerated Exoplanet Toolkit and Noise Analysis**
7
+
8
+ A JAX-based Bayesian framework for modeling and analyzing exoplanet light curves and radial velocities with advanced systematics treatment.
9
+
10
+ **Version:** 4.0.0
11
+
12
+ **Release note (v3.7.0):** named priors and cross-section parameter tying
13
+ implemented via a top-level `priors:` section and `@name` references.
14
+
15
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
16
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## What's PyAETNA?
23
+
24
+ PyAETNA is a configuration-driven pipeline that fits transit and phase-curve light curves, radial velocities and
25
+ transit timing variations in a Bayesian framework, on a CPU or a GPU. It is built on JAX, NumPyro and BlackJAX; one
26
+ YAML file describes the whole analysis, and the same model runs unchanged on any device. Instrument systematics are
27
+ handled with polynomials, Fourier series or Gaussian processes, and a run ends with diagnostic reports ready to read.
28
+
29
+ ### Features
30
+
31
+ - **Models**: transits, secondary eclipses and phase curves (with hotspot offset, ellipsoidal variation and Doppler
32
+ beaming), the Rossiter–McLaughlin effect, Keplerian radial velocities, and free transit times (TTVs)
33
+ - **Systematics and noise**: polynomials, Fourier series, errors-in-variables detrending, Gaussian processes
34
+ (including multi-dimensional ones shared between light curves and activity indicators), white and correlated noise
35
+ - **Joint fits**: several instruments and data types at once, with shared orbital parameters and independent
36
+ systematics; parameters can be shared across components through named priors
37
+ - **Bayesian inference**: nested sampling, which returns the posterior and the Bayesian evidence for model
38
+ comparison, and the NUTS and ensemble samplers for parameter estimation; you choose the sampler, and a peak search
39
+ before sampling checks that the posterior has a single peak (or hands you one configuration per peak)
40
+ - **Reports and derived physics**: PDF reports with fits, residuals, corner and trace plots, periodograms and goodness
41
+ of fit, and the physical quantities derived from the posterior (stellar and planetary properties, energy balance,
42
+ albedos)
43
+ - **Reproducible and restartable**: checkpointed runs, portable result files, full provenance of every run
44
+
45
+ ## Why Use PyAETNA?
46
+
47
+ > **Evidence-based model comparison and realistic noise models on a laptop.** On a consumer GPU, a joint fit of
48
+ > K2-140 with its Bayesian evidence takes under a minute (56 s), and one GPU-day holds about 1500 such fits.
49
+
50
+ - **One file, one command.** The data, priors, systematics, sampler and post-processing are set in a single readable
51
+ configuration file, which an [online configurator](http://pyaetna-e92eeb.pages.ict.inaf.it/) can write for you; no
52
+ scripting is needed, and a run ends with the reports ready to read.
53
+ - **Fast on a GPU, even a consumer one.** The forward model and its derivatives are compiled with JAX and evaluated
54
+ on many points at once. On a laptop GPU, PyAETNA fits K2-140 2.1 times faster than juliet and 1.6 times faster than
55
+ PyORBIT (each running on the CPUs of the same laptop), and 3.1 to 137 times faster than allesfitter. Sixteen pairs of
56
+ runs of the two Pi Men models, with evidences, take 16 minutes against an estimated 35 hours for allesfitter. The
57
+ same configuration also runs on CPUs: it is 1.7 to 50 times faster than allesfitter there, and 1.2 times faster than
58
+ pyaneti with the same MCMC.
59
+ - **Evidences you can compare.** Its nested sampler returns the evidence together with the posterior, with a bias of
60
+ 0.1 to 0.2 nats on near-Gaussian posteriors, against 0.7 to 1.5 nats for dynesty, and within 0.5 nats of a
61
+ reference nested sampler on the benchmark data. That makes it affordable to compute the evidence of every candidate
62
+ model and to repeat it over seeds.
63
+ - **Realistic noise, at no extra setup.** Single, per-visit and multi-dimensional Gaussian processes, and
64
+ errors-in-variables detrending, run inside the same compiled likelihood; the quasiseparable GP solver handles
65
+ 10⁵ points on a laptop GPU, and PLATO-length transit light curves are tractable on one.
66
+ - **Agrees with the established codes.** On the published data sets of juliet, allesfitter, pyaneti and PyORBIT,
67
+ posterior medians agree within 0.7 sigma for almost all parameters, and injection-and-recovery tests give 68 % and
68
+ 95 % intervals that contain the true value in 69 % and 96 % of the cases.
69
+ - **Reproducible and robust.** Numerical precision is chosen automatically where it matters (transit times), runs
70
+ resume after a crash, and results are plain `.npz` and `.json` files with their provenance, readable with NumPy
71
+ alone.
72
+
73
+ For the cases where other codes are faster or better (CPU-only runs against juliet and PyORBIT, separate posterior
74
+ peaks) and for every number above, see **[How PyAETNA compares with other codes](docs/benchmarks.md)**.
75
+
76
+ ## Quick Start
77
+
78
+ ### Installation
79
+
80
+ ```bash
81
+ # Clone the repository
82
+ git clone https://www.ict.inaf.it/gitlab/gaetano.scandariato/pyaetna.git
83
+ cd pyaetna
84
+
85
+ # Create a virtual environment (an isolated, disposable copy of Python for this project)
86
+ python -m venv pyaetna-env
87
+ source pyaetna-env/bin/activate # On Windows: pyaetna-env\Scripts\activate
88
+
89
+ # Install PyAETNA — this reads pyproject.toml and pulls in every dependency it needs
90
+ pip install --upgrade pip
91
+ pip install -e .
92
+ ```
93
+
94
+ Check the installation with the quickstart example, a one-planet RV fit by
95
+ nested sampling that takes about 20 s on a laptop CPU, report included:
96
+
97
+ ```bash
98
+ cd examples && pyaetna quickstart.yaml # outputs in examples/PyAETNAouts/quickstart_*
99
+ ```
100
+
101
+ That's the whole install for CPU use. On a Linux machine with an NVIDIA GPU,
102
+ `pip install -e ".[gpu]"` instead also installs JAX's CUDA 12 wheels, which
103
+ bring their own CUDA libraries (no system CUDA toolkit is needed). For GPU support, platform-specific
104
+ notes (Linux/macOS/Windows), troubleshooting, and everything else about
105
+ setting up your environment, see the
106
+ **[Installation & Environment Guide](docs/dependencies.md)** — it's written
107
+ for first-time Python users and experienced developers alike.
108
+
109
+ ### Running an Example
110
+
111
+ Installing PyAETNA adds a `pyaetna` command:
112
+
113
+ ```bash
114
+ pyaetna examples/test_rv_only.yaml # one configuration
115
+ pyaetna examples/test_rv_only.yaml examples/test_lc_only.yaml # several, in turn
116
+ python -m PyAETNA examples/test_rv_only.yaml # equivalent, if the command is not on PATH
117
+ ```
118
+
119
+ This runs the example configured in `examples/test_rv_only.yaml`. The data file
120
+ (`data.working_dir` / `data.file_path` in the YAML) is looked up relative to the
121
+ configuration file, and results are written to `PyAETNAouts/` next to it.
122
+
123
+ For detailed examples of calling PyAETNA from Python code, see the
124
+ [programmatic usage guide](docs/programmatic_usage.md).
125
+
126
+ ## Documentation
127
+
128
+ PyAETNA is presented in the software paper Scandariato et al. (in preparation). Additional documentation is available at the following pages:
129
+
130
+ - **[How PyAETNA compares with other codes](docs/benchmarks.md)** - Speed, evidence reliability and agreement with juliet, allesfitter, pyaneti and PyORBIT, with the cases where other codes are better
131
+
132
+ - **[Installation & Environment Guide](docs/dependencies.md)** - Everything about setting up PyAETNA
133
+ - Installation instructions (CPU and GPU)
134
+ - Platform-specific notes (Linux, macOS, Windows)
135
+ - Version compatibility and troubleshooting
136
+ - Conda and Docker alternatives
137
+
138
+ - **[Configuration Guide](docs/config/index.md)** - Complete reference for all YAML configuration fields
139
+ - Samplers (nested sampling, NUTS, ensemble samplers), the peak search and convergence targets
140
+ - Prior distributions (uniform, normal, truncnorm, lognormal, beta)
141
+ - Detrending options (polynomials, Fourier, Gaussian Processes)
142
+ - Best practices and troubleshooting
143
+
144
+ - **[Online configurator](http://pyaetna-e92eeb.pages.ict.inaf.it/)** - Write or edit a configuration file in the browser
145
+ - The INAF Pages server does not offer HTTPS yet; if your browser or network refuses plain HTTP, open `docs/config-generator.html` from a copy of the repository (cloned, or downloaded over HTTPS from the repository page): it is a single static page and works offline
146
+
147
+ - **[Output & Diagnostics](docs/outputs/index.md)** - What a run writes and how to read it
148
+ - The run log, the results and sample files, the peaks of the posterior and the PDF reports
149
+ - Guides to [reading the run log](docs/outputs/run_log.md) and [the PDF reports](docs/outputs/report.md)
150
+ - Loading the results without PyAETNA
151
+
152
+ Additional resources:
153
+ - Test files in `tests/`
154
+ - Inline documentation and docstrings in source code
155
+
156
+ ## Contributing
157
+
158
+ Contributions are very welcome! Whether you are fixing a bug, adding a new physics or detrending model, improving performance, or enhancing the documentation, your help is appreciated.
159
+
160
+ Before changing the models or the samplers, read the [notes for developers](docs/developer_notes.md): the
161
+ numerical-precision constraints, the workarounds for upstream faults, and how to test a change with both samplers.
162
+
163
+ ### Setting Up a Development Environment
164
+
165
+ Fork and clone the repository, then follow the
166
+ [Development Environment](docs/dependencies.md#development-environment)
167
+ section of the Installation & Environment Guide — it walks through creating
168
+ the environment, installing the `dev` extra (`pytest`, `ruff`, `black`,
169
+ `mypy`), and enabling `pre-commit`.
170
+
171
+ ### Code Style & Quality Standards
172
+
173
+ PyAETNA enforces automated code formatting, linting, and static type safety:
174
+
175
+ - **Formatting (`black`)**: Code must conform to Black's standard style (line length 88). Check and format with:
176
+ ```bash
177
+ black PyAETNA/ tests/
178
+ ```
179
+ - **Linting (`ruff`)**: Code must pass Ruff linter checks cleanly. Check with:
180
+ ```bash
181
+ ruff check PyAETNA/ tests/
182
+ ```
183
+ - **Static Type Checking (`mypy`)**: Function signatures should include Python type hints (`from __future__ import annotations`). Verify static types with:
184
+ ```bash
185
+ mypy PyAETNA/
186
+ ```
187
+ - **Runtime Type Checks (`beartype`)**: Public API and configuration entry points use `@beartype` to enforce contract safety for user inputs.
188
+ - **Unit & Integration Tests (`pytest`)**: Always verify the test suite passes before submitting a Pull Request:
189
+ ```bash
190
+ pytest tests/ -v
191
+ ```
192
+
193
+ ### Submitting a Pull Request
194
+
195
+ 1. Create a feature branch off `main` (`git checkout -b feat/your-feature-name`).
196
+ 2. Implement your changes along with corresponding unit tests in `tests/`.
197
+ 3. Verify that `black`, `ruff`, `mypy`, and `pytest` all pass locally.
198
+ 4. Commit your work with concise, descriptive commit messages and open a Pull Request.
199
+
200
+ ## Citation
201
+
202
+ If you use PyAETNA in your research, please add the following citation in your publication:
203
+
204
+ #TODO add bibtex citation to PyAETNA
205
+
206
+ Please also cite the relevant works
207
+ listed in [docs/CITATIONS.md](docs/CITATIONS.md). For your convenience, at the end of every run the
208
+ log prints a tailored list of references based on the modules and
209
+ features activated in your analysis, together with a pointer to the
210
+ BibTeX entries.
211
+
212
+ ## License
213
+
214
+ This project is licensed under the MIT License — see the [LICENSE](LICENSE) file.
215
+
216
+ ## Contact
217
+
218
+ gaetano.scandariato [at] inaf.it
pyaetna-4.0.0/VERSION ADDED
@@ -0,0 +1 @@
1
+ 4.0.0