autolens.FitFluxes#

class FitFluxes[source]#

Bases: AbstractFitPoint

Fits the fluxes of a a point source dataset using a Tracer object, where every model flux of the point-source is compared with its observed flux.

The fit performs the following steps:

  1. Compute the magnification of the input image-plane positions via the Hessian of the tracer’s deflection angles.

  2. Determine the image-plane model fluxes by multiplying the source-plane flux with these magnifications.

  3. Subtract the observed fluxes from the model fluxes to compute the residual fluxes, called the residual_map.

  4. Compute the chi-squared of each flux as the square of the residual divided by the RMS noise-map value.

  5. Sum the chi-squared values to compute the overall log likelihood of the fit.

Flux based fitting in the source code always inputs the observed positions of the point dataset as the input positions, but the following changes could be implemented and used in the future:

  • Use the model positions instead of the observed positions to compute the fluxes, which would therefore require the centre of the point source in the source-plane to be used and for the PointSolver to determine the image-plane positions via ray-tracing triangles to and from the source-plane. This would require care in pairing model positions to observed positions where fluxes are computed.

  • The “size” of the point-source is not currently supported, however the ShapeSolver implemented in the source code does allow for magnifications to be computed based on point sources with a shape (e.g. a Circle where its radius is a free parameter).

Point source fitting uses name pairing, whereby the name of the Point object is paired to the name of the point source dataset to ensure that point source datasets are fitted to the correct point source.

This fit object is used in the FitPointDataset to perform position based fitting of a PointDataset, which may also fit other components of the point dataset like fluxes or time delays.

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

Parameters:
  • name (str) – The name of the point source dataset which is paired to a Point profile.

  • data (ArrayIrregular) – The positions of the point source in the image-plane which are fitted.

  • noise_map (ArrayIrregular) – The noise-map of the positions which are used to compute the log likelihood of the positions.

  • tracer (Tracer) – The tracer of galaxies whose point source profile are used to fit the positions.

  • positions (Grid2DIrregular) – The positions of the point source in the image-plane where the fluxes are calculated. These are currently always the observed positions of the point source in the source code, but other positions, like the model positions, could be used in the future.

  • profile (Optional[Point]) – Manually input the profile of the point source, which is used instead of the one extracted from the tracer via name pairing if that profile is not found.

Methods

Attributes

chi_squared

Returns the chi-squared of the fit of the point source fluxes, which is the residual flux values divided by the RMS noise-map values squared.

chi_squared_map

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

data

Overwrite this method to returns the data of the dataset.

log_likelihood

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

magnifications_at_positions

The magnification of every observed position in the image-plane, which is computed from the tracer's deflection angle map via the Hessian.

model_data

The model-fluxes of the tracer at each of the input image-plane positions.

model_fluxes

noise_map

Overwrite this method to returns the noise-map of the dataset.

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:

plane_index

Returns the integer plane index containing the point source galaxy, which is used when computing the deflection angles of image-plane positions from the tracer.

plane_redshift

Returns the redshift of the plane containing the point source galaxy, which is used when computing the deflection angles of image-plane positions from the tracer.

residual_map

Returns the difference between the observed and model fluxes of the point source, which is the residual flux of a point source flux fit.

signal_to_noise_map

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

source_plane_coordinate

Returns the centre of the point-source in the source-plane, which is used when computing the model image-plane positions from the tracer.

property model_data#

The model-fluxes of the tracer at each of the input image-plane positions.

Only point sources which are a PointFlux type, and therefore which include a model parameter for its flux, are used.

property model_fluxes: ArrayIrregular#
property residual_map: ArrayIrregular#

Returns the difference between the observed and model fluxes of the point source, which is the residual flux of a point source flux fit.

property chi_squared: float#

Returns the chi-squared of the fit of the point source fluxes, which is the residual flux values divided by the RMS noise-map values squared.