Skip to main content

Crate nsb

Crate nsb 

Source
Expand description

nsb — Night Sky Background model.

Computes the photon flux reaching a ground-based observer from a configurable sum of zodiacal light, integrated starlight, airglow, and scattered moonlight. Integrated starlight is included in defaults only when the build embeds a validated production catalogue-derived map.

The library API is intentionally typed and CLI-free: callers pass Observer values, Time<UTC> instants, and equatorial Target directions directly. Named-site parsing, command-line flags, and output formatting belong in a separate CLI crate that consumes this library.

§Supported public API

The first-release surface is classified in docs/developer-guide/public-api.md.

  1. Core root API — normal evaluator/planning integrations and durable component selectors.
  2. Advanced nested API — components::starlight, components::airglow, site, and solar_activity for supported scientific workflows.
  3. Metadata/schema API — intentional persisted or inspectable records (bundled assets, F10.7 stores).
  4. Private implementation — concrete component evaluators, spectra, planning internals, and test/tooling helpers.

The recommended application path is:

  1. Build an NsbEvaluator from NsbModelConfig.
  2. Evaluate a PointQuery or search with ThresholdQuery.
  3. Read NsbResult / ThresholdQueryResult and per-component NsbComponentMetadata.

§Airglow selection

NsbModelConfig::generic_clear_sky, NsbModelConfig::default, and NsbEvaluator::new use AirglowSelection::Automatic. Explicit NsbModelConfig::with_airglow_model selection wins and never silently switches models. Until the global climatological model is admitted (#157), automatic policy resolves to the temporary Paranal-derived planning fallback with typed fallback metadata in NsbComponentMetadata::airglow_selection. Physical evaluation outcomes live in NsbComponentMetadata::airglow_evaluation and are absent from NsbEvaluator::describe_components descriptors.

§Dependency types

NSB uses Siderust, qtty, and tempoch types at the supported boundary (Observer, Target, Time<UTC>, radiances, angles). The units module is the canonical NSB-facing entry point for qtty: it re-exports the upstream crate and the quantity modules used by NSB. DEG remains re-exported at the crate root for the documented getting-started path.

§Architecture

Shared physical spectra used across components live in the internal spectra module; component-specific calibrations and grids live inside their component modules.

siderust owns astronomy, time, coordinates, events, atmosphere, lunar photometry, and passbands. NSB owns NSB-specific component composition, atmospheric-transport orchestration (transport), observing-window planning, and site-profile metadata that distinguishes generic fallbacks from explicit named planning presets.

Re-exports§

pub use components::airglow::AirglowModel;
pub use components::airglow::AirglowSelection;
pub use components::moonlight::MoonlightModel;
pub use components::starlight::StarlightProduct;
pub use components::zodiacal::ZodiacalExtinction;
pub use components::zodiacal::ZodiacalModel;
pub use site::CalibrationStatus;
pub use site::GenericClearSky;
pub use site::SiteProfile;
pub use site::SiteProfileTag;
pub use units::SolarFluxUnit;
pub use units::SolarFluxUnits;

Modules§

components
Advanced component models used to construct or inspect individual contributors. Physical and empirical NSB component models.
data
Runtime scientific data and build-verified bundled metadata. Runtime ownership for NSB scientific data.
serde_support
Serde field adapters for QTTY photometric types used by NSB consumers. Serde adapters for externally defined photometric types.
site
Site profiles and shared atmospheric assumptions. Scientific site profiles, shared atmospheric assumptions, and calibration metadata.
solar_activity
Offline F10.7 resolution used by airglow configuration. Date-aware F10.7 solar-radio-flux resolution.
transport
Atmospheric transport of spectral sky radiance (identity and direct paths). Atmospheric transport of spectral radiance.
units
Physical quantities, NSB-specific conventions, and the qtty facade. NSB quantity facade and domain-specific unit conventions.

Structs§

BandDiagnostic
Meaning and zero point of reported B/V diagnostics.
ComponentMask
Components that can be composed by NsbEvaluator.
NsbComponent
One reported component contribution.
NsbComponentDescriptor
Metadata-only description of a selected component.
NsbComponentMetadata
Scientific interpretation attached to a component result.
NsbEvaluator
Reusable evaluator with parsed immutable component data.
NsbModelConfig
Immutable model choices used to construct an evaluator.
NsbResult
Complete result of one point evaluation.
PointQuery
Inputs for one point evaluation.
SiteWindowContext
Reusable target-independent preparation for searches at one site and time window.
ThresholdQuery
Inputs for a below-threshold observing-window search.
ThresholdQueryResult
Result of a below-threshold window search.

Enums§

ComponentCalibrationStatus
Scientific calibration/maturity classification.
NsbError
Failures returned by NSB model construction and evaluation.

Constants§

DEG
Angle unit used with Target::new in documented examples. One degree.
MODEL_VERSION
Versioned model-composition contract used in operational metadata.
NSB_VERSION
Version of the NSB library crate.
SIDERUST_SOURCE
Truthful package-source identity for the Siderust dependency.
SIDERUST_VERSION
Siderust package version represented by the locked dependency.

Type Aliases§

Observer
Ground observer in the ECEF geodetic frame.
Result
Crate result alias.
Target
Mean equator/equinox J2000 target direction. Convert ICRS inputs with Siderust’s TransformFrame.