nav.sim

Add Gaussian background noise to the image.

Parameters:
  • img – Image array to modify in-place.

  • noise_level – Standard deviation of Gaussian noise (0-1).

  • seed – Random seed for reproducibility.

Add random background stars to the image.

Parameters:
  • img – Image array to modify in-place (stars are added, not overwritten).

  • n_stars – Number of stars to add (0-1000).

  • seed – Random seed for reproducibility.

  • psf_sigma – PSF sigma value for star rendering (default 0.9).

  • distribution_exponent – Power law exponent for intensity distribution (default 2.5). Higher values make dimmer stars more common.

Render bodies over img and return fields by name.

Returns: a dict with keys:

  • img: NDArrayFloatType the rendered image

  • bodies: dict[str, dict[str, Any]]

  • inventory: dict[str, dict[str, float]]

  • body_masks: list[NDArrayBoolType]

  • order_near_to_far: list[str]

  • body_index_map: NDArrayIntType (int32), 1-based index into order_near_to_far or 0 if none

Render stars then bodies from a full sim_params dict. Returns (img, meta).

ignore_offset = True should be used when rendering the image in the GUI, but not when creating the simulated image to navigate.

Parameters:
  • sim_params – The parameters describing the simulated model.

  • ignore_offset – Whether to ignore the offset.

Returns:

A tuple containing the image and metadata.

Render stars into img. Returns (img, sim_star_list, star_render_info).

Simulated ring rendering for navigation testing.

This module provides functions to render planetary rings in simulated images for navigation testing. Rings are rendered as circular or elliptical features with anti-aliased edges.

Compute border_atop mask for simulated ring edge.

This simulates the border_atop backplane function for simulated rings by finding pixels where the distance from center transitions across the edge radius computed from mode 1 parameters.

Parameters:
  • size_v – Image height in pixels.

  • size_u – Image width in pixels.

  • center_v – V coordinate of ring center.

  • center_u – U coordinate of ring center.

  • a – Semi-major axis in pixels (mode 1 ‘a’ value).

  • ae – Eccentricity times semi-major axis in pixels.

  • long_peri – Longitude of pericenter in degrees.

  • rate_peri – Rate of precession in degrees/day.

  • epoch – Epoch time (TDB seconds).

  • time – Current time (TDB seconds).

Returns:

Boolean array where True indicates pixels at the edge.

Compute edge radius at a specific angle using mode 1 parameters.

Parameters:
  • angle – Angle in radians from center.

  • a – Semi-major axis in pixels.

  • ae – Eccentricity times semi-major axis in pixels.

  • long_peri – Longitude of pericenter in degrees.

  • rate_peri – Rate of precession in degrees/day.

  • epoch – Epoch time (TDB seconds).

  • time – Current time (TDB seconds).

Returns:

Edge radius in pixels at the given angle.

Compute edge radius from mode 1 parameters at a specific pixel.

Parameters:
  • center_v – V coordinate of ring center.

  • center_u – U coordinate of ring center.

  • pixel_v – V coordinate of pixel.

  • pixel_u – U coordinate of pixel.

  • a – Semi-major axis in pixels.

  • ae – Eccentricity times semi-major axis in pixels.

  • long_peri – Longitude of pericenter in degrees.

  • rate_peri – Rate of precession in degrees/day.

  • epoch – Epoch time (TDB seconds).

  • time – Current time (TDB seconds).

Returns:

Edge radius in pixels at the given pixel position.

Render a single ring or gap into the image.

Parameters:
  • img – Image array to modify in-place.

  • ring_params – Dictionary containing ring parameters: - name: str, ring name - feature_type: str, ‘RINGLET’ or ‘GAP’ - center_v: float, V coordinate of ring center - center_u: float, U coordinate of ring center - shading_distance: float, distance in pixels for edge fading - inner_data: list[dict], mode data for inner edge (mode 1 required) - outer_data: list[dict], mode data for outer edge (mode 1 required)

  • offset_v – V offset to apply.

  • offset_u – U offset to apply.

  • time – Current time in TDB seconds (default 0.0).

  • epoch – Epoch time in TDB seconds (default 0.0).

  • shade_solid – If True, solid rings (with both edges) are shaded on both sides as if they were two rings (one with inner edge only, one with outer edge only).