adam_core


Nameadam_core JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryCore libraries for the ADAM platform
upload_time2024-05-29 14:49:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseThe MIT License (MIT) Copyright (c) 2022-2023, Asteroid Institute 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. The following files are originally derived from the THOR project: adam_core/coordinates/* adam_core/constants.py adam_core/utils/* THOR maintains a 3-Clause License. BSD 3-Clause License Copyright (c) 2018-2023, Joachim Moeyens All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords astronomy orbital mechanics propagation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # adam_core: ADAM Core Utilities
#### A Python package by the Asteroid Institute, a program of the B612 Foundation
[![Python 3.9+](https://img.shields.io/badge/Python-3.9%2B-blue)](https://img.shields.io/badge/Python-3.9%2B-blue)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)  
[![pip - Build, Lint, Test, and Coverage](https://github.com/B612-Asteroid-Institute/adam_core/actions/workflows/pip-build-lint-test-coverage.yml/badge.svg)](https://github.com/B612-Asteroid-Institute/adam_core/actions/workflows/pip-build-lint-test-coverage.yml)

`adam_core` is used by a variety of library and services at the Asteroid Institute. Sharing these common classes, types, and conversions amongst our tools ensures consistency and accuracy.

## Installation

ADAM Core is available on PyPI

```bash
pip install adam_core
```

## Usage

### Orbits

To define an orbit:
```python
from adam_core.coordinates import KeplerianCoordinates
from adam_core.coordinates import Origin
from adam_core.orbits import Orbits
from adam_core.time import Timestamp

keplerian_elements = KeplerianCoordinates.from_kwargs(
    time=Timestamp.from_mjd([59000.0], scale="tdb"),
    a=[1.0],
    e=[0.002],
    i=[10.],
    raan=[50.0],
    ap=[20.0],
    M=[30.0],
    origin=Origin.from_kwargs(code=["SUN"]),
    frame="ecliptic"
)
orbits = Orbits.from_kwargs(
    orbit_id=["1"],
    object_id=["Test Orbit"],
    coordinates=keplerian_elements.to_cartesian(),
)
```
Note that internally, all orbits are stored in Cartesian coordinates. Cartesian coordinates do not have any
singularities and are thus more robust for numerical integration. Any orbital element conversions to Cartesian
can be done on demand by calling `to_cartesian()` on the coordinates object.

The underlying orbits class is 2 dimensional and can store elements and covariances for multiple orbits.

```python
from adam_core.coordinates import KeplerianCoordinates
from adam_core.coordinates import Origin
from adam_core.orbits import Orbits
from adam_core.time import Timestamp

keplerian_elements = KeplerianCoordinates.from_kwargs(
    time=Timestamp.from_mjd([59000.0, 60000.0], scale="tdb"),
    a=[1.0, 3.0],
    e=[0.002, 0.0],
    i=[10., 30.],
    raan=[50.0, 32.0],
    ap=[20.0, 94.0],
    M=[30.0, 159.0],
    origin=Origin.from_kwargs(code=["SUN", "SUN"]),
    frame="ecliptic"
)
orbits = Orbits.from_kwargs(
    orbit_id=["1", "2"],
    object_id=["Test Orbit 1", "Test Orbit 2"],
    coordinates=keplerian_elements.to_cartesian(),
)
```

Orbits can be easily converted to a pandas DataFrame:
```python
orbits.to_dataframe()  
  orbit_id     object_id  coordinates.x  coordinates.y  coordinates.z  coordinates.vx  coordinates.vy  coordinates.vz  coordinates.time.days  coordinates.time.nanos                      coordinates.covariance.values coordinates.origin.code  
0        1  Test Orbit 1      -0.166403       0.975273       0.133015       -0.016838       -0.003117        0.001921                  59000                       0  [nan, nan, nan, nan, nan, nan, nan, nan, nan, ...                     SUN  
1        2  Test Orbit 2       0.572777      -2.571820      -1.434457        0.009387        0.002900       -0.001452                  60000                       0  [nan, nan, nan, nan, nan, nan, nan, nan, nan, ...                     SUN
```

Orbits can also be defined with uncertainties.
```python
import numpy as np
from adam_core.coordinates import KeplerianCoordinates
from adam_core.coordinates import Origin
from adam_core.coordinates import CoordinateCovariances
from adam_core.orbits import Orbits
from adam_core.time import Timestamp

keplerian_elements = KeplerianCoordinates.from_kwargs(
    time=Timestamp.from_mjd([59000.0], scale="tdb"),
    a=[1.0],
    e=[0.002],
    i=[10.],
    raan=[50.0],
    ap=[20.0],
    M=[30.0],
    covariance=CoordinateCovariances.from_sigmas(
        np.array([[0.002, 0.001, 0.01, 0.01, 0.1, 0.1]])
    ),
    origin=Origin.from_kwargs(code=["SUN"]),
    frame="ecliptic"
)

orbits = Orbits.from_kwargs(
    orbit_id=["1"],
    object_id=["Test Orbit with Uncertainties"],
    coordinates=keplerian_elements.to_cartesian(),
)
orbits.to_dataframe()  
  orbit_id                      object_id  coordinates.x  coordinates.y  coordinates.z  coordinates.vx  coordinates.vy  coordinates.vz  coordinates.time.days  coordinates.time.nanos                      coordinates.covariance.values coordinates.origin.code  
0        1  Test Orbit with Uncertainties      -0.166403       0.975273       0.133015       -0.016838       -0.003117        0.001921                  59000                       0  [6.654136535278775e-06, 1.2935845684776213e-06...                     SUN
```

The covariance matrices can be extracted in matrix form by using the `.to_matrix()` method:
```python
orbits.coordinates.covariance.to_matrix()
```

Similarly, if you just want to access the orbital elements you can do the following:
```python
orbits.coordinates.values
```

To query orbits from JPL Horizons:
```python
from adam_core.orbits.query import query_horizons
from adam_core.time import Timestamp

times = Timestamp.from_mjd([60000.0], scale="tdb")
object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_horizons(object_ids, times)
```

To query orbits from JPL SBDB:
```python
from adam_core.orbits.query import query_sbdb

object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_sbdb(object_ids)
```

#### Orbital Element Conversions
Orbital elements can be accessed via the corresponding attribute. All conversions, including covariances, are done on demand and stored.

```python
# Cartesian Elements
orbits.coordinates

# To convert to other representations
cometary_elements = orbits.coordinates.to_cometary()
keplerian_elements = orbits.coordinates.to_keplerian()
spherical_elements = orbits.coordinates.to_spherical()
```

### Propagator
The propagator class in `adam_core` provides a generalized interface to the supported orbit integrators and ephemeris generators. The propagator class is designed to be used with the `Orbits` class and can handle multiple orbits and times. 

You will need to install either adam_core[assist], or another compatible propagator in order to use propagation, ephemeris generation, or impact analysis.

#### Propagation
To propagate orbits with ASSIST (here we grab some orbits from Horizons first):

```python
import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_horizons
from adam_core.propagator.adam_assist import ASSISTPropagator, download_jpl_ephemeris_files
from adam_core.time import Timestamp

# Get orbits to propagate
initial_time = Timestamp.from_mjd([60000.0], scale="tdb")
object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_horizons(object_ids, initial_time)

# Download ephemeris files used by propagator and initialize
download_jpl_ephemeris_files()
propagator = ASSISTPropagator()

# Define propagation times
times = initial_time.from_mjd(initial_time.mjd() + np.arange(0, 100))

# Propagate orbits! This function supports multiprocessing for large
# propagation jobs.
propagated_orbits = propagator.propagate_orbits(
    orbits,
    times,
    chunk_size=100,
    max_processes=1,
)
```

#### Ephemeris Generation
Ephemeris generation requires a propagator that implements the EphemerisMixin interface. This is currently only implemented by the PYOORB propagator. The ephemeris generator will automatically map the propagated covariance matrices to the sky-plane.

You will need to install adam-pyoorb in order to use the ephemeris generator, which is currently only available on GitHub.

```sh
pip install git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git
```


```python
import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_horizons
from adam_core.propagator.adam_pyoorb import PYOORBPropagator
from adam_core.observers import Observers
from adam_core.time import Timestamp

# Get orbits to propagate
initial_time = Timestamp.from_mjd([60000.0], scale="tdb")
object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_horizons(object_ids, initial_time)

# Make sure PYOORB is ready
propagator = PYOORBPropagator()

# Define a set of observers and observation times
times = Timestamp.from_mjd(initial_time.mjd() + np.arange(0, 100))
observers = Observers.from_code("I11", times)

# Generate ephemerides! This function supports multiprocessing for large
# propagation jobs.
ephemeris = propagator.generate_ephemeris(
    orbits,
    observers,
    chunk_size=100,
    max_processes=1
)
```


### Low-level APIs

#### State Vectors from Development Ephemeris files
Getting the heliocentric ecliptic state vector of a DE440 body at a given set of times (in this case the barycenter of the Jovian system):
```python
import numpy as np

from adam_core.coordinates import OriginCodes
from adam_core.utils import get_perturber_state
from adam_core.time import Timestamp

states = get_perturber_state(
    OriginCodes.JUPITER_BARYCENTER,
    Timetamp.from_mjd(np.arange(59000, 60000), scale="tdb"),
    frame="ecliptic",
    origin=OriginCodes.SUN,
)
```

#### 2-body Propagation
`adam_core` also has 2-body propagation functionality. To propagate any orbit with 2-body dynamics:
```python
import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_sbdb
from adam_core.dynamics import propagate_2body
from adam_core.time import Timestamp

# Get orbit to propagate
object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_sbdb(object_ids)

# Define propagation times
times = Timestamp.from_mjd(np.arange(59000, 60000), scale="tdb")

# Propagate orbits with 2-body dynamics
propagated_orbits = propagate_2body(
    orbits,
    times
)
```

#### 2-body Ephemeris Generation
This package also has functionality to generate ephemerides for a set of orbits. We do not recommend you use this with
2-body propagated orbits as it will not be accurate for more than a few days. However, if you used a N-body propagator
such as PYOORB, you can feed in the propagated orbits to this function to generate ephemerides. We call the ephemeris generator
2-body because the light-time correction is applied using a 2-body propagator.

Because the ephemeris generator was written in Jax, we can also map covariances directly to the sky-plane. To do this, we propagate
the covariance matrices with the orbits. This is done by passing `covariance=True` to the propagator. The ephemeris generator will
then automatically map the propagated covariance matrices to the sky-plane.

```python
import numpy as np
from astropy import units as u

from adam_core.orbits.query import query_sbdb
from adam_core.propagator.adam_pyoorb import PYOORBPropagator
from adam_core.observers import Observers
from adam_core.dynamics import generate_ephemeris_2body
from adam_core.time import Timestamp

# Get orbits to propagate
object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_sbdb(object_ids)

# Make sure PYOORB is ready
propagator = PYOORBPropagator()

# Define a set of observers and observation times
times = Timestamp.from_mjd(np.arange(59000, 60000), scale="tdb")
observers = Observers.from_code("I11", times)

# Propagate orbits with PYOORB (note that we are propagating with covariances)
propagated_orbits = propagator.propagate_orbits(
    orbits,
    times,
    chunk_size=100,
    max_processes=1,
    covariance=True,
)

# Now generate ephemerides with the 2-body ephemeris generator
ephemeris = generate_ephemeris_2body(
    propagated_orbits,
    observers,
)
```

#### Gravitational parameter
Both the 2-body propagation and 2-body ephemeris generation code will determine the correct graviational parameter
to use from each orbit's origin.

To see the gravitational parameter used for each orbit:
```python
from adam_core.orbits.query import query_sbdb

# Get orbit to propagate
object_ids = ["Duende", "Eros", "Ceres"]
orbits = query_sbdb(object_ids)

# Get the gravitational parameter (these will all be the same -- heliocentric)
mu = orbits.coordinates.origin.mu()
```

## Package Structure

```bash
adam_core
├── constants.py  # Shared constants
├── coordinates   # Coordinate classes and transformations
├── dynamics      # Numerical solutions
├── orbits        # Orbits class and query utilities
└── utils         # Utility classes like Indexable or conversions like times_from_df
```



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "adam_core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "astronomy, orbital mechanics, propagation",
    "author": null,
    "author_email": "Kathleen Kiker <kathleen@b612foundation.org>, Alec Koumjian <alec@b612foundation.org>, Joachim Moeyens <moeyensj@uw.edu>, Spencer Nelson <spencer@b612foundation.org>, Nate Tellis <nate@b612foundation.org>",
    "download_url": "https://files.pythonhosted.org/packages/92/6c/056075b2c3224ddcb770a587511dba6ffc6f6dc716c600259bb4b50903c9/adam_core-0.2.0.tar.gz",
    "platform": null,
    "description": "# adam_core: ADAM Core Utilities\n#### A Python package by the Asteroid Institute, a program of the B612 Foundation\n[![Python 3.9+](https://img.shields.io/badge/Python-3.9%2B-blue)](https://img.shields.io/badge/Python-3.9%2B-blue)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)  \n[![pip - Build, Lint, Test, and Coverage](https://github.com/B612-Asteroid-Institute/adam_core/actions/workflows/pip-build-lint-test-coverage.yml/badge.svg)](https://github.com/B612-Asteroid-Institute/adam_core/actions/workflows/pip-build-lint-test-coverage.yml)\n\n`adam_core` is used by a variety of library and services at the Asteroid Institute. Sharing these common classes, types, and conversions amongst our tools ensures consistency and accuracy.\n\n## Installation\n\nADAM Core is available on PyPI\n\n```bash\npip install adam_core\n```\n\n## Usage\n\n### Orbits\n\nTo define an orbit:\n```python\nfrom adam_core.coordinates import KeplerianCoordinates\nfrom adam_core.coordinates import Origin\nfrom adam_core.orbits import Orbits\nfrom adam_core.time import Timestamp\n\nkeplerian_elements = KeplerianCoordinates.from_kwargs(\n    time=Timestamp.from_mjd([59000.0], scale=\"tdb\"),\n    a=[1.0],\n    e=[0.002],\n    i=[10.],\n    raan=[50.0],\n    ap=[20.0],\n    M=[30.0],\n    origin=Origin.from_kwargs(code=[\"SUN\"]),\n    frame=\"ecliptic\"\n)\norbits = Orbits.from_kwargs(\n    orbit_id=[\"1\"],\n    object_id=[\"Test Orbit\"],\n    coordinates=keplerian_elements.to_cartesian(),\n)\n```\nNote that internally, all orbits are stored in Cartesian coordinates. Cartesian coordinates do not have any\nsingularities and are thus more robust for numerical integration. Any orbital element conversions to Cartesian\ncan be done on demand by calling `to_cartesian()` on the coordinates object.\n\nThe underlying orbits class is 2 dimensional and can store elements and covariances for multiple orbits.\n\n```python\nfrom adam_core.coordinates import KeplerianCoordinates\nfrom adam_core.coordinates import Origin\nfrom adam_core.orbits import Orbits\nfrom adam_core.time import Timestamp\n\nkeplerian_elements = KeplerianCoordinates.from_kwargs(\n    time=Timestamp.from_mjd([59000.0, 60000.0], scale=\"tdb\"),\n    a=[1.0, 3.0],\n    e=[0.002, 0.0],\n    i=[10., 30.],\n    raan=[50.0, 32.0],\n    ap=[20.0, 94.0],\n    M=[30.0, 159.0],\n    origin=Origin.from_kwargs(code=[\"SUN\", \"SUN\"]),\n    frame=\"ecliptic\"\n)\norbits = Orbits.from_kwargs(\n    orbit_id=[\"1\", \"2\"],\n    object_id=[\"Test Orbit 1\", \"Test Orbit 2\"],\n    coordinates=keplerian_elements.to_cartesian(),\n)\n```\n\nOrbits can be easily converted to a pandas DataFrame:\n```python\norbits.to_dataframe()  \n  orbit_id     object_id  coordinates.x  coordinates.y  coordinates.z  coordinates.vx  coordinates.vy  coordinates.vz  coordinates.time.days  coordinates.time.nanos                      coordinates.covariance.values coordinates.origin.code  \n0        1  Test Orbit 1      -0.166403       0.975273       0.133015       -0.016838       -0.003117        0.001921                  59000                       0  [nan, nan, nan, nan, nan, nan, nan, nan, nan, ...                     SUN  \n1        2  Test Orbit 2       0.572777      -2.571820      -1.434457        0.009387        0.002900       -0.001452                  60000                       0  [nan, nan, nan, nan, nan, nan, nan, nan, nan, ...                     SUN\n```\n\nOrbits can also be defined with uncertainties.\n```python\nimport numpy as np\nfrom adam_core.coordinates import KeplerianCoordinates\nfrom adam_core.coordinates import Origin\nfrom adam_core.coordinates import CoordinateCovariances\nfrom adam_core.orbits import Orbits\nfrom adam_core.time import Timestamp\n\nkeplerian_elements = KeplerianCoordinates.from_kwargs(\n    time=Timestamp.from_mjd([59000.0], scale=\"tdb\"),\n    a=[1.0],\n    e=[0.002],\n    i=[10.],\n    raan=[50.0],\n    ap=[20.0],\n    M=[30.0],\n    covariance=CoordinateCovariances.from_sigmas(\n        np.array([[0.002, 0.001, 0.01, 0.01, 0.1, 0.1]])\n    ),\n    origin=Origin.from_kwargs(code=[\"SUN\"]),\n    frame=\"ecliptic\"\n)\n\norbits = Orbits.from_kwargs(\n    orbit_id=[\"1\"],\n    object_id=[\"Test Orbit with Uncertainties\"],\n    coordinates=keplerian_elements.to_cartesian(),\n)\norbits.to_dataframe()  \n  orbit_id                      object_id  coordinates.x  coordinates.y  coordinates.z  coordinates.vx  coordinates.vy  coordinates.vz  coordinates.time.days  coordinates.time.nanos                      coordinates.covariance.values coordinates.origin.code  \n0        1  Test Orbit with Uncertainties      -0.166403       0.975273       0.133015       -0.016838       -0.003117        0.001921                  59000                       0  [6.654136535278775e-06, 1.2935845684776213e-06...                     SUN\n```\n\nThe covariance matrices can be extracted in matrix form by using the `.to_matrix()` method:\n```python\norbits.coordinates.covariance.to_matrix()\n```\n\nSimilarly, if you just want to access the orbital elements you can do the following:\n```python\norbits.coordinates.values\n```\n\nTo query orbits from JPL Horizons:\n```python\nfrom adam_core.orbits.query import query_horizons\nfrom adam_core.time import Timestamp\n\ntimes = Timestamp.from_mjd([60000.0], scale=\"tdb\")\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_horizons(object_ids, times)\n```\n\nTo query orbits from JPL SBDB:\n```python\nfrom adam_core.orbits.query import query_sbdb\n\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_sbdb(object_ids)\n```\n\n#### Orbital Element Conversions\nOrbital elements can be accessed via the corresponding attribute. All conversions, including covariances, are done on demand and stored.\n\n```python\n# Cartesian Elements\norbits.coordinates\n\n# To convert to other representations\ncometary_elements = orbits.coordinates.to_cometary()\nkeplerian_elements = orbits.coordinates.to_keplerian()\nspherical_elements = orbits.coordinates.to_spherical()\n```\n\n### Propagator\nThe propagator class in `adam_core` provides a generalized interface to the supported orbit integrators and ephemeris generators. The propagator class is designed to be used with the `Orbits` class and can handle multiple orbits and times. \n\nYou will need to install either adam_core[assist], or another compatible propagator in order to use propagation, ephemeris generation, or impact analysis.\n\n#### Propagation\nTo propagate orbits with ASSIST (here we grab some orbits from Horizons first):\n\n```python\nimport numpy as np\nfrom astropy import units as u\n\nfrom adam_core.orbits.query import query_horizons\nfrom adam_core.propagator.adam_assist import ASSISTPropagator, download_jpl_ephemeris_files\nfrom adam_core.time import Timestamp\n\n# Get orbits to propagate\ninitial_time = Timestamp.from_mjd([60000.0], scale=\"tdb\")\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_horizons(object_ids, initial_time)\n\n# Download ephemeris files used by propagator and initialize\ndownload_jpl_ephemeris_files()\npropagator = ASSISTPropagator()\n\n# Define propagation times\ntimes = initial_time.from_mjd(initial_time.mjd() + np.arange(0, 100))\n\n# Propagate orbits! This function supports multiprocessing for large\n# propagation jobs.\npropagated_orbits = propagator.propagate_orbits(\n    orbits,\n    times,\n    chunk_size=100,\n    max_processes=1,\n)\n```\n\n#### Ephemeris Generation\nEphemeris generation requires a propagator that implements the EphemerisMixin interface. This is currently only implemented by the PYOORB propagator. The ephemeris generator will automatically map the propagated covariance matrices to the sky-plane.\n\nYou will need to install adam-pyoorb in order to use the ephemeris generator, which is currently only available on GitHub.\n\n```sh\npip install git+https://github.com/B612-Asteroid-Institute/adam-pyoorb.git\n```\n\n\n```python\nimport numpy as np\nfrom astropy import units as u\n\nfrom adam_core.orbits.query import query_horizons\nfrom adam_core.propagator.adam_pyoorb import PYOORBPropagator\nfrom adam_core.observers import Observers\nfrom adam_core.time import Timestamp\n\n# Get orbits to propagate\ninitial_time = Timestamp.from_mjd([60000.0], scale=\"tdb\")\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_horizons(object_ids, initial_time)\n\n# Make sure PYOORB is ready\npropagator = PYOORBPropagator()\n\n# Define a set of observers and observation times\ntimes = Timestamp.from_mjd(initial_time.mjd() + np.arange(0, 100))\nobservers = Observers.from_code(\"I11\", times)\n\n# Generate ephemerides! This function supports multiprocessing for large\n# propagation jobs.\nephemeris = propagator.generate_ephemeris(\n    orbits,\n    observers,\n    chunk_size=100,\n    max_processes=1\n)\n```\n\n\n### Low-level APIs\n\n#### State Vectors from Development Ephemeris files\nGetting the heliocentric ecliptic state vector of a DE440 body at a given set of times (in this case the barycenter of the Jovian system):\n```python\nimport numpy as np\n\nfrom adam_core.coordinates import OriginCodes\nfrom adam_core.utils import get_perturber_state\nfrom adam_core.time import Timestamp\n\nstates = get_perturber_state(\n    OriginCodes.JUPITER_BARYCENTER,\n    Timetamp.from_mjd(np.arange(59000, 60000), scale=\"tdb\"),\n    frame=\"ecliptic\",\n    origin=OriginCodes.SUN,\n)\n```\n\n#### 2-body Propagation\n`adam_core` also has 2-body propagation functionality. To propagate any orbit with 2-body dynamics:\n```python\nimport numpy as np\nfrom astropy import units as u\n\nfrom adam_core.orbits.query import query_sbdb\nfrom adam_core.dynamics import propagate_2body\nfrom adam_core.time import Timestamp\n\n# Get orbit to propagate\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_sbdb(object_ids)\n\n# Define propagation times\ntimes = Timestamp.from_mjd(np.arange(59000, 60000), scale=\"tdb\")\n\n# Propagate orbits with 2-body dynamics\npropagated_orbits = propagate_2body(\n    orbits,\n    times\n)\n```\n\n#### 2-body Ephemeris Generation\nThis package also has functionality to generate ephemerides for a set of orbits. We do not recommend you use this with\n2-body propagated orbits as it will not be accurate for more than a few days. However, if you used a N-body propagator\nsuch as PYOORB, you can feed in the propagated orbits to this function to generate ephemerides. We call the ephemeris generator\n2-body because the light-time correction is applied using a 2-body propagator.\n\nBecause the ephemeris generator was written in Jax, we can also map covariances directly to the sky-plane. To do this, we propagate\nthe covariance matrices with the orbits. This is done by passing `covariance=True` to the propagator. The ephemeris generator will\nthen automatically map the propagated covariance matrices to the sky-plane.\n\n```python\nimport numpy as np\nfrom astropy import units as u\n\nfrom adam_core.orbits.query import query_sbdb\nfrom adam_core.propagator.adam_pyoorb import PYOORBPropagator\nfrom adam_core.observers import Observers\nfrom adam_core.dynamics import generate_ephemeris_2body\nfrom adam_core.time import Timestamp\n\n# Get orbits to propagate\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_sbdb(object_ids)\n\n# Make sure PYOORB is ready\npropagator = PYOORBPropagator()\n\n# Define a set of observers and observation times\ntimes = Timestamp.from_mjd(np.arange(59000, 60000), scale=\"tdb\")\nobservers = Observers.from_code(\"I11\", times)\n\n# Propagate orbits with PYOORB (note that we are propagating with covariances)\npropagated_orbits = propagator.propagate_orbits(\n    orbits,\n    times,\n    chunk_size=100,\n    max_processes=1,\n    covariance=True,\n)\n\n# Now generate ephemerides with the 2-body ephemeris generator\nephemeris = generate_ephemeris_2body(\n    propagated_orbits,\n    observers,\n)\n```\n\n#### Gravitational parameter\nBoth the 2-body propagation and 2-body ephemeris generation code will determine the correct graviational parameter\nto use from each orbit's origin.\n\nTo see the gravitational parameter used for each orbit:\n```python\nfrom adam_core.orbits.query import query_sbdb\n\n# Get orbit to propagate\nobject_ids = [\"Duende\", \"Eros\", \"Ceres\"]\norbits = query_sbdb(object_ids)\n\n# Get the gravitational parameter (these will all be the same -- heliocentric)\nmu = orbits.coordinates.origin.mu()\n```\n\n## Package Structure\n\n```bash\nadam_core\n\u251c\u2500\u2500 constants.py  # Shared constants\n\u251c\u2500\u2500 coordinates   # Coordinate classes and transformations\n\u251c\u2500\u2500 dynamics      # Numerical solutions\n\u251c\u2500\u2500 orbits        # Orbits class and query utilities\n\u2514\u2500\u2500 utils         # Utility classes like Indexable or conversions like times_from_df\n```\n\n\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)\n        \n        Copyright (c) 2022-2023, Asteroid Institute\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,\n        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n        IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n        DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n        OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE\n        OR OTHER DEALINGS IN THE SOFTWARE.\n        \n        \n        The following files are originally derived from the THOR project:\n        \n        adam_core/coordinates/*\n        adam_core/constants.py\n        adam_core/utils/*\n        \n        THOR maintains a 3-Clause License.\n        \n        BSD 3-Clause License\n        \n        Copyright (c) 2018-2023, Joachim Moeyens\n        All rights reserved.\n        \n        Redistribution and use in source and binary forms, with or without\n        modification, are permitted provided that the following conditions are met:\n        \n        * Redistributions of source code must retain the above copyright notice, this\n          list of conditions and the following disclaimer.\n        \n        * Redistributions in binary form must reproduce the above copyright notice,\n          this list of conditions and the following disclaimer in the documentation\n          and/or other materials provided with the distribution.\n        \n        * Neither the name of the copyright holder nor the names of its\n          contributors may be used to endorse or promote products derived from\n          this software without specific prior written permission.\n        \n        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
    "summary": "Core libraries for the ADAM platform",
    "version": "0.2.0",
    "project_urls": {
        "Documentation": "https://github.com/B612-Asteroid-Institute/adam_core#README.md",
        "Issues": "https://github.com/B612-Asteroid-Institute/adam_core/issues",
        "Source": "https://github.com/B612-Asteroid-Institute/adam_core"
    },
    "split_keywords": [
        "astronomy",
        " orbital mechanics",
        " propagation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "014ed0a4e630a813c55606b3e001196a62b0cfd02d418b2e8cd576a733af9d29",
                "md5": "567bb6828aa6eae9c42ab68cbfc25af2",
                "sha256": "80dd0a534902d979ec84044433e625658c02ca61b1a14fc8240184d36cc3cae2"
            },
            "downloads": -1,
            "filename": "adam_core-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "567bb6828aa6eae9c42ab68cbfc25af2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 1714344,
            "upload_time": "2024-05-29T14:49:12",
            "upload_time_iso_8601": "2024-05-29T14:49:12.193667Z",
            "url": "https://files.pythonhosted.org/packages/01/4e/d0a4e630a813c55606b3e001196a62b0cfd02d418b2e8cd576a733af9d29/adam_core-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "926c056075b2c3224ddcb770a587511dba6ffc6f6dc716c600259bb4b50903c9",
                "md5": "c26dddb10cf1c81fb685da68f97c3aa9",
                "sha256": "13e3d0044970dd87452d6f4dda4e956a68a47392621b8a9749bdf4fa40d4acaa"
            },
            "downloads": -1,
            "filename": "adam_core-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c26dddb10cf1c81fb685da68f97c3aa9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 1633815,
            "upload_time": "2024-05-29T14:49:15",
            "upload_time_iso_8601": "2024-05-29T14:49:15.907869Z",
            "url": "https://files.pythonhosted.org/packages/92/6c/056075b2c3224ddcb770a587511dba6ffc6f6dc716c600259bb4b50903c9/adam_core-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-29 14:49:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "B612-Asteroid-Institute",
    "github_project": "adam_core#README.md",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "adam_core"
}
        
Elapsed time: 0.25051s