class autolens.Preloads(w_tilde: Optional[autoarray.dataset.imaging.WTildeImaging] = None, use_w_tilde: Optional[bool] = None, blurred_image: Optional[autoarray.structures.arrays.two_d.array_2d.Array2D] = None, traced_grids_of_planes_for_inversion: Optional[autoarray.structures.grids.two_d.grid_2d.Grid2D] = None, sparse_image_plane_grid_list_of_planes: Optional[autoarray.structures.grids.two_d.grid_2d.Grid2D] = None, relocated_grid: Optional[autoarray.structures.grids.two_d.grid_2d.Grid2D] = None, mapper_list: Optional[autoarray.inversion.mappers.abstract.AbstractMapper] = None, operated_mapping_matrix: Optional[numpy.ndarray] = None, curvature_matrix_preload: Optional[numpy.ndarray] = None, curvature_matrix_counts: Optional[numpy.ndarray] = None, regularization_matrix: Optional[numpy.ndarray] = None, log_det_regularization_matrix_term: Optional[float] = None, failed=False)
__init__(w_tilde: Optional[autoarray.dataset.imaging.WTildeImaging] = None, use_w_tilde: Optional[bool] = None, blurred_image: Optional[autoarray.structures.arrays.two_d.array_2d.Array2D] = None, traced_grids_of_planes_for_inversion: Optional[autoarray.structures.grids.two_d.grid_2d.Grid2D] = None, sparse_image_plane_grid_list_of_planes: Optional[autoarray.structures.grids.two_d.grid_2d.Grid2D] = None, relocated_grid: Optional[autoarray.structures.grids.two_d.grid_2d.Grid2D] = None, mapper_list: Optional[autoarray.inversion.mappers.abstract.AbstractMapper] = None, operated_mapping_matrix: Optional[numpy.ndarray] = None, curvature_matrix_preload: Optional[numpy.ndarray] = None, curvature_matrix_counts: Optional[numpy.ndarray] = None, regularization_matrix: Optional[numpy.ndarray] = None, log_det_regularization_matrix_term: Optional[float] = None, failed=False)

Class which offers a concise API for settings up the preloads, which before a model-fit are set up via a comparison of two fits using two different models. If a quantity in these two fits is identical, it does not change thoughout the model-fit and can therefore be preloaded to avoid computation, speeding up the analysis.

For example, the image-plane source-plane pixelization grid (which may be computationally expensive to compute via a KMeans algorithm) does not change for the majority of model-fits, because the associated model parameters are fixed. Preloading avoids rerruning the KMeans algorithm for every model fitted, by preloading it in memory and using this preload in every fit.

Methods

 __init__(w_tilde, use_w_tilde, …[, failed]) Class which offers a concise API for settings up the preloads, which before a model-fit are set up via a comparison of two fits using two different models. check_via_fit(fit) output_info_to_summary(file_path) reset_all() Reset all preloads, typically done at the end of a model-fit to save memory. set_blurred_image(fit_0, fit_1) If the LightProfile’s in a model are all fixed parameters their corresponding image and therefore PSF blurred image do not change during the model fit and can therefore be preloaded. set_mapper_list(fit_0, fit_1) If the MassProfile’s and Pixelization’s in a model are fixed, the mapping of image-pixels to the source-pixels does not change during the model-fit and the list of Mapper’s containing this information can be preloaded. set_operated_mapping_matrix_with_preloads(…) If the MassProfile’s and Pixelization’s in a model are fixed, the mapping of image-pixels to the source-pixels does not change during the model-fit and matrices used to perform the linear algebra in an inversion can be preloaded, which help efficiently construct the curvature matrix. set_regularization_matrix_and_term(fit_0, fit_1) If the MassProfile’s and Pixelization’s in a model are fixed, the mapping of image-pixels to the source-pixels does not change during the model-fit and therefore its associated regularization matrices are also fixed, meaning the log determinant of the regularization matrix term of the Bayesian evidence can be preloaded. set_relocated_grid(fit_0, fit_1) If the MassProfile’s in a model are fixed their traced grids (which may have had coordinates relocated at the border) does not change during the model=fit and can therefore be preloaded. set_sparse_image_plane_grid_list_of_planes(…) If the Pixelization’s in a model are fixed their image-plane sparse grid (which defines the set of pixels that are ray-traced to construct the source-plane pixelization) do not change during the model=fit and can therefore be preloaded. set_traced_grids_of_planes_for_inversion(…) If the MassProfiles’s in a model are fixed their deflection angles and therefore corresponding traced grids do not change during the model-fit and can therefore be preloaded. set_w_tilde_imaging(fit_0, fit_1) The w-tilde linear algebra formalism speeds up inversions by computing beforehand quantities that enable efficiently construction of the curvature matrix. setup_all_via_fits(fit_0, fit_1) Setup the Preloads from two fits which use two different lens model of a model-fit.

Attributes

 info The information on what has or has not been preloaded, which is written to the file preloads.summary.
classmethod setup_all_via_fits(fit_0, fit_1) → autolens.lens.model.preloads.Preloads

Setup the Preloads from two fits which use two different lens model of a model-fit.

Parameters: fit_0 – The first fit corresponding to a model with a specific set of unit-values. fit_1 – The second fit corresponding to a model with a different set of unit-values. Preloads which are set up based on the fit’s passed in specific to a lens model. Preloads
set_blurred_image(fit_0, fit_1)

If the LightProfile’s in a model are all fixed parameters their corresponding image and therefore PSF blurred image do not change during the model fit and can therefore be preloaded.

This function compares the blurred image of two fit’s corresponding to two model instances, and preloads the blurred image if the blurred image of both fits are the same.

The preload is typically used though out search chaining pipelines, as it is common to fix the lens light for the majority of model-fits.

Parameters: fit_0 – The first fit corresponding to a model with a specific set of unit-values. fit_1 – The second fit corresponding to a model with a different set of unit-values.
set_traced_grids_of_planes_for_inversion(fit_0, fit_1)

If the MassProfiles’s in a model are fixed their deflection angles and therefore corresponding traced grids do not change during the model-fit and can therefore be preloaded.

This function compares the traced grids of two fit’s corresponding to two model instances, and preloads the traced grids if the grids of both fits are the same. This preloaded grid is only used when constructing an inversion, because the blurred_image preload accounts for light profiles.

The preload is typically used in hyper searches, where the mass model is fixed and the hyper-parameters are varied.

Parameters: fit_0 – The first fit corresponding to a model with a specific set of unit-values. fit_1 – The second fit corresponding to a model with a different set of unit-values.
set_sparse_image_plane_grid_list_of_planes(fit_0, fit_1)

If the Pixelization’s in a model are fixed their image-plane sparse grid (which defines the set of pixels that are ray-traced to construct the source-plane pixelization) do not change during the model=fit and can therefore be preloaded.

This function compares the image plane sparse grid of two fit’s corresponding to two model instances, and p reloads the grid if the grids of both fits are the same.

The preload is typically used thoughout search chaining pipelines which use inversions, as it is common to for the pixelization’s parameters to only vary in the hyper-searches.

Parameters: fit_0 – The first fit corresponding to a model with a specific set of unit-values. fit_1 – The second fit corresponding to a model with a different set of unit-values.
reset_all()

Reset all preloads, typically done at the end of a model-fit to save memory.

info

The information on what has or has not been preloaded, which is written to the file preloads.summary.

Returns: A list of strings containing True and False values as to whether a quantity has been preloaded.