nav.sim
- render_background_noise(img: ndarray[tuple[Any, ...], dtype[floating[Any]]], noise_level: float, seed: int) → None[source]
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.
- render_background_stars(img: ndarray[tuple[Any, ...], dtype[floating[Any]]], n_stars: int, seed: int, psf_sigma: float = 0.9, distribution_exponent: float = 2.5) → None[source]
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(img: ndarray[tuple[Any, ...], dtype[floating[Any]]], bodies_params: list[dict[str, Any]], offset_v: float, offset_u: float, *, seed: int | None = None) → dict[str, Any][source]
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_combined_model(sim_params: dict[str, Any], *, ignore_offset: bool = False) → tuple[ndarray[tuple[Any, ...], dtype[floating[Any]]], dict[str, Any]][source]
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(img: ndarray[tuple[Any, ...], dtype[floating[Any]]], stars_params: list[dict[str, Any]], offset_v: float, offset_u: float) → tuple[ndarray[tuple[Any, ...], dtype[floating[Any]]], list[MutableStar], list[dict[str, Any]]][source]
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_simulated(size_v: int, size_u: int, center_v: float, center_u: float, *, a: float, ae: float, long_peri: float, rate_peri: float, epoch: float, time: float) → ndarray[tuple[Any, ...], dtype[bool]][source]
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_angle(angle: float, *, a: float, ae: float, long_peri: float, rate_peri: float, epoch: float, time: float) → float[source]
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_mode1(center_v: float, center_u: float, pixel_v: float, pixel_u: float, *, a: float, ae: float, long_peri: float, rate_peri: float, epoch: float, time: float) → float[source]
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_ring(img: ndarray[tuple[Any, ...], dtype[floating[Any]]], ring_params: dict[str, Any], offset_v: float, offset_u: float, *, time: float = 0.0, epoch: float = 0.0, shade_solid: bool = False) → None[source]
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).