synthesizer.instruments.line_imager

Specialised emission line imaging instrument.

This instrument is designed to hold the attributes required to turn per-line luminosities/fluxes into resolved emission line maps. Unlike photometric imaging, there is no filter transmission curve involved: each emission line is projected directly into its own map, keyed by line id.

Classes

class synthesizer.instruments.line_imager.LineImager(label, line_ids, resolution, psfs=None, psf_resample_factor=1, depth=None, depth_app_radius=None, snrs=None, noise_maps=None, noise_source_maps=None)[source]

Emission line imaging instrument class.

A class containing the attributes and methods required to produce resolved emission line maps. It holds the set of line ids the instrument maps together with the spatial resolution, optional PSFs, and optional noise definitions, each keyed by line id rather than by filter code.

line_ids

The ids of the emission lines this instrument maps. Blended lines (e.g. doublets) can be given as a comma separated string (e.g. “O 3 4958.91A, O 3 5006.84A”) or a nested list of line ids; these produce a single map of the summed lines keyed by the “, “ joined id.

Type:

list

resolution

The spatial resolution of the instrument, in kpc or arcseconds.

Type:

unyt_array

psfs

An optional dictionary of point spread functions, with one entry per line id.

Type:

dict, optional

noise_maps

An optional dictionary of fixed noise maps to apply directly to line maps, with one entry per line id.

Type:

dict, optional

noise_source_maps

An optional dictionary of source maps used to generate correlated-noise models, with one entry per line id.

Type:

dict, optional

depth

The depth of the instrument. If depths are provided per line, this should be a dictionary keyed by line id.

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 per line, this should be a dictionary keyed by line id.

Type:

dict or unyt_quantity, optional

apply_noise(image, line_id, correct_periodicity=True, rng_seed=None, aperture_radius=None)[source]

Apply the configured noise to one line map.

Parameters:
  • image (Image) – Image to which noise should be applied.

  • line_id (str) – Line id identifying which noise definition to use.

  • correct_periodicity (bool) – Whether to apply periodicity correction when generating correlated noise.

  • rng_seed (int, optional) – Seed used for stochastic noise generation.

  • aperture_radius (unyt_quantity, optional) – Aperture radius used by SNR/depth-based noise generation.

Returns:

New image with noise applied.

Return type:

Image

apply_noises(image_collection, correct_periodicity=True, rng_seed=None, aperture_radius=None)[source]

Apply the configured noise to a line map collection.

Parameters:
  • image_collection (ImageCollection) – Collection to which noise should be applied.

  • correct_periodicity (bool) – Whether to apply periodicity correction when generating correlated noise.

  • rng_seed (int, optional) – Seed used for stochastic noise generation.

  • aperture_radius (unyt_quantity, optional) – Aperture radius used by SNR/depth-based noise generation.

Returns:

New image collection with noise applied.

Return type:

ImageCollection

apply_psf(image, line_id, inplace=False)[source]

Apply the configured PSF to one line map.

Parameters:
  • image (Image) – Image to which the PSF should be applied.

  • line_id (str) – Line id identifying which PSF to use.

  • inplace (bool) – If True update image directly and return it. Otherwise return a new image.

Returns:

New image with the PSF applied.

Return type:

Image

Raises:
apply_psfs(image_collection, inplace=False)[source]

Apply the configured PSFs to a line map collection.

Parameters:
  • image_collection (ImageCollection) – Collection to which PSFs should be applied.

  • inplace (bool) – If True update image_collection directly and return it. Otherwise return a new image collection.

Returns:

New image collection with PSFs applied.

Return type:

ImageCollection

Raises:

InconsistentArguments – If psf_resample_factor is smaller than 1.

property can_do_line_mapping

Return whether this instrument supports line mapping.

property can_do_noisy_line_mapping

Return whether this instrument supports noisy line mapping.

property can_do_psf_line_mapping

Return whether this instrument supports PSF line mapping.

generate_maps(lines, fov, img_type, kernel, kernel_threshold, nthreads, emitter, cosmo, quantity='luminosity')[source]

Generate a line map collection for one emitter.

Parameters:
  • lines (LineCollection) – Lines to project into the output maps.

  • fov (unyt_quantity/tuple, unyt_quantity) – Width of the map.

  • img_type (str) – The type of map to create.

  • kernel (np.ndarray, optional) – Kernel used for smoothed particle imaging.

  • kernel_threshold (float) – Kernel impact-parameter threshold.

  • nthreads (int) – Number of threads to use for particle smoothing.

  • emitter (Component) – Emitter supplying geometry and source data.

  • cosmo (astropy.cosmology.Cosmology, optional) – Cosmology used for angular-coordinate conversions.

  • quantity (str) – Either “luminosity” or “flux”, selecting which LineCollection attribute is mapped.

Returns:

The generated map collection, one Image per

requested line id.

Return type:

ImageCollection

get_correlated_noise_model(line_id)[source]

Return the correlated-noise model for a line.

Parameters:

line_id (str) – Line id identifying the required model.

Returns:

The correlated-noise model for the line.

Return type:

CorrelatedNoiseModel

property instrument_type

Return the serialised type tag for this instrument.

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

Load a line imager from an HDF5 file.

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

  • **kwargs – Attribute overrides applied after deserialisation.

Returns:

The loaded instrument.

Return type:

LineImager

to_hdf5(group)[source]

Write the line imager to an HDF5 group.

Parameters:

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