autolens.Plane#
- class Plane[source]#
Bases:
OperateImageGalaxies
,OperateDeflections
,Dictable
A plane of galaxies where all galaxies are at the same redshift.
- Parameters
None (redshift or) – The redshift of the plane.
galaxies ([Galaxy]) – The list of galaxies in this plane.
Methods
area_within_tangential_critical_curve_list_from
Returns the surface area within each tangential critical curve as a list, the calculation of which is described in the function tangential_critical_curve_list_from().
blurred_image_2d_from
Evaluate the light object's 2D image from a input 2D grid of coordinates and convolve it with a PSF.
blurred_image_2d_list_from
Evaluate the light object's list of 2D images from a input 2D grid of coordinates and convolve each image with a PSF.
Returns a list of objects in the plane which are an instance of the input cls.
Returns the convergence of the list of galaxies of the plane's sub-grid, by summing the individual convergences of each galaxy's mass profile.
convergence_2d_via_hessian_from
Returns the convergence of the lensing object, which is computed from the 2D deflection angle map via the Hessian using the expression (see equation 56 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
convergence_2d_via_jacobian_from
Returns the convergence of the lensing object, which is computed from the 2D deflection angle map via the Jacobian using the expression (see equation 58 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
deflections_yx_2d_from
- rtype
ndarray
A dictionary representation of the instance comprising a type field which contains the entire class path by which the type can be imported and constructor arguments.
einstein_mass_angular_from
Returns the Einstein radius corresponding to the area within the tangential critical curve.
einstein_mass_angular_list_from
Returns a list of the angular Einstein massses corresponding to the area within each tangential critical curve.
einstein_radius_from
Returns the Einstein radius corresponding to the area within the tangential critical curve.
einstein_radius_list_from
Returns a list of the Einstein radii corresponding to the area within each tangential critical curve.
Returns an attribute of a class in Plane as a ValueIrregular or Grid2DIrregular object.
Returns an attribute of a class in the plane as a list of ValueIrregular or Grid2DIrregular objects, where the list indexes correspond to each galaxy in the plane..
from_dict
Instantiate an instance of a class from its dictionary representation.
from_json
Load the dictable object to a .json file, whereby all attributes are converted from the .json file's dictionary representation to create the instance of the object
galaxies_with_cls_list_from
galaxy_blurred_image_2d_dict_from
Evaluate the light object's dictionary mapping galaixes to their corresponding 2D images and convolve each image with a PSF.
Returns a dictionary associating every Galaxy object in the Plane with its corresponding 2D image, using the instance of each galaxy as the dictionary keys.
galaxy_visibilities_dict_from
Evaluate the light object's dictionary mapping galaixes to their corresponding 2D images and transform each image to arrays of visibilities using a autoarray.operators.transformer.Transformer object and therefore a Fourier Transform.
has
- rtype
hessian_from
Returns the Hessian of the lensing object, where the Hessian is the second partial derivatives of the the potential (see equation 55 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
hyper_noise_map_from
- rtype
For a contribution map and noise-map, use the model hyper_galaxy galaxies to compute a hyper noise-map.
Returns the profile-image plane image of the list of galaxies of the plane's sub-grid, by summing the individual images of each galaxy's light profile.
image_2d_list_from
jacobian_from
Returns the Jacobian of the lensing object, which is computed by taking the gradient of the 2D deflection angle map in four direction (positive y, negative y, positive x, negative x).
magnification_2d_from
Returns the 2D magnification map of lensing object, which is computed as the inverse of the determinant of the jacobian.
magnification_2d_via_hessian_from
Returns the 2D magnification map of lensing object, which is computed from the 2D deflection angle map via the Hessian using the expressions (see equation 60 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
Output the dictable object to a .json file, whereby all attributes are converted to a dictionary representation first.
padded_image_2d_from
Evaluate the light object's 2D image from a input 2D grid of padded coordinates, where this padding is sufficient to encapsulate all surrounding pixels that will blur light into the original image given the 2D shape of the PSF's kernel.
plane_image_2d_from
- rtype
PlaneImage
Returns the potential of the list of galaxies of the plane's sub-grid, by summing the individual potentials of each galaxy's mass profile.
radial_caustic_list_from
Returns all radial caustics of the lensing system, which are computed as follows:
radial_critical_curve_list_from
Returns all radial critical curves of the lensing system, which are computed as follows:
radial_eigen_value_from
Returns the radial eigen values of lensing jacobian, which are given by the expression:
Iterate over every LightProfileSNR in the plane and set their intensity values to values which give their input signal_to_noise_ratio value, which is performed as follows:
shear_yx_2d_via_hessian_from
Returns the 2D (y,x) shear vectors of the lensing object, which are computed from the 2D deflection angle map via the Hessian using the expressions (see equation 57 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
shear_yx_2d_via_jacobian_from
Returns the 2D (y,x) shear vectors of the lensing object, which are computed from the 2D deflection angle map via the Jacobian using the expression (see equation 58 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
tangential_caustic_list_from
Returns all tangential caustics of the lensing system, which are computed as follows:
tangential_critical_curve_list_from
Returns all tangential critical curves of the lensing system, which are computed as follows:
tangential_eigen_value_from
Returns the tangential eigen values of lensing jacobian, which are given by the expression:
Trace this plane's grid_stacks to the next plane, using its deflection angles.
unmasked_blurred_image_2d_from
Evaluate the light object's 2D image from a input 2D grid of coordinates and convolve it with a PSF, using a grid which is not masked.
unmasked_blurred_image_2d_list_from
Evaluate the light object's list of 2D images from a input 2D grid of coordinates and convolve it with a PSF, using a grid which is not masked.
visibilities_from
Evaluate the light object's 2D image from a input 2D grid of coordinates and transform this to an array of visibilities using a autoarray.operators.transformer.Transformer object and therefore a Fourier Transform.
visibilities_list_from
Evaluate the light object's list of 2D image from a input 2D grid of coordinates and transform each image to arrays of visibilities using a autoarray.operators.transformer.Transformer object and therefore a Fourier Transform.
Attributes
contribution_map
contribution_map_list
galaxy_redshifts
hyper_galaxies_with_pixelization_image_list
Returns a bool specifying whether this fit object performs an inversion.
- dict()[source]#
A dictionary representation of the instance comprising a type field which contains the entire class path by which the type can be imported and constructor arguments.
- Return type
- output_to_json(file_path)[source]#
Output the dictable object to a .json file, whereby all attributes are converted to a dictionary representation first.
An instane of the object can be created from the .json file via the from_json method.
- Parameters
file_path (
str
) – The path to the .json file that the dictionary representation of the object is written too.
- cls_list_from(cls)[source]#
Returns a list of objects in the plane which are an instance of the input cls.
For example:
If the input is cls=ag.LightProfile, a list containing all light profiles in the plane is returned.
- Return type
The list of objects in the plane that inherit from input cls.
- image_2d_from(grid, operated_only=None)[source]#
Returns the profile-image plane image of the list of galaxies of the plane’s sub-grid, by summing the individual images of each galaxy’s light profile.
If the operated_only input is included, the function omits light profiles which are parents of the LightProfileOperated object, which signifies that the light profile represents emission that has already had the instrument operations (e.g. PSF convolution, a Fourier transform) applied to it.
If the plane has no galaxies (or no galaxies have mass profiles) an arrays of all zeros the shape of the plane’s sub-grid is returned.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 2D (y, x) coordinates where values of the image are evaluated.operated_only (
Optional
[bool
]) – By default, the image is the sum of light profile images (irrespective of whether they have been operatd on or not). If this input is included as a bool, only images which are or are not already operated are summed and returned.
- Return type
- galaxy_image_2d_dict_from(grid, operated_only=None)[source]#
Returns a dictionary associating every Galaxy object in the Plane with its corresponding 2D image, using the instance of each galaxy as the dictionary keys.
This object is used for hyper-features, which use the image of each galaxy in a model-fit in order to adapt quantities like a pixelization or regularization scheme to the surface brightness of the galaxies being fitted.
By inheriting from OperateImageGalaxies functions which apply operations of this dictionary are accessible, for example convolving every image with a PSF or applying a Fourier transform to create a galaxy-visibilities dictionary.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 2D (y,x) coordinates of the (masked) grid, in its original geometric reference frame.- Return type
A dictionary associated every galaxy in the plane with its corresponding 2D image.
- convergence_2d_from(grid)[source]#
Returns the convergence of the list of galaxies of the plane’s sub-grid, by summing the individual convergences of each galaxy’s mass profile.
The convergence is calculated on the sub-grid and binned-up to the original grid by taking the mean value of every set of sub-pixels, provided the returned_binned_sub_grid bool is True.
If the plane has no galaxies (or no galaxies have mass profiles) an arrays of all zeros the shape of the plane’s sub-grid is returned.
Internally data structures are treated as ndarrays, however the decorator grid_2d_to_structure converts the output to an Array2D using the input grid’s attributes.
- potential_2d_from(grid)[source]#
Returns the potential of the list of galaxies of the plane’s sub-grid, by summing the individual potentials of each galaxy’s mass profile.
The potential is calculated on the sub-grid and binned-up to the original grid by taking the mean value of every set of sub-pixels, provided the returned_binned_sub_grid bool is True.
If the plane has no galaxies (or no galaxies have mass profiles) an arrays of all zeros the shape of the plane’s sub-grid is returned.
Internally data structures are treated as ndarrays, however the decorator grid_2d_to_structure converts the output to an Array2D using the input grid’s attributes.
- traced_grid_from(grid)[source]#
Trace this plane’s grid_stacks to the next plane, using its deflection angles.
- Return type
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]
- hyper_noise_map_list_from(noise_map)[source]#
For a contribution map and noise-map, use the model hyper_galaxy galaxies to compute a hyper noise-map.
- property perform_inversion: bool#
Returns a bool specifying whether this fit object performs an inversion.
This is based on whether any of the galaxies in the model_obj have a Pixelization or LightProfileLinear object, in which case an inversion is performed.
- Return type
A bool which is True if an inversion is performed.
- extract_attribute(cls, attr_name)[source]#
Returns an attribute of a class in Plane as a ValueIrregular or Grid2DIrregular object.
For example, if a plane has a galaxy which two light profiles and we want its axis-ratios, the following:
plane.extract_attribute(cls=LightProfile, name=”axis_ratio”)
would return:
ArrayIrregular(values=[axis_ratio_0, axis_ratio_1])
If a galaxy has three mass profiles and we want their centres, the following:
plane.extract_attribute(cls=MassProfile, name=”centres”)
would return:
GridIrregular2D(grid=[(centre_y_0, centre_x_0), (centre_y_1, centre_x_1), (centre_y_2, centre_x_2)])
This is used for visualization, for example plotting the centres of all mass profiles colored by their profile.
- extract_attributes_of_galaxies(cls, attr_name, filter_nones=False)[source]#
Returns an attribute of a class in the plane as a list of ValueIrregular or Grid2DIrregular objects, where the list indexes correspond to each galaxy in the plane..
For example, if a plane has two galaxies which each have a light profile the following:
plane.extract_attributes_of_galaxies(cls=LightProfile, name=”axis_ratio”)
would return:
[ArrayIrregular(values=[axis_ratio_0]), ArrayIrregular(values=[axis_ratio_1])]
If a plane has two galaxies, the first with a mass profile and the second with two mass profiles ,the following:
plane.extract_attributes_of_galaxies(cls=MassProfile, name=”centres”)
would return: [
Grid2DIrregular(values=[(centre_y_0, centre_x_0)]), Grid2DIrregular(values=[(centre_y_0, centre_x_0), (centre_y_1, centre_x_1)])
]
If a Profile does not have a certain entry, it is replaced with a None. Nones can be removed by setting filter_nones=True.
This is used for visualization, for example plotting the centres of all mass profiles colored by their profile.
- set_snr_of_snr_light_profiles(grid, exposure_time, background_sky_level=0.0, psf=None)[source]#
Iterate over every LightProfileSNR in the plane and set their intensity values to values which give their input signal_to_noise_ratio value, which is performed as follows:
Evaluate the image of each light profile on the input grid.
Blur this image with a PSF, if included.
Take the value of the brightest pixel.
Use an input exposure_time and background_sky (e.g. from the SimulatorImaging object) to determine what value of intensity gives the desired signal to noise ratio for the image.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The (y, x) coordinates in the original reference frame of the grid.exposure_time (
float
) – The exposure time of the simulated imaging.background_sky_level (
float
) – The level of the background sky of the simulated imaging.psf (
Optional
[Kernel2D
]) – The psf of the simulated imaging which can change the S/N of the light profile due to spreading out the emission.