CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-spiceypy

A Python wrapper for the NAIF CSPICE Toolkit providing essential tools for spacecraft navigation and planetary science calculations

Overview
Eval results
Files

event-finding.mddocs/

Event Finding and Search

Advanced search capabilities for finding geometric events such as occultations, oppositions, and user-defined conditions. These functions enable sophisticated mission planning and analysis.

Capabilities

Distance Events

Find times when distances meet specified conditions.

def gfdist(target: str, abcorr: str, obsrvr: str, relate: str, refval: float, adjust: float, step: float, cnfine: SpiceCell, result: SpiceCell) -> None:
    """
    Find times when distance between observer and target satisfies condition.
    
    Parameters:
    - target: str, target body name
    - abcorr: str, aberration correction
    - obsrvr: str, observer body name
    - relate: str, relational operator ("=", "<", ">", "LOCMIN", "LOCMAX", "ABSMIN", "ABSMAX")
    - refval: float, reference value for comparison
    - adjust: float, adjustment value for absolute extrema searches
    - step: float, search step size in seconds
    - cnfine: SpiceCell, confinement window
    - result: SpiceCell, result window (modified in place)
    
    Returns:
    None (result window is modified)
    """

Occultation Events

Find occultation events between celestial bodies.

def gfoclt(occtyp: str, front: str, fshape: str, fframe: str, back: str, bshape: str, bframe: str, abcorr: str, obsrvr: str, step: float, cnfine: SpiceCell, result: SpiceCell) -> None:
    """
    Find occultation events.
    
    Parameters:
    - occtyp: str, occultation type ("FULL", "ANNULAR", "PARTIAL", "ANY")
    - front: str, front body name
    - fshape: str, front body shape ("POINT", "SPHERE", "ELLIPSOID")
    - fframe: str, front body reference frame
    - back: str, back body name
    - bshape: str, back body shape
    - bframe: str, back body reference frame
    - abcorr: str, aberration correction
    - obsrvr: str, observer body name
    - step: float, search step size in seconds
    - cnfine: SpiceCell, confinement window
    - result: SpiceCell, result window (modified in place)
    
    Returns:
    None (result window is modified)
    """

Angular Separation Events

Find times when angular separations meet conditions.

def gfsep(targ1: str, shape1: str, frame1: str, targ2: str, shape2: str, frame2: str, abcorr: str, obsrvr: str, relate: str, refval: float, adjust: float, step: float, cnfine: SpiceCell, result: SpiceCell) -> None:
    """
    Find times when angular separation between two targets satisfies condition.
    
    Parameters:
    - targ1: str, first target body name
    - shape1: str, first target shape
    - frame1: str, first target reference frame
    - targ2: str, second target body name
    - shape2: str, second target shape
    - frame2: str, second target reference frame
    - abcorr: str, aberration correction
    - obsrvr: str, observer body name
    - relate: str, relational operator
    - refval: float, reference value in radians
    - adjust: float, adjustment value
    - step: float, search step size
    - cnfine: SpiceCell, confinement window
    - result: SpiceCell, result window (modified in place)
    
    Returns:
    None (result window is modified)
    """

Common Usage Patterns

Find Mars Opposition

import spiceypy as spice

spice.furnsh("metakernel.mk")

# Create time window for search (1 year)
start_et = spice.str2et("2023-01-01")
end_et = spice.str2et("2024-01-01")

# Create confinement window
cnfine = spice.cell_double(2)
spice.wninsd(start_et, end_et, cnfine)

# Search for minimum distance (opposition)
result = spice.cell_double(100)
spice.gfdist(
    "MARS",           # Target
    "LT+S",          # Aberration correction
    "EARTH",         # Observer
    "LOCMIN",        # Local minimum
    0.0,             # Reference value (not used for LOCMIN)
    86400.0,         # Adjustment (1 day)
    3600.0,          # Step size (1 hour)
    cnfine,          # Confinement window
    result           # Result window
)

# Extract results
for i in range(spice.wncard(result)):
    start, end = spice.wnfetd(result, i)
    print(f"Mars opposition: {spice.et2utc(start, 'C', 0)}")

spice.kclear()

Install with Tessl CLI

npx tessl i tessl/pypi-spiceypy

docs

ck-orientation.md

coordinate-systems.md

data-structures.md

dsk-shape-models.md

e-kernels.md

ephemeris-trajectories.md

error-handling.md

event-finding.md

geometry-surface.md

index.md

kernel-management.md

low-level-file-access.md

physical-constants.md

reference-frames.md

spacecraft-clock.md

time-systems.md

vector-matrix.md

tile.json