core.SSOLocator

core.SSOLocator(
    fovs,
    orb,
    simstates=None,
    non_gravs=True,
    copy_orb=False,
    drop_major_asteroids=True,
    spice_asteroid_orb=None,
    spins=None,
)

A class to locate Solar System Objects (SSOs) in a given Field of View (FOV).

This class provides methods to propagate orbits, check if objects are in the FOV, and calculate ephemerides for the objects.

Attributes

fovs : FOVCollection

A collection of FOVs to check against.

Methods

Name Description
init
propagate_n_body Propagate the orbits to the start epoch jd0.
fov_state_check Check which objects are in the FOVs after propagation.
calc_ephems Calculate ephemerides for the objects in the FOVs.

init

core.SSOLocator.__init__(
    fovs,
    orb,
    simstates=None,
    non_gravs=True,
    copy_orb=False,
    drop_major_asteroids=True,
    spice_asteroid_orb=None,
    spins=None,
)

Parameters

fovs : FOVCollection, or iterable of kete.fov.FOV

Field of View(s) to check the propagated states against.

orb : pandas.DataFrame

Orbit file with columns of orbital elements. See query.fetch_orb().

simstates : ~kete.SimultaneousStates, path-like, or None, default = None

Pre-propagated states at a common epoch, or a Parquet path read by ~skyloc.keteutils.load_simstates. propagate_n_body reuses them when its jd0 is None or within jd0_tol of their epoch; otherwise it starts from orb. File paths load without catalog-fingerprint validation. If None, call propagate_n_body before fov_state_check. Default is None.

non_gravs : sequence or bool, default = True

An explicit sequence contains one kete.NonGravModel or None per row of either the input orb or the N-body orbit table after dropping the major asteroids. Use the row order of the corresponding table. Models for dropped rows are unused. If True, keteutils.make_nongravs_models will be used, i.e., objects with non-gravitational terms will have non-gravitational models by kete.NonGravModel.new_comet(). If False, no non-gravitational terms will be used for any object. Default is True.

copy_orb : bool, default = False

If True, copy the orb DataFrame. Default is False.

drop_major_asteroids : bool, default = True

If True, the major asteroids (1 Ceres, 2 Pallas, 4 Vesta, 10 Hygiea, and 704 Interamnia) are dropped from orb before N-body propagation. Their orbits are stored in self._spice_asteroid_orb and checked via SPICE in fov_state_check (when use_spice_for_loaded=True). Default is True.

spice_asteroid_orb : pandas.DataFrame or None, default = None

Orbit rows for the SPICE-loadable asteroids, used instead of extracting them automatically from orb. Useful in the 2nd pass of locator_twice to pass an already-filtered subset. If None, rows are extracted from orb by designation. Default is None.

spins : dict or sequence or None, default = None

Spin/pole models for sub-observer/sub-solar point calculation. Mapping keys are "desig" values in orb. Sequences are row-aligned to orb and normalized at construction time; None entries are ignored. Spin/pole models do not affect propagation.

propagate_n_body

core.SSOLocator.propagate_n_body(
    jd0=None,
    jd0_tol=1e-05,
    suppress_errors=True,
    include_asteroids=False,
    objmask=None,
    output=None,
    overwrite=False,
)

Propagate the orbits to the start epoch jd0.

Parameters

jd0 : float, callable, or None, default = None

Start epoch (TDB JD). A float is the epoch itself, and a callable (e.g., np.mean) computes it from the FOV epochs, self.fovc.fov_jds. None uses the states that already exist, at their own epoch: first the states of this locator (from simstates or an earlier call, unless jd0_tol is 0), then an existing output file (unless overwrite). If there are none, the epoch is the earliest FOV epoch with kete (>=3.3), and the middle of the FOV epochs, (min + max) / 2, with kete_ipac (v1.x). See Notes for why. Default is None.

jd0_tol : float, default = 1e-05

Finite, non-negative epoch tolerance in days. Reuse existing states when their epoch differs from jd0 by strictly less than this value and objmask is None. 0 disables this reuse. Default is 1e-5 days (0.864 seconds). Reused states retain their epoch; this is not a positional accuracy guarantee. Existing output files still load when overwrite=False.

suppress_errors : bool, default = True

If True, errors during propagation will return NaN for the relevant state vectors, but propagation will continue. Default is True.

include_asteroids : bool, default = False

If True, include asteroids in the propagation. Default is False.

objmask : array-like, default = None

A boolean mask to select which objects to propagate. It will select such as self.states_from_orb[objmask] to run the propagation on subset of the objects. Thus, it must have the length same as self.states_from_orb, i.e., same as self.orb. Default is None.

output : str or ~pathlib.Path, default = None

If provided, save the propagated states to a Parquet file with ~skyloc.keteutils.save_simstates. Default is None.

overwrite : bool, default = False

If True, re-do the calculation and overwrite the existing output file if it exists. If False, the output will be loaded if it exists. Default is False.

Notes

Default epoch. The FOV check of kete (>=3.3) first propagates every object to the earliest FOV epoch, so starting there saves one N-body run. The FOV check of kete_ipac (v1.x) uses a 2-body step for each FOV within dt_limit days of the state epoch, and the middle of the FOV epochs makes the longest such step as short as possible.

Output file. If output is provided and the file already exists, and overwrite is False, the function will load the existing file instead of redoing the calculation. The loaded states keep the epoch of the file. A float or callable jd0 that differs from it by jd0_tol days or more raises ValueError. Nothing else is checked, so a completely meaningless result can be returned if the file is not up to date.

fov_state_check

core.SSOLocator.fov_state_check(
    dt_limit=None,
    include_asteroids=False,
    use_spice_for_loaded=True,
    include_planets=False,
    spice_targets=None,
)

Check which objects are in the FOVs after propagation.

Parameters

dt_limit : float or None, default = None

Time span in days within which kete_ipac (v1.x) replaces N-body with a 2-body step. None means 3.0 days with kete_ipac (v1.x). kete (>=3.3) is exact N-body and ignores it, with a UserWarning if a value is given. Default is None.

include_asteroids : bool, default = False

If True, pass include_asteroids=True to kete.fov.fov_state_check, enabling perturbation by the major asteroids during N-body propagation. Default is False.

use_spice_for_loaded : bool, default = True

If True and drop_major_asteroids=True, use SPICE kernels to locate the major asteroids in the FOVs. Has no effect when drop_major_asteroids=False because those asteroids were already propagated N-body and will be found (or not) via the N-body FOV check. Default is True.

include_planets : bool, default = False

If True, also check planets via SPICE using get_default_spice_targets(include_planets=True). Default is False.

spice_targets : list of str, default = None

Additional SPICE-resolvable target names or IDs to check via kete.fov.fov_spice_check. Deduplicated against other targets. Default is None.

Notes

Sets the following attributes after the check:

self.fov_check_simstates : list of kete.SimultaneousStates Combined N-body and SPICE results (all FOVs with any object).

self.fov_check_spice_simstates : list of kete.SimultaneousStates SPICE-only results; empty list if no SPICE targets were checked.

self.fov_check_fov2objs : dict Maps each FOV designation (str) to a list of object designations visible in that FOV.

self.fov_check_objids : list of str Unique object designations visible in at least one FOV.

self.fov_mask_hasobj : np.ndarray of bool Boolean mask over self.fovc selecting FOVs that contain objects.

self.fovc_hasobj : FOVCollection Sub-collection of FOVs that contain at least one object.

self.orb_infov_mask : np.ndarray of bool Boolean mask over self.orb for objects found in any FOV.

self.spice_asteroid_infov_mask : np.ndarray of bool Boolean mask over self._spice_asteroid_orb for the major asteroids found in any FOV.

calc_ephems

core.SSOLocator.calc_ephems(
    gpar_default=0.15,
    sort_by=['vmag'],
    compact=True,
    add_obsid=True,
    drop_obsindex=True,
    add_jds=True,
    output=None,
    overwrite=False,
    spins=None,
    lunar_elong=True,
)

Calculate ephemerides for the objects in the FOVs.

add_obsid : bool, optional If True, the ephemerides will have a column “obsid” with the observer designations. This may increase memory usage significantly, especially if there are many str obsids for millions of rows. Default is True.

drop_obsindex : bool, optional If True, the “obsindex” column will be dropped from the ephemerides. This is useful especially if add_obsid is True. Default is True.

spins : dict or sequence or None, optional Per-call spin/pole model override. If None, constructor spins are used. Mapping keys are "desig" values; sequences are row-aligned to the original constructor orb.

lunar_elong : bool, optional If True, add the "lunar_elong" column (Target-Observer-Moon angle in degrees). Default is True.