autolens.twins.ObservationSetup#

class ObservationSetup[source]#

Bases: object

How a lens is observed: mask, PSF, observed noise map and sampling.

Parameters:
  • mask (Mask2D) – The mask of the observation; twins are simulated and stored on it.

  • psf (Optional[Convolver]) – The PSF as an al.Convolver (already normalised, as held by the dataset).

  • noise_map (Array2D) – The observed noise map (standard deviation per pixel) on mask. It is the default noise of every twin (ruling R2).

  • pixel_scales (Optional[Tuple[float, float]]) – Default to the mask’s values.

  • origin (Optional[Tuple[float, float]]) – Default to the mask’s values.

  • over_sample_size_lp (Union[int, Array2D]) – Over-sampling of the light-profile and pixelization grids (an int or an aa.Array2D on mask), as used by the fit.

  • over_sample_size_pixelization (Union[int, Array2D]) – Over-sampling of the light-profile and pixelization grids (an int or an aa.Array2D on mask), as used by the fit.

  • cosmology – The cosmology the twin is interpreted in; None means the tracer’s own.

  • exposure_time (Optional[float]) – Only used by the "poisson" noise route, which requires both.

  • background_sky_level (Optional[float]) – Only used by the "poisson" noise route, which requires both.

Methods

dataset_from

An al.Imaging of data observed with this setup: masked with the setup mask and over-sampled with its over-sample sizes, following the aggregator's reload order (build unmasked, apply_mask once, apply_over_sampling).

dataset_from_fit_directory

Rebuild the masked, over-sampled Imaging a model-fit used from its image/dataset.fits (HDUs: 0 mask, 1 data, 2 noise map, 3 PSF, 4 light-profile over-sampling, 5 pixelization over-sampling), as written by AnalysisImaging.save_attributes (autolens/imaging/model/analysis.py).

from_dataset

The setup of a masked al.Imaging dataset: its mask, PSF, noise map and over-sampling.

from_fit_directory

The setup of a model-fit output directory (the folder holding image/ and files/), read from image/dataset.fits exactly as the aggregator does (see dataset_from_fit_directory).

with_

A copy of this setup with the given fields replaced, e.g. setup.with_(exposure_time=2000.0, background_sky_level=1.0).

Attributes

fields

The constructor arguments of this setup, by name.

grid

The masked lens-plane grid, over-sampled with over_sample_size_lp.

property fields: dict#

The constructor arguments of this setup, by name.

classmethod from_dataset(dataset, cosmology=None, exposure_time=None, background_sky_level=None)[source]#

The setup of a masked al.Imaging dataset: its mask, PSF, noise map and over-sampling. The PSF and noise map are copied so later changes to the dataset do not leak into the setup.

static dataset_from_fit_directory(path)[source]#

Rebuild the masked, over-sampled Imaging a model-fit used from its image/dataset.fits (HDUs: 0 mask, 1 data, 2 noise map, 3 PSF, 4 light-profile over-sampling, 5 pixelization over-sampling), as written by AnalysisImaging.save_attributes (autolens/imaging/model/analysis.py).

This replicates PyAutoGalaxy’s aggregator reload _imaging_from (autogalaxy/aggregator/imaging/imaging.py lines 29-115) and agg_util.mask_header_from line for line, for a single (non-summed) analysis, without needing an af.Fit. If that recipe changes, change this.

classmethod from_fit_directory(path, cosmology=None, exposure_time=None, background_sky_level=None)[source]#

The setup of a model-fit output directory (the folder holding image/ and files/), read from image/dataset.fits exactly as the aggregator does (see dataset_from_fit_directory).

with_(**overrides)[source]#

A copy of this setup with the given fields replaced, e.g. setup.with_(exposure_time=2000.0, background_sky_level=1.0).

Fields that depend on the mask (noise map, array over-sampling) are not re-derived: replacing the mask requires replacing them too.

property grid: Grid2D#

The masked lens-plane grid, over-sampled with over_sample_size_lp.

dataset_from(data, noise_map=None)[source]#

An al.Imaging of data observed with this setup: masked with the setup mask and over-sampled with its over-sample sizes, following the aggregator’s reload order (build unmasked, apply_mask once, apply_over_sampling).

Parameters:
  • data – An aa.Array2D (masked or native) or an ndarray (native or slim).

  • noise_map – Defaults to the setup’s observed noise map.