tts_spice

Submodules

tts_spice.furnish

class tts_spice.furnish.KernelRegistry

Bases: object

Registry of available SPICE kernels organized by type and body.

This class acts as a catalog, mapping abstract requests (e.g., “Earth orientation”) to concrete filenames located in the SPICE_BASE directory.

BODY_KERNELS = {'earth': {KernelType.ORIENTATION: ['earth_latest_high_prec.bpc']}, 'moon': {KernelType.ORIENTATION: ['moon_pa_de421_1900-2050.bpc']}}
STANDARD_KERNELS = {KernelType.EPHEMERIS: ['de430.bsp'], KernelType.LEAP_SECONDS: ['naif0012.tls'], KernelType.ORIENTATION: ['pck00010.tpc']}
classmethod get_body_kernels(body: str, kernel_type: KernelType | None = None) List[Path]

Get paths to all kernels for a specific body, optionally filtered by type.

Args:

body: The name of the celestial body (e.g., ‘earth’, ‘moon’). Case-insensitive. kernel_type: If provided, only returns kernels of this specific type.

If None, returns all known kernels for that body.

Returns:

List[Path]: A list of full paths to the matching kernels.

classmethod get_kernel_path(kernel_name: str) Path

Get the absolute path to a kernel file.

Args:

kernel_name: The filename of the kernel (e.g., “de430.bsp”).

Returns:

Path: The full PosixPath to the kernel file.

classmethod get_standard_kernels(kernel_type: KernelType) List[Path]

Get paths to all standard kernels of a specific type.

Standard kernels are those used for general solar system calculations, such as generic planetary ephemerides (DE4xx) or leap seconds (LSK).

Args:

kernel_type: The category of kernel requested.

Returns:

List[Path]: A list of full paths to the matching kernels.

class tts_spice.furnish.KernelType(*values)

Bases: Enum

Enumeration of different types of SPICE kernels.

These abbreviations correspond to the standard NAIF SPICE kernel types: - LSK: Leap Seconds Kernel (time conversion) - SPK: Spacecraft Planet Kernel (ephemeris/positions) - PCK: Planetary Constants Kernel (body size, shape, orientation) - IK: Instrument Kernel (field-of-view, mounting alignment) - FK: Frames Kernel (reference frame definitions) - EK: Events Kernel (mission events) - SCLK: Spacecraft Clock Kernel (time correlation) - DSK: Digital Shape Kernel (topography) - MK: Meta-Kernel (lists other kernels to load)

DSK = 'DSK'
EPHEMERIS = 'SPK'
EVENTS = 'EK'
FRAME = 'FK'
INSTRUMENT = 'IK'
LEAP_SECONDS = 'LSK'
META = 'MK'
ORIENTATION = 'PCK'
SPACECRAFT_CLOCK = 'SCLK'
tts_spice.furnish.clear_kernels() None

Unload all SPICE kernels from the CSPICE runtime.

This wraps spiceypy.kclear(). It resets the internal kernel pool and clears the local _LOADED_KERNELS tracking set.

tts_spice.furnish.furnish_kernel(kernel_path: str | Path) None

Load a single SPICE kernel into the CSPICE runtime.

This function wraps spiceypy.furnsh() with tracking to prevent duplicate loads and error handling for missing files.

Args:

kernel_path: The full path to the kernel file.

Raises:

FileNotFoundError: If the kernel file does not exist. Exception: If SPICE fails to load the kernel (e.g., corrupt file).

tts_spice.furnish.furnish_kernels(kernel_paths: List[str | Path]) None

Load a list of SPICE kernels.

Args:

kernel_paths: A list of paths to kernel files to load.

tts_spice.furnish.leap_seconds() None

Load the standard Leap Seconds Kernel (LSK).

This is required for converting between UTC and Ephemeris Time (ET/TDB). Without this, time conversions will fail.

tts_spice.furnish.mission_kernels(mission_name: str) None

Load SPICE kernels for a specific space mission.

This attempts to locate a directory in kernels/missions/{mission_name}. It prioritizes loading a meta-kernel (.tm) if one exists. If not, it falls back to loading all kernel files in that directory matching the glob `.????`.

Args:

mission_name: The name of the mission subdirectory (e.g., ‘cassini’, ‘juno’).

Raises:

FileNotFoundError: If the mission directory does not exist.

tts_spice.furnish.planetary_constants() None

Load standard Planetary Constants Kernels (PCK).

These text kernels (e.g., pck00010.tpc) define the size, shape (radii), and orientation models for planets and satellites.

tts_spice.furnish.planetary_ephemerides() None

Load standard Planetary Ephemeris Kernels (SPK).

These kernels (e.g., DE430, DE440) contain the positions and velocities of major solar system bodies (sun, planets, moon) relative to the solar system barycenter.

tts_spice.furnish.rotation_kernels(bodies: str | List[str]) None

Load high-precision rotation kernels for specified bodies.

These are typically binary PCK files that provide more accurate orientation data than the generic text PCK files.

Args:

bodies: A single body name (str) or list of names (List[str]).

Raises:

ValueError: If a requested body does not have rotation kernels registered.