autolens.FitInterferometer#

class FitInterferometer[source]#

Bases: FitInterferometer, AbstractFitInversion

Fits an interferometer dataset using a Tracer object.

The fit performs the following steps:

  1. Compute the sum of all images of galaxy light profiles in the Tracer.

  2. Fourier transform this image with the transformer object and uv_wavelengths to create the profile_visibilities.

  3. Subtract these visibilities from the data to create the profile_subtracted_visibilities.

  4. If the Tracer has any linear algebra objects (e.g. linear light profiles, a pixelization / regulariation) fit the profile_subtracted_visibilities with these objects via an inversion.

  5. Compute the model_data as the sum of the profile_visibilities and reconstructed_data of the inversion (if an inversion is not performed the model_data is only the profile_visibilities.

  6. Subtract the model_data from the data and compute the residuals, chi-squared and likelihood via the noise-map (if an inversion is performed the log_evidence, including addition terms describing the linear algebra solution, is computed).

When performing a model-fit` via ` AnalysisInterferometer` object the figure_of_merit of this object is called and returned in the log_likelihood_function.

Parameters:
  • dataset (Interferometer) – The interforometer dataset which is fitted by the galaxies in the tracer.

  • tracer (Tracer) – The tracer of galaxies whose light profile images are used to fit the interferometer data.

  • dataset_model (Optional[DatasetModel]) – Attributes which allow for parts of a dataset to be treated as a model (e.g. the background sky level).

  • adapt_images (Optional[AdaptImages]) – Contains the adapt-images which are used to make a pixelization’s mesh and regularization adapt to the reconstructed galaxy’s morphology.

  • settings (Settings) – Settings controlling how an inversion is fitted for example which linear algebra formalism is used.

  • preloads – An optional PreloadsInterferometer carrying channel-invariant inversion quantities (e.g. the curvature_matrix F) computed once and reused by this fit instead of being rebuilt. Used by the datacube shared-state path, where every spectral channel shares the lens model. None (the default) leaves the standard per-fit behaviour unchanged.

Methods

append_linear_light_profiles_to_model

For a model instance, this function replaces all linear light profiles with instances of their standard light profile counterparts.

galaxy_linear_obj_data_dict_from

Returns a dictionary mapping every galaxy containing a linear object (e.g. a linear light profile / pixelization) in the model_obj to the model_data of its linear objects.

Attributes

chi_squared

Returns the chi-squared terms of the model data's fit to an dataset, by summing the chi-squared-map.

chi_squared_map

Returns the chi-squared-map between the residual-map and noise-map, where:

data

The data of the dataset being fitted.

dirty_chi_squared_map

The dirty chi-squared map, computed by applying the inverse Fourier transform to the chi-squared-map visibilities (((data - model_data) / noise_map) ** 2.0).

dirty_image

The dirty image of the observed visibility data, computed by applying the inverse Fourier transform to the data visibilities.

dirty_model_image

The dirty model image, computed by applying the inverse Fourier transform to the model data visibilities.

dirty_noise_map

The dirty noise-map, computed by applying the inverse Fourier transform to the noise-map visibilities.

dirty_normalized_residual_map

The dirty normalized residual map, computed by applying the inverse Fourier transform to the normalized residual-map visibilities ((data - model_data) / noise_map).

dirty_residual_map

The dirty residual map, computed by applying the inverse Fourier transform to the residual-map visibilities (data - model_data).

dirty_signal_to_noise_map

The dirty signal-to-noise map, computed by applying the inverse Fourier transform to the signal-to-noise visibilities.

figure_of_merit

The overall goodness-of-fit of the model to the dataset.

galaxy_image_dict

A dictionary which associates every galaxy in the tracer with its image.

galaxy_model_visibilities_dict

A dictionary which associates every galaxy in the tracer with its model visibilities.

galaxy_signal_to_noise_map_dict

A dictionary which associates every galaxy in the tracer with its signal-to-noise map.

grids

The grids of (y,x) coordinates associated with the dataset, adjusted by any grid_offset and grid_rotation_angle specified in the dataset_model.

inversion

A property that is only computed once per instance and then replaces itself with an ordinary attribute.

linear_light_profile_intensity_dict

When linear light profiles are used in an inversion, their intensity parameter values are solved for via linear algebra.

log_evidence

Returns the log Bayesian evidence of the inversion's fit to a dataset, which extends the log likelihood by including penalty terms that quantify the complexity of the inversion's reconstruction:

log_likelihood

Returns the log likelihood of each model data point's fit to the dataset, where:

log_likelihood_with_regularization

Returns the log likelihood of an inversion's fit to the dataset, including a regularization term which comes from an inversion:

mask

The mask of the interferometer fit, returned as an all-False array matching the shape of the visibility data.

model_data

Returns the model data that is used to fit the data.

model_obj_linear_light_profiles_to_light_profiles

The model object may contain linear light profiles, which solve for the intensity during the Inversion.

model_visibilities_of_planes_list

A list of every model image of every plane in the tracer.

noise_map

The noise-map of the dataset being fitted, representing the RMS noise in each pixel.

noise_normalization

Returns the noise-map normalization term of the noise-map, summing the noise_map value in every pixel as:

normalized_residual_map

Returns the normalized residual-map between the masked dataset and model data, where:

perform_inversion

Returns a bool specifying whether this fit object performs an inversion.

profile_subtracted_visibilities

Returns the interferometer dataset's visibilities with all transformed light profile images in the fit's tracer subtracted.

profile_visibilities

Returns the visibilities of every light profile in the tracer, which are computed by performing a Fourier transform to the sum of light profile images.

reduced_chi_squared

The reduced chi-squared of the model's fit to the dataset, defined as:

residual_flux_fraction_map

Returns the residual flux fraction map, which shows the fraction of signal in each pixel that is not fitted by the model, therefore where:

residual_map

Returns the residual-map between the masked dataset and model data, where:

signal_to_noise_map

The signal-to-noise_map of the dataset and noise-map which are fitted.

sparse_operator

Only call the sparse_operator property of a dataset used to perform efficient linear algebra calculations if the Settings()` object has use_sparse_operator=True, to avoid unnecessary computation.

total_mappers

The total number of Mapper objects used by the inversion in this fit.

tracer_linear_light_profiles_to_light_profiles

The Tracer where all linear light profiles have been converted to ordinary light profiles, where their intensity values are set to the values inferred by this fit.

tracer_to_inversion

transformer

The Fourier transformer used to map between image space and visibility (uv-plane) space.

property profile_visibilities: Visibilities#

Returns the visibilities of every light profile in the tracer, which are computed by performing a Fourier transform to the sum of light profile images.

property profile_subtracted_visibilities: Visibilities#

Returns the interferometer dataset’s visibilities with all transformed light profile images in the fit’s tracer subtracted.

property tracer_to_inversion: TracerToInversion#
inversion#

A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property.

Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76

property model_data: Visibilities#

Returns the model data that is used to fit the data.

If the tracer does not have any linear objects and therefore omits an inversion, the model data is the sum of all light profile images Fourier transformed to visibilities.

If a inversion is included it is the sum of these visibilities and the inversion’s reconstructed visibilities.

property galaxy_image_dict: Dict[Galaxy, ndarray]#

A dictionary which associates every galaxy in the tracer with its image.

This image is the image of the sum of:

  • The images of all ordinary light profiles in that tracer summed.

  • The images of all linear objects (e.g. linear light profiles / pixelizations), where the images are solved for first via the inversion.

For modeling, this dictionary is used to set up the adapt_images that adapt certain pixelizations to the data being fitted.

property galaxy_signal_to_noise_map_dict: Dict[Galaxy, ndarray]#

A dictionary which associates every galaxy in the tracer with its signal-to-noise map.

This signal-to-noise map is the signal-to-noise map of the sum of:

  • The images of all ordinary light profiles in that tracer summed.

  • The images of all linear objects (e.g. linear light profiles / pixelizations), where the images are solved for first via the inversion.

For modeling, this dictionary is used to set up the adapt_images that adapt certain pixelizations to the data being fitted.

property galaxy_model_visibilities_dict: Dict[Galaxy, ndarray]#

A dictionary which associates every galaxy in the tracer with its model visibilities.

These visibilities are the sum of:

  • The visibilities of all ordinary light profiles in that tracer summed and Fourier transformed to visibilities space.

  • The visibilities of all linear objects (e.g. linear light profiles / pixelizations), where the visibilities are solved for first via the inversion.

property model_visibilities_of_planes_list: List[Visibilities]#

A list of every model image of every plane in the tracer.

This image is the image of the sum of:

  • The images of all ordinary light profiles in that plane summed and convolved with the imaging data’s PSF.

  • The images of all linear objects (e.g. linear light profiles / pixelizations), where the images are solved for first via the inversion.

This is used to visualize the different contibutions of light from the image-plane, source-plane and other planes in a fit.

property tracer_linear_light_profiles_to_light_profiles: Tracer#

The Tracer where all linear light profiles have been converted to ordinary light profiles, where their intensity values are set to the values inferred by this fit.

This is typically used for visualization, because linear light profiles cannot be used in LightProfile or Galaxy objects.