curryer.correction.kernel_ops

SPICE kernel file management for the correction pipeline.

This module creates and applies parameter-specific SPICE kernels:

  • apply_offset() – modifies telemetry/science data for OFFSET_KERNEL and OFFSET_TIME parameters.

  • _create_dynamic_kernels() – writes SC-SPK/SC-CK kernels from telemetry data (once per image pair, not per parameter set).

  • _create_parameter_kernels() – writes parameter-specific kernels and applies time offsets for each iteration.

Attributes

Functions

apply_offset(config, param_data, input_data)

Apply parameter offsets to input data based on parameter type.

_create_dynamic_kernels(→ list[pathlib.Path])

Create dynamic SPICE kernels from telemetry data.

_create_parameter_kernels(→ tuple[list[pathlib.Path], Any])

Create parameter-specific SPICE kernels and apply time offsets.

Module Contents

curryer.correction.kernel_ops.logger
curryer.correction.kernel_ops.apply_offset(config: curryer.correction.config.ParameterConfig, param_data, input_data)

Apply parameter offsets to input data based on parameter type.

Parameters:
  • config – ParameterConfig specifying how to apply the offset

  • param_data – The parameter values to apply (offset amounts)

  • input_data – The input dataset to modify

Returns:

Modified copy of input_data with parameter offsets applied

curryer.correction.kernel_ops._create_dynamic_kernels(setup: curryer.correction.config.GeolocationSetup, work_dir: pathlib.Path, tlm_dataset: pandas.DataFrame, creator: curryer.kernels.create.KernelCreator) list[pathlib.Path]

Create dynamic SPICE kernels from telemetry data.

Dynamic kernels (SC-SPK, SC-CK) are generated from spacecraft telemetry and do not change with parameter variations. In the current implementation, these are created once per image.

Parameters:
  • setup (GeolocationSetup) – Setup with geo settings and dynamic_kernels list

  • work_dir (Path) – Working directory for kernel files

  • tlm_dataset (pd.DataFrame) – Spacecraft state data with position, velocity, attitude, and time columns

  • creator (create.KernelCreator) – KernelCreator instance for writing kernels

Returns:

List of kernel file paths created (e.g., [sc_ephemeris.bsp, sc_attitude.bc])

Return type:

list[Path]

Examples

>>> from curryer.kernels import create
>>> creator = create.KernelCreator(overwrite=True, append=False)
>>> dynamic_kernels = _create_dynamic_kernels(config, work_dir, tlm_dataset, creator)
>>> # Use in SPICE context
>>> with sp.ext.load_kernel(dynamic_kernels):
...     # Perform geolocation
...     pass
curryer.correction.kernel_ops._create_parameter_kernels(params: list[tuple[curryer.correction.config.ParameterConfig, Any]], work_dir: pathlib.Path, tlm_dataset: pandas.DataFrame, sci_dataset: pandas.DataFrame, ugps_times: Any, setup: curryer.correction.config.GeolocationSetup, creator: curryer.kernels.create.KernelCreator) tuple[list[pathlib.Path], Any]

Create parameter-specific SPICE kernels and apply time offsets.

This function applies parameter variations by creating modified kernels (CONSTANT_KERNEL, OFFSET_KERNEL) or modifying time tags (OFFSET_TIME). Each parameter set produces different kernels and/or time modifications.

Parameters:
  • params (list[tuple[ParameterConfig, Any]]) – List of (ParameterConfig, parameter_value) tuples for this iteration

  • work_dir (Path) – Working directory for kernel files

  • tlm_dataset (pd.DataFrame) – Spacecraft state data (may be modified for OFFSET_KERNEL) with position, velocity, attitude, and time columns

  • sci_dataset (pd.DataFrame) – Science frame time data (may be modified for OFFSET_TIME), may include optional measurement columns

  • ugps_times (array-like) – Original time array from science dataset

  • setup (GeolocationSetup) – Setup with geo settings

  • creator (create.KernelCreator) – KernelCreator instance for writing kernels

Returns:

  • param_kernels (list[Path]) – List of parameter-specific kernel file paths

  • ugps_times_modified (array-like) – Modified time array if OFFSET_TIME applied, otherwise original times

Examples

>>> param_kernels, times = _create_parameter_kernels(
...     params, work_dir, tlm_dataset, sci_dataset, ugps_times, setup, creator
... )
>>> # Use in SPICE context with dynamic kernels
>>> with sp.ext.load_kernel([dynamic_kernels, param_kernels]):
...     geo = geolocate(times)