Features¶
This page provides an overview of nyx’s capabilities.
Fully differentiable forward model¶
The entire rendering pipeline is built on JAX, so every predicted pixel rate is differentiable with respect to the model parameters.
End-to-end gradients through emitters, atmosphere, and instrument enable gradient-based optimisation and Bayesian inference (HMC/NUTS).
JIT compilation and vectorisation via
jax.jitandjax.vmapfor fast evaluation over many observations.Pytree-based models built on Equinox modules, so models compose cleanly and play well with JAX transformations.
Modular, composable architecture¶
A simulation is assembled from three interchangeable component types and a
shared observation/geometry description, then combined into a
Scene for rendering:
Instrument — the detector response (
nyx.instrument).Atmosphere — extinction and scattering (
nyx.atmosphere).Emitters — the physical light sources (
nyx.emitter).
Each component follows a small set of protocols (InstrumentModel,
AtmosphereModel, SkySource), so custom
components can be dropped in without changing the rest of the pipeline. The
render() pipeline routes each source through the appropriate
rendering path (diffuse map scattering, line-of-sight extinction, and
individual in-scattering) based on per-observation flags.
Physical sky emitters¶
nyx ships with the dominant contributors to the night sky background, each backed by a published model or dataset:
Zodiacal light —
ZodiacalLight, based on the Leinert et al. (1998) brightness tables with solar-spectrum colour correction.Airglow —
Airglow, with a solar-activity (SFU) scaling and a van Rhijn zenith-angle dependence; supports ESO SkyCalc templates.Lunar brightness —
Moon, a scattered-moonlight model conditioned on phase angle, Earth–Moon distance, and Sun angle.Stellar catalogs —
Stars, combining a diffuse all-sky map with resolved bright stars, with support for Gaia DR3. Resolved star flux is handled separately from the diffuse map to avoid double-counting.
Atmospheric extinction and scattering¶
The atmosphere module provides a differentiable single-scattering radiative
transfer model (SingleScattering) assembled from
reusable physical components:
Rayleigh scattering with the Rayleigh phase function (
RayleighComponent).Mie / aerosol scattering via a Henyey–Greenstein phase function (
HenyeyGreensteinComponent).Tabulated absorption such as ozone (
TabulatedAbsorption), with built-in optical-depth helpers (tau_rayleigh(),tau_mie(),tau_ozone()).Airmass models including Kasten & Young (1989) and the plane-parallel approximation.
Instrument response¶
The instrument model captures the telescope’s effective collecting area and spectral response:
Effective-aperture instrument (
EffectiveApertureInstrument) with a wavelength-dependent bandpass and per-pixel efficiency.Built from a ray trace: an
EffectiveApertureTablewritten by iactrace is the instrument’s stored form, so a scan is run once and reloaded thereafter (load_aperture_table()).
Flexible spectral models¶
Source spectra are described by composable spectral models
(nyx.spectra):
Stored spectra (
StoredSpectrum) from empirical or template libraries.Parametric spectra (
ParametricSpectrum) driven by a user-supplied, differentiable function of physical conditions.Pass-through spectra (
PassThroughSpectrum) for sources that already carry per-wavelength radiance.Flux-conserving resampling onto the model wavelength grid (
resample_flux()).
nyx bundles solar, stellar (Pickles 1998), and empirical spectral templates, together with CALSPEC standards and SVO filter profiles (see LicenseRef-Nyx-Data).
Parameter handling and inference¶
Model parameters are differentiable objects with explicit
characteristic scales (Parameter), which keeps the optimiser
well-conditioned across physically disparate quantities:
Freeze / unfreeze parameters individually or in bulk (
freeze(),unfreeze(),freeze_all(),unfreeze_all()) to control what is fit.Automatic scaling of parameters (
autoscale()).Optimisation via the
Optimizer, built on Optimistix, with multi-target joint fitting throughMultiTargetFit.Uncertainty estimation with
parameter_errors().Posterior sampling with
scene_model(), which reads the same frozen/unfrozen switch and hands the model to NumPyro.
Observation and geometry model¶
HEALPix-based sky discretisation (
Geometry) with configurable resolution (nside), in-scattering grid, and field of view.Observation description (
Observation) tying together observer location, time, target, geometry and atmospheric conditions.
See API Reference for the complete API reference, and the Example Gallery for worked end-to-end examples.