synthesizer.instruments.spectroscopic_instrument

Specialised spectroscopic instrument.

This instrument is designed to hold the attributes required for one- dimensional spectroscopy. It stores a wavelength grid together with optional depth, signal-to-noise, and noise-map definitions.

Classes

class synthesizer.instruments.spectroscopic_instrument.SpectroscopicInstrument(label, lam, depth=None, depth_app_radius=None, snrs=None, noise_maps=None)[source]

Spectroscopic instrument class.

A class containing the attributes and methods required for integrated spectroscopy. It holds the wavelength array defining the spectral coverage of the instrument together with the optional noise information required to generate noisy spectra. It does not include any spatially resolved state.

lam

The wavelength array defining the spectral coverage of the instrument.

Type:

unyt_array

depth

The depth of the instrument. If depths are provided in multiple bins or regions, this should be a dictionary keyed by the relevant labels.

Type:

dict or unyt_quantity, optional

depth_app_radius

The aperture radius for the depth measurement. If this is omitted but SNRs and depths are provided, the depth is assumed to be a point-source depth.

Type:

unyt_quantity, optional

snrs

The signal-to-noise ratios of the instrument. If values are provided in multiple bins or regions, this should be a dictionary keyed by the relevant labels.

Type:

dict or unyt_quantity, optional

noise_maps

An optional array with noise as a function of wavelength, in the same units as the spectral noise.

Type:

unyt_array, optional

apply_lam_array(sed, nthreads=1)[source]

Apply the instrument wavelength array to an SED.

This method is the instrument-owned entry point for applying the spectroscopic wavelength definition to an SED. At present it remains a thin wrapper around the existing SED resampling primitive so the instrument owns the wavelength-application policy while the SED still performs the low-level resampling.

Parameters:
  • sed (Sed) – Spectral energy distribution to observe.

  • nthreads (int) – Number of threads to use in the low-level resampling call.

Returns:

New SED resampled onto the instrument wavelength grid.

Return type:

Sed

apply_noise(spectrum, **kwargs)[source]

Apply spectroscopic noise to an observed spectrum.

This method is the placeholder instrument-owned entry point for noisy one-dimensional spectroscopy. The public behaviour surface should exist now even though the underlying machinery has not yet been implemented.

Parameters:
  • spectrum – Observed spectrum-like object to which noise should be applied.

  • **kwargs – Future keyword arguments for controlling the noise model and its application.

Raises:

UnimplementedFunctionality – Raised because noisy one-dimensional spectroscopy has not yet been implemented on the instrument side.

property can_do_noisy_spectroscopy

Return whether this instrument supports noisy spectroscopy.

property can_do_spectroscopy

Return whether this instrument supports spectroscopy.

property instrument_type

Return the serialised type tag for this instrument.

classmethod load(filepath, **kwargs)[source]

Load a spectroscopic instrument from an HDF5 file.

Parameters:
  • filepath (str or PathLike) – Path to the HDF5 file.

  • **kwargs – Attribute overrides applied after deserialisation.

Returns:

The loaded instrument.

Return type:

SpectroscopicInstrument

to_hdf5(group)[source]

Write the spectroscopic instrument to an HDF5 group.

Parameters:

group (h5py.Group) – Group into which the instrument should be serialised.