Scene

class nyx.core.scene.Scene[source]

Bases: Module

Multi-instrument observation of a shared physical sky.

Atmosphere and source models are shared across instruments, and every instrument’s gradients reach the same parameters; each may have its own nobs. Instruments and sources are reachable as attributes by name, e.g. scene.CT1.shift. Build with build().

Parameters:
  • atmosphere (AtmosphereModel)

  • sources (dict of str to SkySource) – Shared source models, as returned by each builder’s model().

  • instruments (dict of str to InstrumentModel) – Prepared instrument models.

  • _obs_bundles (dict of str to _ObsBundle) – Per-instrument observation data; keys must match instruments.

Attributes Summary

atmosphere

instruments

nobs

Dict of observation counts, keyed by instrument name.

sources

Methods Summary

build(instruments, atmosphere, sources, obs_list)

Build a Scene from components and observations.

parameters_table()

Table of every Parameter in the scene, frozen ones included.

render(*[, per_source])

Render all observations to pixel rates.

set(path, value)

Set one parameter by its dotted path, e.g. 'atmosphere.Mie.aod_500'.

set_params(params)

Set several parameters at once; see set().

Attributes Documentation

atmosphere = <dataclasses._MISSING_TYPE object>
instruments = <dataclasses._MISSING_TYPE object>
nobs

Dict of observation counts, keyed by instrument name.

sources = <dataclasses._MISSING_TYPE object>

Methods Documentation

classmethod build(instruments, atmosphere, sources, obs_list)[source]

Build a Scene from components and observations.

Parameters:
  • instruments (InstrumentModel or dict of str to InstrumentModel) – A lone instrument is wrapped as {'instrument': inst}.

  • atmosphere (AtmosphereModel)

  • sources (EmitterLike, or dict of str to EmitterLike, or list) – Each must provide model() and prepare(obs). A lone emitter is wrapped as {'source': emitter}; a list is auto-named from class names.

  • obs_list (Observation, or dict of str to Observation) – A lone Observation is broadcast to every instrument; a dict must have the same keys as instruments.

Return type:

Scene

parameters_table()[source]

Table of every Parameter in the scene, frozen ones included.

Return type:

ParametersTable

render(*, per_source=False)[source]

Render all observations to pixel rates.

Parameters:

per_source (bool) – Whether to split each instrument’s rates by emitter.

Returns:

One array per instrument, of shape (nobs, n_pixels); or, with per_source, {instrument: {source: array}}.

Return type:

dict of str to jax.Array

set(path, value)[source]

Set one parameter by its dotted path, e.g. 'atmosphere.Mie.aod_500'.

Parameters:
Return type:

Scene

set_params(params)[source]

Set several parameters at once; see set().

Parameters:

params (dict of str to array-like)

Return type:

Scene

__init__(atmosphere, sources, instruments, _obs_bundles)
static __new__(cls, *args, **kwargs)