orbix 4.2.0__tar.gz → 5.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.
- {orbix-4.2.0 → orbix-5.0.0}/.pre-commit-config.yaml +2 -6
- {orbix-4.2.0 → orbix-5.0.0}/CHANGELOG.md +29 -42
- {orbix-4.2.0 → orbix-5.0.0}/PKG-INFO +27 -20
- {orbix-4.2.0 → orbix-5.0.0}/README.md +25 -18
- {orbix-4.2.0 → orbix-5.0.0}/docs/examples/orbits.md +105 -54
- {orbix-4.2.0 → orbix-5.0.0}/docs/examples/prepared.md +42 -32
- {orbix-4.2.0 → orbix-5.0.0}/docs/gallery.md +151 -80
- {orbix-4.2.0 → orbix-5.0.0}/docs/index.md +17 -8
- orbix-5.0.0/docs/migration.md +45 -0
- {orbix-4.2.0 → orbix-5.0.0}/pyproject.toml +1 -1
- orbix-5.0.0/src/orbix/__init__.py +5 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/_version.py +2 -2
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/equations/__init__.py +2 -14
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/equations/orbit.py +62 -89
- orbix-5.0.0/src/orbix/kepler/__init__.py +5 -0
- orbix-5.0.0/src/orbix/kepler/_grid.py +36 -0
- orbix-4.2.0/src/orbix/kepler/markley.py → orbix-5.0.0/src/orbix/kepler/_markley.py +53 -61
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/kepler/longitude.py +4 -4
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/observatory/__init__.py +8 -2
- orbix-5.0.0/src/orbix/observatory/observatory.py +191 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/observatory/orbit.py +4 -4
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/observatory/solar_system.py +5 -11
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/system/__init__.py +26 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/system/charts.py +129 -10
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/system/frame_orbit.py +37 -0
- orbix-5.0.0/src/orbix/system/linear.py +200 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/system/rotation.py +12 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/viz/_prepare.py +94 -62
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/viz/anim.py +30 -29
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/viz/orbit.py +48 -132
- {orbix-4.2.0 → orbix-5.0.0}/tests/conftest.py +2 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_charts.py +306 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_frame_orbit.py +106 -5
- orbix-5.0.0/tests/test_grid_solvers.py +164 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_kepler_core.py +21 -44
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_kepler_grads.py +4 -4
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_kepler_longitude.py +3 -4
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_kepler_markley.py +33 -17
- orbix-5.0.0/tests/test_observatory_wrapper.py +233 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_sky_convention.py +95 -125
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_system_ephemeris.py +0 -50
- orbix-5.0.0/tests/test_thiele_innes_inverse.py +64 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_viz_anim.py +74 -55
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_viz_orbit.py +49 -96
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_viz_package.py +1 -1
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_viz_prepared.py +105 -98
- orbix-4.2.0/src/orbix/__init__.py +0 -6
- orbix-4.2.0/src/orbix/equations/phase.py +0 -28
- orbix-4.2.0/src/orbix/equations/propagation.py +0 -157
- orbix-4.2.0/src/orbix/kepler/__init__.py +0 -19
- orbix-4.2.0/src/orbix/kepler/core.py +0 -624
- orbix-4.2.0/src/orbix/kepler/shortcuts/__init__.py +0 -5
- orbix-4.2.0/src/orbix/kepler/shortcuts/fixed_e.py +0 -162
- orbix-4.2.0/src/orbix/kepler/shortcuts/grid.py +0 -363
- orbix-4.2.0/src/orbix/kepler/shortcuts/guess.py +0 -32
- orbix-4.2.0/src/orbix/observatory/observatory.py +0 -43
- orbix-4.2.0/src/orbix/orbit.py +0 -528
- orbix-4.2.0/tests/test_fixed_e_solvers.py +0 -85
- orbix-4.2.0/tests/test_grid_solvers.py +0 -229
- orbix-4.2.0/tests/test_internal_refs_guard.py +0 -60
- orbix-4.2.0/tests/test_observatory_wrapper.py +0 -56
- orbix-4.2.0/tests/test_orbit.py +0 -651
- orbix-4.2.0/tools/check_internal_refs.py +0 -80
- {orbix-4.2.0 → orbix-5.0.0}/.codespellrc +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.editorconfig +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.gitattributes +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/dependabot.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/scripts/ci_summary.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/sibling-pins.txt +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/ci.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/dependabot-automerge.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/docs.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/hygiene.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/publish-to-pypi.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/release-please.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/workflows/upstream.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.github/zizmor.yml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.gitignore +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.python-version +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.readthedocs.yaml +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/.zenodo.json +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/CITATION.cff +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/LICENSE +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/SECURITY.md +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/docs/conf.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/equations/lambert.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/observatory/data/L2_halo_orbit_six_month.npz +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/observatory/keepout.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/py.typed +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/system/core.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/system/observables.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/viz/__init__.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/src/orbix/viz/_require.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_dependency_floors.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_equations_grads.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_lambert.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_observatory.py +0 -0
- {orbix-4.2.0 → orbix-5.0.0}/tests/test_vs_exosims.py +0 -0
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
repos:
|
|
2
|
-
- repo:
|
|
2
|
+
- repo: https://github.com/CoreySpohn/hwoutils
|
|
3
|
+
rev: 7ea5d77
|
|
3
4
|
hooks:
|
|
4
5
|
- id: no-internal-refs
|
|
5
|
-
name: no internal research references
|
|
6
|
-
entry: python3 tools/check_internal_refs.py
|
|
7
|
-
language: system
|
|
8
|
-
types: [text]
|
|
9
|
-
exclude: ^(CHANGELOG\.md|tools/check_internal_refs\.py)$
|
|
10
6
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
11
7
|
rev: "v6.0.0"
|
|
12
8
|
hooks:
|
|
@@ -1,47 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
sky positions; elements fitted against earlier `position_arcsec` outputs
|
|
33
|
-
convert by i' = 180 deg - i, Omega' = (90 deg - Omega) mod 360, with a, e,
|
|
34
|
-
omega and the epoch terms unchanged. Rerun figures drawn from
|
|
35
|
-
`position_arcsec`.
|
|
36
|
-
|
|
37
|
-
### Removed / moved (not a release-please entry; folded into the next release notes)
|
|
38
|
-
|
|
39
|
-
* Orbit fitting (the `fitting` module and its `numpyro` extra) moved to photomancy.
|
|
40
|
-
* `Planets`/`System`/`Star` and the EXOSIMS integration moved to exosims-plugins.
|
|
41
|
-
* Zodiacal photometry moved to skyscapes.
|
|
42
|
-
* `quasi_random` (the vendored Roberts quasi-random sequence) moved to photomancy.
|
|
43
|
-
* The broken predict/pdet functions and the `discrete_e` factory were removed
|
|
44
|
-
(they did not work correctly and had no working callers).
|
|
3
|
+
## [5.0.0](https://github.com/CoreySpohn/orbix/compare/v4.2.0...v5.0.0) (2026-11-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* expose sky_block_geometry as the public projected-orbit scale and gap
|
|
9
|
+
* **viz:** remove legacy viz keywords; time_d only
|
|
10
|
+
* delete the Lambert phase copies and add quaternion rotation from an axis and angle
|
|
11
|
+
* remove the angle-field orbit class and the positional eccentric-anomaly solvers
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* expose sky_block_geometry as the public projected-orbit scale and gap ([73cb76e](https://github.com/CoreySpohn/orbix/commit/73cb76eedc81bbee6449b0f25bd7494b5eb7047c))
|
|
16
|
+
* expose the disk map, periapsis chart shape and line-of-sight branch ([0565a6f](https://github.com/CoreySpohn/orbix/commit/0565a6fc6064c69a8ab03e270c7fe6439322be5c))
|
|
17
|
+
* invert Thiele-Innes constants to Campbell elements ([a731568](https://github.com/CoreySpohn/orbix/commit/a731568b74974a79a191637cef4916cc9b29ee76))
|
|
18
|
+
* **observatory:** observability at day offsets from an epoch and summarized over an interval ([bc01fcc](https://github.com/CoreySpohn/orbix/commit/bc01fcc0f8766ba4daf99b3a8d8d789d18a14ca5))
|
|
19
|
+
* remove the angle-field orbit class and the positional eccentric-anomaly solvers ([3cd51b8](https://github.com/CoreySpohn/orbix/commit/3cd51b88773dc08d6a71a3f27d741e25115bea17))
|
|
20
|
+
* **system:** the linear map and in-plane basis of an orbit, a Thiele-Innes chart and a conditional linear fit ([12651f3](https://github.com/CoreySpohn/orbix/commit/12651f3d102912d09cb1f48c1e0211b1a9686b54))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* require the hwoutils release that carries the epoch type ([9419545](https://github.com/CoreySpohn/orbix/commit/9419545363a951dcf2c1418763f06aabd9253f9d))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Code Refactoring
|
|
29
|
+
|
|
30
|
+
* delete the Lambert phase copies and add quaternion rotation from an axis and angle ([c9b1485](https://github.com/CoreySpohn/orbix/commit/c9b148555c8f940bd0605f617936ce14ab891ab4))
|
|
31
|
+
* **viz:** remove legacy viz keywords; time_d only ([63d90e9](https://github.com/CoreySpohn/orbix/commit/63d90e9560258b8cb1c045f6bdb9bb68b86d0a93))
|
|
45
32
|
|
|
46
33
|
## [4.2.0](https://github.com/CoreySpohn/orbix/compare/v4.1.0...v4.2.0) (2026-11-16)
|
|
47
34
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: orbix
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.0.0
|
|
4
4
|
Summary: A JAX library of functions useful for exoplanet simulations
|
|
5
5
|
Project-URL: Homepage, https://github.com/CoreySpohn/orbix
|
|
6
6
|
Project-URL: Issues, https://github.com/CoreySpohn/orbix/issues
|
|
@@ -28,7 +28,7 @@ License: MIT License
|
|
|
28
28
|
License-File: LICENSE
|
|
29
29
|
Requires-Python: >=3.12
|
|
30
30
|
Requires-Dist: equinox>=0.13.2
|
|
31
|
-
Requires-Dist: hwoutils>=
|
|
31
|
+
Requires-Dist: hwoutils>=2.0.0
|
|
32
32
|
Requires-Dist: interpax>=0.3.3
|
|
33
33
|
Requires-Dist: jax>=0.4.34
|
|
34
34
|
Requires-Dist: jaxtyping>=0.3.3
|
|
@@ -92,33 +92,38 @@ pip install orbix
|
|
|
92
92
|
|
|
93
93
|
```python
|
|
94
94
|
import jax.numpy as jnp
|
|
95
|
-
from
|
|
96
|
-
from orbix.
|
|
95
|
+
from hwoutils.constants import G, Msun2kg
|
|
96
|
+
from orbix.system import FrameOrbit, offset_arcsec, phase_angle_rad, distance_AU
|
|
97
97
|
|
|
98
|
-
orbit =
|
|
98
|
+
orbit = FrameOrbit.from_classical(
|
|
99
99
|
a_AU=1.0,
|
|
100
100
|
e=0.0167,
|
|
101
101
|
W_rad=0.0,
|
|
102
102
|
i_rad=0.0,
|
|
103
103
|
w_rad=0.0,
|
|
104
104
|
M0_rad=0.0,
|
|
105
|
-
|
|
105
|
+
epoch_d=0.0,
|
|
106
|
+
mu_AU3_per_d2=G * Msun2kg,
|
|
106
107
|
)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
time_d = jnp.linspace(0.0, 365.25, 5)
|
|
109
|
+
r_AU, v_AU_per_d = orbit.at(time_d)
|
|
110
|
+
beta_rad = phase_angle_rad(r_AU)
|
|
111
|
+
radius_AU = distance_AU(r_AU)
|
|
112
|
+
raoff, decoff = offset_arcsec(r_AU, 10.0)
|
|
113
|
+
print(r_AU.shape) # (5, 3): (T times, xyz)
|
|
111
114
|
```
|
|
112
115
|
|
|
113
|
-
`
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
and
|
|
116
|
+
`FrameOrbit` stores a non-singular orbit frame and propagates through
|
|
117
|
+
`at(time_d)`. Times are days on the same origin as `epoch_d`; positions and
|
|
118
|
+
velocities have shape `(*batch, T, 3)`. `System` constructs Jacobi orbits for
|
|
119
|
+
multiple bodies and returns a solve-once `Ephemeris` through `solve(time_d)`.
|
|
120
|
+
The package root exports only `__version__`; import engine names from
|
|
121
|
+
`orbix.system` and solver names from `orbix.kepler`.
|
|
117
122
|
|
|
118
123
|
Raw orbit rows are **(east, north, away)** in AU, a right-handed frame.
|
|
119
124
|
Velocities share this order in AU/day; dz/dt is the body's radial velocity
|
|
120
125
|
relative to the star, positive receding. `state_vector_to_keplerian` takes
|
|
121
|
-
position and velocity in that frame. `
|
|
126
|
+
position and velocity in that frame. `offset_arcsec` returns `(raoff,
|
|
122
127
|
decoff)` = (Delta alpha cos delta, Delta delta), east and north offsets in
|
|
123
128
|
arcsec. Omega is the ascending (receding) node's PA measured north through
|
|
124
129
|
east; i < 90 deg gives increasing PA, and omega is measured from that node
|
|
@@ -126,12 +131,14 @@ in the direction of motion. Phase angle is beta, with cos(beta) = z/r;
|
|
|
126
131
|
alpha denotes angular separation. See the documentation's sky-coordinate
|
|
127
132
|
convention for details.
|
|
128
133
|
|
|
129
|
-
|
|
130
|
-
`
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
The default solver is the table-free `Markley()` strategy. Pass
|
|
135
|
+
`solver=Halley()` or `solver=Grid()` to `at`, `solve`, or the non-singular
|
|
136
|
+
`kepler(mean_longitude, ex, ey, solver=...)` function from `orbix.kepler`.
|
|
137
|
+
It returns `(sin(F), cos(F))` for `lambda = F - ex*sin(F) + ey*cos(F)`,
|
|
138
|
+
where `(ex, ey) = e*(cos(p), sin(p))` and `p` is longitude of periapsis.
|
|
139
|
+
All strategies support broadcasting and implicit forward/reverse derivatives,
|
|
140
|
+
including circular orbits and higher orders. Enable
|
|
133
141
|
`jax.config.update("jax_enable_x64", True)` for double-precision accuracy.
|
|
134
|
-
The RPP/orvara solver remains available in `orbix.kepler.core`.
|
|
135
142
|
|
|
136
143
|
## Scope
|
|
137
144
|
|
|
@@ -25,33 +25,38 @@ pip install orbix
|
|
|
25
25
|
|
|
26
26
|
```python
|
|
27
27
|
import jax.numpy as jnp
|
|
28
|
-
from
|
|
29
|
-
from orbix.
|
|
28
|
+
from hwoutils.constants import G, Msun2kg
|
|
29
|
+
from orbix.system import FrameOrbit, offset_arcsec, phase_angle_rad, distance_AU
|
|
30
30
|
|
|
31
|
-
orbit =
|
|
31
|
+
orbit = FrameOrbit.from_classical(
|
|
32
32
|
a_AU=1.0,
|
|
33
33
|
e=0.0167,
|
|
34
34
|
W_rad=0.0,
|
|
35
35
|
i_rad=0.0,
|
|
36
36
|
w_rad=0.0,
|
|
37
37
|
M0_rad=0.0,
|
|
38
|
-
|
|
38
|
+
epoch_d=0.0,
|
|
39
|
+
mu_AU3_per_d2=G * Msun2kg,
|
|
39
40
|
)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
time_d = jnp.linspace(0.0, 365.25, 5)
|
|
42
|
+
r_AU, v_AU_per_d = orbit.at(time_d)
|
|
43
|
+
beta_rad = phase_angle_rad(r_AU)
|
|
44
|
+
radius_AU = distance_AU(r_AU)
|
|
45
|
+
raoff, decoff = offset_arcsec(r_AU, 10.0)
|
|
46
|
+
print(r_AU.shape) # (5, 3): (T times, xyz)
|
|
44
47
|
```
|
|
45
48
|
|
|
46
|
-
`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
and
|
|
49
|
+
`FrameOrbit` stores a non-singular orbit frame and propagates through
|
|
50
|
+
`at(time_d)`. Times are days on the same origin as `epoch_d`; positions and
|
|
51
|
+
velocities have shape `(*batch, T, 3)`. `System` constructs Jacobi orbits for
|
|
52
|
+
multiple bodies and returns a solve-once `Ephemeris` through `solve(time_d)`.
|
|
53
|
+
The package root exports only `__version__`; import engine names from
|
|
54
|
+
`orbix.system` and solver names from `orbix.kepler`.
|
|
50
55
|
|
|
51
56
|
Raw orbit rows are **(east, north, away)** in AU, a right-handed frame.
|
|
52
57
|
Velocities share this order in AU/day; dz/dt is the body's radial velocity
|
|
53
58
|
relative to the star, positive receding. `state_vector_to_keplerian` takes
|
|
54
|
-
position and velocity in that frame. `
|
|
59
|
+
position and velocity in that frame. `offset_arcsec` returns `(raoff,
|
|
55
60
|
decoff)` = (Delta alpha cos delta, Delta delta), east and north offsets in
|
|
56
61
|
arcsec. Omega is the ascending (receding) node's PA measured north through
|
|
57
62
|
east; i < 90 deg gives increasing PA, and omega is measured from that node
|
|
@@ -59,12 +64,14 @@ in the direction of motion. Phase angle is beta, with cos(beta) = z/r;
|
|
|
59
64
|
alpha denotes angular separation. See the documentation's sky-coordinate
|
|
60
65
|
convention for details.
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
`
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
The default solver is the table-free `Markley()` strategy. Pass
|
|
68
|
+
`solver=Halley()` or `solver=Grid()` to `at`, `solve`, or the non-singular
|
|
69
|
+
`kepler(mean_longitude, ex, ey, solver=...)` function from `orbix.kepler`.
|
|
70
|
+
It returns `(sin(F), cos(F))` for `lambda = F - ex*sin(F) + ey*cos(F)`,
|
|
71
|
+
where `(ex, ey) = e*(cos(p), sin(p))` and `p` is longitude of periapsis.
|
|
72
|
+
All strategies support broadcasting and implicit forward/reverse derivatives,
|
|
73
|
+
including circular orbits and higher orders. Enable
|
|
66
74
|
`jax.config.update("jax_enable_x64", True)` for double-precision accuracy.
|
|
67
|
-
The RPP/orvara solver remains available in `orbix.kepler.core`.
|
|
68
75
|
|
|
69
76
|
## Scope
|
|
70
77
|
|
|
@@ -26,9 +26,11 @@ import hwostyle
|
|
|
26
26
|
import matplotlib
|
|
27
27
|
import jax.numpy as jnp
|
|
28
28
|
import numpy as np
|
|
29
|
+
from dataclasses import replace
|
|
29
30
|
import eyepiece as ep
|
|
30
31
|
|
|
31
|
-
from orbix import
|
|
32
|
+
from orbix.system import Body, FrameOrbit, SkyFrame, System, offset_arcsec
|
|
33
|
+
from hwoutils.constants import G, Msun2kg
|
|
32
34
|
from orbix import viz
|
|
33
35
|
|
|
34
36
|
hwostyle.use("dark")
|
|
@@ -43,7 +45,7 @@ matplotlib.rcParams["font.sans-serif"] = list(
|
|
|
43
45
|
) + ["DejaVu Sans"]
|
|
44
46
|
matplotlib.rcParams["figure.dpi"] = 160
|
|
45
47
|
|
|
46
|
-
styles = ep.SourceStyles(["planet b", "planet c", "planet d"])
|
|
48
|
+
styles = ep.style.SourceStyles(["planet b", "planet c", "planet d"])
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
## One orbit on the sky
|
|
@@ -59,24 +61,31 @@ functions share one preparation step that propagates the orbit once; the
|
|
|
59
61
|
one set of tracks.
|
|
60
62
|
|
|
61
63
|
```{code-cell} ipython3
|
|
62
|
-
|
|
64
|
+
MU = G * Msun2kg
|
|
63
65
|
|
|
64
66
|
# The elements are named because the posterior fan further down is built
|
|
65
67
|
# around this same orbit.
|
|
66
68
|
A_AU, ECC, INC_RAD = 1.3, 0.31, 1.05
|
|
67
69
|
BIG_OMEGA_RAD, SMALL_OMEGA_RAD, M0_RAD = 2.3, -0.7, 0.4
|
|
68
|
-
T0_D =
|
|
70
|
+
T0_D = 0.0
|
|
71
|
+
# Float days from the chosen epoch.
|
|
69
72
|
|
|
70
73
|
# Kepler's third law for a solar-mass star, so the track spans exactly one
|
|
71
74
|
# period and the ellipse closes instead of stopping in mid-air.
|
|
72
|
-
PERIOD_D =
|
|
75
|
+
PERIOD_D = 2 * np.pi * np.sqrt(A_AU**3 / MU)
|
|
73
76
|
PERIAPSIS_D = T0_D - M0_RAD * PERIOD_D / (2.0 * np.pi)
|
|
74
77
|
|
|
75
|
-
orbit =
|
|
76
|
-
a_AU=A_AU,
|
|
77
|
-
|
|
78
|
+
orbit = FrameOrbit.from_classical(
|
|
79
|
+
a_AU=A_AU,
|
|
80
|
+
e=ECC,
|
|
81
|
+
W_rad=BIG_OMEGA_RAD,
|
|
82
|
+
i_rad=INC_RAD,
|
|
83
|
+
w_rad=SMALL_OMEGA_RAD,
|
|
84
|
+
M0_rad=M0_RAD,
|
|
85
|
+
mu_AU3_per_d2=MU,
|
|
86
|
+
epoch_d=T0_D,
|
|
78
87
|
)
|
|
79
|
-
|
|
88
|
+
time_d = jnp.linspace(T0_D, T0_D + PERIOD_D, 240)
|
|
80
89
|
|
|
81
90
|
# A second cast for the 3D views: three near-coplanar planets, the way a
|
|
82
91
|
# planetary system actually sits. Keeping the mutual inclinations small (7 to
|
|
@@ -91,30 +100,46 @@ SYS_INC = np.array([0.12, 0.20, 0.28])
|
|
|
91
100
|
SYS_SMALL_OMEGA = np.array([-0.40, -0.70, 0.90])
|
|
92
101
|
SYS_M0 = np.array([0.00, 2.10, 4.30])
|
|
93
102
|
|
|
94
|
-
system =
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
system = System.from_classical(
|
|
104
|
+
Body(1.0),
|
|
105
|
+
Body(np.zeros(3)),
|
|
106
|
+
SkyFrame(10.0),
|
|
107
|
+
a_AU=SYS_A_AU,
|
|
108
|
+
e=SYS_ECC,
|
|
109
|
+
W_rad=SYS_BIG_OMEGA,
|
|
110
|
+
i_rad=SYS_INC,
|
|
111
|
+
w_rad=SYS_SMALL_OMEGA,
|
|
112
|
+
M0_rad=SYS_M0,
|
|
113
|
+
epoch_d=T0_D,
|
|
97
114
|
)
|
|
98
115
|
|
|
99
116
|
# The same three planets one at a time. plot_orbit applies a single style to
|
|
100
117
|
# every track it is handed -- a fan of draws for one planet is one source -- so
|
|
101
118
|
# giving each planet its own colour means one call per planet.
|
|
102
119
|
one_planet = [
|
|
103
|
-
|
|
104
|
-
a_AU=SYS_A_AU[k:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
FrameOrbit.from_classical(
|
|
121
|
+
a_AU=SYS_A_AU[k : k + 1],
|
|
122
|
+
e=SYS_ECC[k : k + 1],
|
|
123
|
+
W_rad=SYS_BIG_OMEGA[k : k + 1],
|
|
124
|
+
i_rad=SYS_INC[k : k + 1],
|
|
125
|
+
w_rad=SYS_SMALL_OMEGA[k : k + 1],
|
|
126
|
+
M0_rad=SYS_M0[k : k + 1],
|
|
127
|
+
mu_AU3_per_d2=MU,
|
|
128
|
+
epoch_d=T0_D,
|
|
108
129
|
)
|
|
109
130
|
for k in range(3)
|
|
110
131
|
]
|
|
111
132
|
|
|
112
|
-
OUTER_PERIOD_D = 2.
|
|
133
|
+
OUTER_PERIOD_D = 2 * np.pi * np.sqrt(SYS_A_AU[-1] ** 3 / MU)
|
|
113
134
|
t_system = jnp.linspace(T0_D, T0_D + OUTER_PERIOD_D, 240)
|
|
114
135
|
|
|
115
136
|
result = viz.plot_sky_track(
|
|
116
|
-
orbit,
|
|
117
|
-
|
|
137
|
+
orbit,
|
|
138
|
+
time_d=time_d,
|
|
139
|
+
dist_pc=10.0,
|
|
140
|
+
source_ids="planet b",
|
|
141
|
+
profile=replace(ep.style.snapshot_profile(), colors=(styles["planet b"]["color"],)),
|
|
142
|
+
iwa_arcsec=0.06,
|
|
118
143
|
)
|
|
119
144
|
```
|
|
120
145
|
|
|
@@ -124,9 +149,9 @@ cannot see into, in the same arcsecond units as the track.
|
|
|
124
149
|
## A posterior fan
|
|
125
150
|
|
|
126
151
|
A `(K,)`-batched orbit draws as a fan of candidate tracks, faded by
|
|
127
|
-
per-track weights. `
|
|
128
|
-
|
|
129
|
-
|
|
152
|
+
per-track weights. `FrameOrbit.from_classical` broadcasts the sampled
|
|
153
|
+
elements into a batch. Periods set the semi-major axes through the
|
|
154
|
+
gravitational parameter.
|
|
130
155
|
|
|
131
156
|
```{code-cell} ipython3
|
|
132
157
|
rng = np.random.default_rng(7)
|
|
@@ -135,34 +160,42 @@ rng = np.random.default_rng(7)
|
|
|
135
160
|
# measurement error, so the fan and the data describe the same system.
|
|
136
161
|
SIGMA_ARCSEC = 0.008
|
|
137
162
|
t_obs = T0_D + np.array([70.0, 250.0, 430.0])
|
|
138
|
-
ra_true, dec_true = orbit.
|
|
139
|
-
time_jd=jnp.asarray(t_obs), Ms_kg=MSUN_KG, dist_pc=10.0
|
|
140
|
-
)
|
|
163
|
+
ra_true, dec_true = offset_arcsec(orbit.at(t_obs)[0], 10.0)
|
|
141
164
|
# Observations are (xy, xerr, yerr): positions shaped (P, 2) and one-sigma
|
|
142
165
|
# errors along RA and Dec.
|
|
143
166
|
epochs = (
|
|
144
|
-
np.column_stack(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
np.column_stack(
|
|
168
|
+
[
|
|
169
|
+
np.asarray(ra_true) + SIGMA_ARCSEC * rng.standard_normal(3),
|
|
170
|
+
np.asarray(dec_true) + SIGMA_ARCSEC * rng.standard_normal(3),
|
|
171
|
+
]
|
|
172
|
+
),
|
|
148
173
|
np.full(3, SIGMA_ARCSEC),
|
|
149
174
|
np.full(3, SIGMA_ARCSEC),
|
|
150
175
|
)
|
|
151
176
|
|
|
152
177
|
K = 40
|
|
153
|
-
|
|
154
|
-
|
|
178
|
+
periods_d = PERIOD_D * (1.0 + 0.04 * rng.standard_normal(K))
|
|
179
|
+
periapsis_d = PERIAPSIS_D + 12.0 * rng.standard_normal(K)
|
|
180
|
+
fan = FrameOrbit.from_classical(
|
|
181
|
+
a_AU=(MU * (periods_d / (2 * np.pi)) ** 2) ** (1 / 3),
|
|
155
182
|
e=np.clip(ECC + 0.04 * rng.standard_normal(K), 0.0, 0.9),
|
|
156
|
-
|
|
183
|
+
i_rad=np.arccos(np.clip(np.cos(INC_RAD) + 0.06 * rng.standard_normal(K), -1, 1)),
|
|
157
184
|
W_rad=BIG_OMEGA_RAD + 0.08 * rng.standard_normal(K),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
185
|
+
w_rad=SMALL_OMEGA_RAD + 0.15 * rng.standard_normal(K),
|
|
186
|
+
M0_rad=2 * np.pi * (T0_D - periapsis_d) / periods_d,
|
|
187
|
+
mu_AU3_per_d2=MU,
|
|
188
|
+
epoch_d=T0_D,
|
|
161
189
|
)
|
|
162
|
-
fan = KeplerianOrbit.from_period(**draws, Ms_kg=MSUN_KG)
|
|
163
190
|
result = viz.plot_sky_track(
|
|
164
|
-
fan,
|
|
165
|
-
|
|
191
|
+
fan,
|
|
192
|
+
time_d=time_d,
|
|
193
|
+
dist_pc=10.0,
|
|
194
|
+
source_ids="planet b",
|
|
195
|
+
profile=replace(ep.style.snapshot_profile(), colors=(styles["planet b"]["color"],)),
|
|
196
|
+
weights=np.full(K, 1 / K),
|
|
197
|
+
iwa_arcsec=0.06,
|
|
198
|
+
observations=epochs,
|
|
166
199
|
)
|
|
167
200
|
```
|
|
168
201
|
|
|
@@ -178,7 +211,7 @@ with `ax.view_init(elev=-90, azim=90, roll=0)` looks from the observer
|
|
|
178
211
|
at -z and shows east left and north up, matching the sky panel.
|
|
179
212
|
Velocities share the frame in AU/day; positive dz/dt means receding.
|
|
180
213
|
|
|
181
|
-
`plot_orbit` draws the star-centric orbit in AU through `eyepiece.trail`.
|
|
214
|
+
`plot_orbit` draws the star-centric orbit in AU through `eyepiece.plot.trail`.
|
|
182
215
|
With no `style` it uses the star-chart look: markers in the mode's text
|
|
183
216
|
color (white dots on this dark background) over a transparent dashed gray
|
|
184
217
|
path, with the 3D panes painted in the background color so the scene
|
|
@@ -210,8 +243,11 @@ axsky = fig.add_subplot(gs[1])
|
|
|
210
243
|
|
|
211
244
|
for name, planet in zip(PLANETS, one_planet):
|
|
212
245
|
viz.plot_orbit(
|
|
213
|
-
planet,
|
|
214
|
-
|
|
246
|
+
planet,
|
|
247
|
+
time_d=t_system,
|
|
248
|
+
ax=ax3d,
|
|
249
|
+
style=styles[name],
|
|
250
|
+
marks={"periapsis"},
|
|
215
251
|
)
|
|
216
252
|
|
|
217
253
|
# plot_orbit sizes the 3D box as a cube. That is right for a steep orbit, but a
|
|
@@ -219,9 +255,9 @@ for name, planet in zip(PLANETS, one_planet):
|
|
|
219
255
|
# Shrinking the z limit and the box aspect by the SAME factor fills the frame
|
|
220
256
|
# and keeps the scale equal on all three axes; the tick locator keeps the
|
|
221
257
|
# shorter axis from crowding its labels together.
|
|
222
|
-
z_half = 1.15 * float(
|
|
223
|
-
np.asarray(system.
|
|
224
|
-
)
|
|
258
|
+
z_half = 1.15 * float(
|
|
259
|
+
np.max(np.abs(np.asarray(system.solve(t_system).position_AU)[1:, :, 2]))
|
|
260
|
+
)
|
|
225
261
|
xy_half = ax3d.get_xlim()[1]
|
|
226
262
|
ax3d.set_zlim(-z_half, z_half)
|
|
227
263
|
ax3d.set_box_aspect((1.0, 1.0, z_half / xy_half))
|
|
@@ -229,21 +265,32 @@ ax3d.zaxis.set_major_locator(MaxNLocator(3))
|
|
|
229
265
|
ax3d.set_title("plot_orbit -- star-centric, AU")
|
|
230
266
|
|
|
231
267
|
viz.plot_sky_track(
|
|
232
|
-
system,
|
|
233
|
-
|
|
234
|
-
|
|
268
|
+
system,
|
|
269
|
+
time_d=t_system,
|
|
270
|
+
dist_pc=10.0,
|
|
271
|
+
ax=axsky,
|
|
272
|
+
source_ids=PLANETS,
|
|
273
|
+
profile=replace(
|
|
274
|
+
ep.style.snapshot_profile(),
|
|
275
|
+
colors=tuple(styles[name]["color"] for name in PLANETS),
|
|
276
|
+
stroke_width_pt=1.8,
|
|
277
|
+
),
|
|
278
|
+
iwa_arcsec=0.06,
|
|
235
279
|
)
|
|
236
280
|
axsky.set_title("plot_sky_track -- as seen from Earth")
|
|
237
281
|
axsky.legend(
|
|
238
|
-
handles=[
|
|
239
|
-
|
|
240
|
-
|
|
282
|
+
handles=[
|
|
283
|
+
Line2D([], [], color=styles[n]["color"], lw=2.5, label=n) for n in PLANETS
|
|
284
|
+
],
|
|
285
|
+
loc="upper left",
|
|
286
|
+
frameon=False,
|
|
287
|
+
fontsize=9,
|
|
241
288
|
)
|
|
242
289
|
```
|
|
243
290
|
|
|
244
291
|
## Animation
|
|
245
292
|
|
|
246
|
-
`animate_orbit` returns a lazy `eyepiece.Animation`: nothing renders until
|
|
293
|
+
`animate_orbit` returns a lazy `eyepiece.render.Animation`: nothing renders until
|
|
247
294
|
a sink is asked for, and one animation can go to several sinks in one
|
|
248
295
|
pass (`.save("orbit.mp4", "orbit.gif")`). The 3D defaults do the whole
|
|
249
296
|
star-chart presentation in one call: dashed gray paths, a moving dot per
|
|
@@ -276,8 +323,12 @@ from IPython.display import HTML
|
|
|
276
323
|
t_anim = jnp.linspace(T0_D, T0_D + OUTER_PERIOD_D, 72)
|
|
277
324
|
|
|
278
325
|
anim = viz.animate_orbit(
|
|
279
|
-
system,
|
|
280
|
-
|
|
326
|
+
system,
|
|
327
|
+
time_d=t_anim,
|
|
328
|
+
kind="3d",
|
|
329
|
+
history="none",
|
|
330
|
+
base_ms=viz.size_by_radius([1.0, 3.9, 11.2]),
|
|
331
|
+
fps=15,
|
|
281
332
|
rotate={"azim": (-150.0, -110.0), "elev": (46.0, 46.0)},
|
|
282
333
|
)
|
|
283
334
|
HTML(anim.jshtml(dpi=130))
|