autolens.FitPositionsSource#
- class FitPositionsSource[source]#
Bases:
AbstractFitPositionsFits the positions of a a point source dataset using a Tracer object with a source-plane chi-squared based on the separation of image-plane positions ray-traced to the source-plane compared to the centre of the source galaxy.
The fit performs the following steps:
Determine the source-plane centre of the source-galaxy, which could be a free model parameter or computed as the barycenter of ray-traced positions in the source-plane, using name pairing (see below).
Ray-trace the positions in the point source to the source-plane via the Tracer, including accounting for multi-plane ray-tracing.
Compute the distance of each ray-traced position to the source-plane centre and compute the residuals,
Compute the magnification of each image-plane position via the Hessian of the tracer’s deflection angles.
Compute the residuals of each position as the difference between the source-plane centre and each ray-traced position.
Compute the chi-squared of each position as the square of the residual multiplied by the magnification and divided by the RMS noise-map value.
Sum the chi-squared values to compute the overall log likelihood of the fit.
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 (
Grid2DIrregular) – 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.solver (
Optional[PointSolver]) – Solves the lens equation in order to determine the image-plane positions of a point source by ray-tracing triangles to and from the source-plane. This is not used in this source-plane point source fit.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_squaredReturns the chi-squared terms of the model data's fit to an dataset, by summing the chi-squared-map.
Returns the chi-squared of the point-source source-plane fit, which is the sum of the squared residuals multiplied by the magnifications squared, divided by the noise-map values squared.
dataOverwrite this method to returns the data of the dataset.
Returns the log likelihood of the point-source source-plane fit, which is the sum of the chi-squared values.
magnifications_at_positionsThe magnification of every observed position in the image-plane, which is computed from the tracer's deflection angle map via the Hessian.
Returns the source-plane model positions of the point source, which are the positions of the image-plane positions ray-traced to the source-plane.
noise_mapOverwrite this method to returns the noise-map of the dataset.
Returns the normalization of the noise-map, which is the sum of the noise-map values squared.
normalized_residual_mapReturns the normalized residual-map between the masked dataset and model data, where:
plane_indexReturns 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_redshiftReturns 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.
positionsReturns the residuals of the point-source source-plane fit, which are the distances of each source-plane position from the source-plane centre.
signal_to_noise_mapThe signal-to-noise_map of the dataset and noise-map which are fitted.
source_plane_coordinateReturns 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: Grid2DIrregular#
Returns the source-plane model positions of the point source, which are the positions of the image-plane positions ray-traced to the source-plane.
This calculation accounts for multi-plane ray-tracing, whereby if the tracer has more than 2 planees the redshift of the point source galaxy is extracted and the deflections between the image-plane and source-plane at its specific redshift are used.
- property residual_map: ArrayIrregular#
Returns the residuals of the point-source source-plane fit, which are the distances of each source-plane position from the source-plane centre.
- property chi_squared_map: float#
Returns the chi-squared of the point-source source-plane fit, which is the sum of the squared residuals multiplied by the magnifications squared, divided by the noise-map values squared.