keteutils.propagate.CachedOrbPropagator

keteutils.propagate.CachedOrbPropagator(
    orb,
    m_ng=None,
    *,
    use_nongravs=True,
    include_asteroids=True,
    suppress_errors=True,
)

Prepare a fixed orbit catalog for repeated n-body propagation.

Use this optionally after orb, m_ng = fetch_orb(...) when repeated propagation or shared state caches are needed. fetch_orb still supplies orbit data; locators still receive orb alongside the propagated states.

Non-gravitational models and the fingerprint are built once. The states from orbital elements are built on the first propagation that starts from them, so a cache hit does not convert any orbit. SPICE perturbers are excluded using prepare_nbody_orbits. Exclusion matches exact SBDB numbers. Names and SPICE IDs for those five bodies are rejected; use their SBDB numbers in orb['desig'] instead. Construct a new catalog when the orbital elements or force settings change.

Parameters

orb : pandas.DataFrame

Orbital elements accepted by table_to_states, with unique string desig values. The input table is not modified.

m_ng : bool or array-like of bool, default = None

Rows with non-gravitational acceleration, aligned with the full input table. If absent, inferred by nongrav_parameters.

use_nongravs : bool, default = True

Use the orbit table’s comet acceleration parameters. Defaults to True.

include_asteroids : bool, default = True

Fixed options passed to Kete propagation. Both default to True. Kete may return NaN vectors for failed objects with suppress_errors. Chained NaN states stay failed; propagation does not retry those objects from orbital elements.

suppress_errors : bool, default = True

Fixed options passed to Kete propagation. Both default to True. Kete may return NaN vectors for failed objects with suppress_errors. Chained NaN states stay failed; propagation does not retry those objects from orbital elements.

Notes

Cache identity includes the designations and the orbit columns that table_to_states reads (epoch, ecc, incl, peri_dist, peri_arg, peri_time, lon_node), the normalized force parameters, the propagation settings, the Kete version, and the SHA-256 of the source files propagate.py and _kete_compat.py. Row order does not matter. A Kete version change, or any edit to those two files (even to a comment), rebuilds caches once. Changes to kernels or a locally modified Kete build with an unchanged version require discarding old caches.

Each cache is one Parquet file with its fingerprint and TDB epoch stored in the file’s metadata. The skyloc and Kete versions are also stored as labels for people. They are not checked. Moving or renaming that file preserves the cache. Missing or invalid metadata causes a rebuild.

Methods

Name Description
init
load_cache Load a compatible cache, optionally requiring a particular TDB JD.
propagate Load or compute this catalog’s states at one TDB Julian date.

init

keteutils.propagate.CachedOrbPropagator.__init__(
    orb,
    m_ng=None,
    *,
    use_nongravs=True,
    include_asteroids=True,
    suppress_errors=True,
)

load_cache

keteutils.propagate.CachedOrbPropagator.load_cache(
    path,
    *,
    jd=None,
    jd_tol=1e-05,
)

Load a compatible cache, optionally requiring a particular TDB JD.

With jd=None, accept the cache at its stored epoch. Missing files, incompatible metadata, or invalid coverage/epoch return None. Permission and other I/O errors propagate.

Each cached epoch must differ from jd by less than jd_tol days (default 1e-5). With jd=None, the requested-epoch check is skipped. Cached states retain their stored epoch. The footer-vs-state check keeps 1e-5 days.

propagate

keteutils.propagate.CachedOrbPropagator.propagate(
    jd,
    *,
    output,
    initial_states=None,
    overwrite=False,
    jd_tol=1e-05,
)

Load or compute this catalog’s states at one TDB Julian date.

initial_states must cover the catalog exactly once and originate from this catalog’s dynamics. Pass states returned by load_cache or an earlier propagate call. Invalid initial_states raise. Without initial_states, propagation starts from the orbital-element states.

overwrite=True recomputes even if the output cache is compatible. jd_tol (days, finite and positive) is how far a cached epoch may differ from jd and still be reused; cached states keep their stored epoch. It does not affect the check on newly integrated states. An empty ordinary catalog returns None. Output validation and propagation errors leave an existing cache untouched. Concurrent writers to the same output path are not supported.

Notes

A private temporary directory beside output holds the new file until states and metadata have been written. Replacement preserves the old cache on earlier errors. The published file uses normal process-umask permissions. Normal exit and Python exceptions remove the staging directory; a forced kill can leave it behind, but readers ignore it. No companion file or permanent cache directory is required.

Kete supplies the Parquet schema. PyArrow reads and rewrites that table to add metadata without changing its column types or values. This costs one additional table read/write. Atomic replacement does not guarantee power-loss durability.

Raises

: RuntimeError

If every propagated state is NaN. Nothing is written and an existing cache stays unchanged.