Skip to content

Commit

Permalink
Generate docs for utils
Browse files Browse the repository at this point in the history
  • Loading branch information
spenczar committed Oct 18, 2023
1 parent 39ab655 commit 055c56c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
2 changes: 2 additions & 0 deletions adam_core/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# flake8: noqa: F401
from .spice import get_perturber_state, setup_SPICE

__all__ = ["get_perturber_state", "setup_SPICE"]
6 changes: 6 additions & 0 deletions adam_core/utils/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# flake8: noqa: F401
from .observations import make_observations
from .orbits import make_real_orbits, make_simple_orbits

__all__ = [
"make_observations",
"make_real_orbits",
"make_simple_orbits",
]
21 changes: 17 additions & 4 deletions adam_core/utils/spice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from typing import List, Literal
from typing import List, Literal, Optional

import numpy as np
import pyarrow.compute as pc
Expand Down Expand Up @@ -52,7 +52,7 @@ def _jd_tdb_to_et(jd_tdb: np.ndarray) -> np.ndarray:
return et


def setup_SPICE(kernels: List[str] = DEFAULT_KERNELS, force: bool = False):
def setup_SPICE(kernels: Optional[List[str]] = None, force: bool = False):
"""
Load SPICE kernels.
Expand All @@ -64,11 +64,24 @@ def setup_SPICE(kernels: List[str] = DEFAULT_KERNELS, force: bool = False):
calculation (calling sp.furnsh multiple times will load the same kernel multiple times, which
will cause an error.)
The default kernels loaded are those provided by the NAIF data packages:
- Leapsecond data (`naif-leapseconds <https://pypi.org/project/naif-leapseconds/>`_)
- DE440 ephemeris data (`naif-de440 <https://pypi.org/project/naif-de440/>`_)
- Longterm Earth Orientation Parameter Predictions (`naif-eop-predict <https://pypi.org/project/naif-eop-predict/>`_)
- Historical Earth Orientation Parameters (`naif-eop-historical <https://pypi.org/project/naif-eop-historical/>`_)
- High Precision Earth Orientation Parameters (`naif-eop-high-prec <https://pypi.org/project/naif-eop-high-prec/>`_)
- Earth Body-fixed Reference Frame/Body Association (`naif-earth-itrf93 <https://pypi.org/project/naif-earth-itrf93/>`_)
Parameters
----------
kernels : list of str
List of SPICE kernels to load into SPICE.
kernels :
List of SPICE kernels to load into SPICE. If None, then the default kernels will be loaded.
"""
if kernels is None:
kernels = DEFAULT_KERNELS

process_id = os.getpid()
env_var = f"ADAM_CORE_SPICE_INITIALIZED_{process_id}"
if env_var in os.environ and not force:
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ adam_core
api/orbits
api/propagator
api/time
api/utils

Indices and tables
==================
Expand Down

0 comments on commit 055c56c

Please sign in to comment.