nav.config
YAML-backed configuration for RMS-NAV.
Loads and merges settings from bundled defaults and optional user YAML files
using ruamel.yaml.YAML (safe typ), then exposes sections as
nav.support.attrdict.AttrDict for attribute-style access. The
Config class is the main public entry; helpers such as
_as_str_list() validate list-shaped YAML fragments used when building
config structures.
- class Config[source]
Bases:
objectManages configuration settings for the navigation system.
This class handles loading, updating, and accessing configuration settings from YAML files. It provides access to various configuration sections through properties and methods.
- property backplanes: Any
Returns backplanes configuration, including bodies, rings, and target LIDs.
- category(category: str) → AttrDict[source]
Returns the configuration settings for the specified category.
- ensure_loaded() → None[source]
Load bundled default YAML if not already loaded.
Safe to call repeatedly; delegates to
read_config()with no path (same early-return behavior when data is already present).
- fuzzy_satellites(planet: str) → list[str][source]
Returns the list of fuzzy satellites for the specified planet.
- Parameters:
planet – The name of the planet to get fuzzy satellites for.
- Returns:
A list of fuzzy satellite names for the specified planet.
- read_config(config_path: str | Path | None = None, reread: bool = False) → None[source]
Reads configuration from the specified YAML file.
- Parameters:
config_path – Path to the configuration file. If None, uses the default config files.
reread – Whether to reread the configuration file if it has already been read.
- ring_satellites(planet: str) → list[str][source]
Returns the list of ring satellites for the specified planet.
- Parameters:
planet – The name of the planet to get ring satellites for.
- Returns:
A list of ring satellite names for the specified planet.
- satellites(planet: str) → list[str][source]
Returns the list of satellites for the specified planet.
- Parameters:
planet – The name of the planet to get satellites for.
- Returns:
A list of satellite names for the specified planet.
- update_config(config_path: str | Path, read_default: bool = True) → None[source]
Updates the current configuration with values from the specified YAML file.
- Parameters:
config_path – Path to the configuration file containing update values.
read_default – Whether to read the default configuration file if no config has been previously read.
Logger instances and setup for the nav_offset pipeline.
Provides two PdsLogger instances:
MAIN_LOGGER("nav_offset") – top-level program events, written to stdout and to a timestamped logfile underNAV_RESULTS_ROOT/logs/nav_offset/.IMAGE_LOGGER("nav_image") – per-image processing events; both its stdout handler and its per-image logfile handler are attached as local handlers inside eachlogger.open()context so they are active only while that image is being processed.
Call setup_logging() from main() after the nav-results root and CLI
arguments have been resolved. It is safe to call more than once: existing
MAIN_LOGGER handlers are removed before new ones are attached.
- image_log_handlers(image_log_path: FCPath, arguments: Namespace | None, config: Config) → list[Handler][source]
Create local handlers for a single image: a stdout handler and a file handler.
Both levels are resolved from
arguments, thenconfig.general, then"INFO". The returned handlers should be passed toIMAGE_LOGGER.open()so they are active only while that image is being processed and are automatically removed when that context exits.- Parameters:
image_log_path – Destination path for this image’s log file.
arguments – Parsed CLI arguments, or None to fall back entirely to config.
config – Navigation configuration.
- Returns:
A list containing a stdout stream handler and a file handler for the image log.
- Raises:
TypeError – If a configured log level is not a string or
None.ValueError – If a configured log level string is empty or not a standard name.
- setup_logging(arguments: Namespace, config: Config, nav_results_root_str: str) → None[source]
Configure MAIN_LOGGER with stdout and a timestamped file handler.
Reads each log level from
argumentsfirst, then fromconfig.general, then falls back to"INFO". The main logfile is written as a timestamped file under{nav_results_root}/logs/nav_offset/.IMAGE_LOGGER handlers are not configured here; both its console and per-image file handlers are attached as local handlers inside each
IMAGE_LOGGER.open()context viaimage_log_handlers(). However, the image log levels from--log-level-image-consoleand--log-level-image-fileare validated here so that invalid values are caught at startup (before the batch loop) alongside the main-level validation.- Parameters:
arguments – Parsed CLI arguments; may carry
log_level_main_console,log_level_main_file,log_level_image_console, andlog_level_image_fileattributes.config – Navigation configuration providing
general.*fallback values.nav_results_root_str – Local filesystem path to the navigation results root.
- Raises:
TypeError – If a configured log level is not a string or
None.ValueError – If a configured log level string is empty or not a standard name.