autogalaxy.Plane#

class Plane[source]#

Bases: OperateImageGalaxies, OperateDeflections

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_curve_list_from

rtype:

List[float]

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.

cls_list_from

Returns a list of objects in the plane which are an instance of the input cls.

convergence_2d_from

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://inspirehep.net/literature/419263):

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://inspirehep.net/literature/419263):

deflections_yx_2d_from

rtype:

ndarray

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.

extract_attribute

Returns an attribute of a class in Plane as a ValueIrregular or Grid2DIrregular object.

extract_attributes_of_galaxies

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..

galaxies_with_cls_list_from

rtype:

List[Galaxy]

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.

galaxy_image_2d_dict_from

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:

bool

hessian_from

Returns the Hessian of the lensing object, where the Hessian is the second partial derivatives of the potential (see equation 55 https://inspirehep.net/literature/419263):

image_2d_from

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

rtype:

List[Array2D]

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://inspirehep.net/literature/419263):

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:

Array2D

potential_2d_from

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_area_list_from

Returns the surface area within each radial critical curve as a list, the calculation of which is described in the function radial_critical_curve_list_from().

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:

set_snr_of_snr_light_profiles

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://inspirehep.net/literature/419263):

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://inspirehep.net/literature/419263):

tangential_caustic_list_from

Returns all tangential caustics of the lensing system, which are computed as follows:

tangential_critical_curve_area_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().

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:

traced_grid_from

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

galaxy_redshifts

rtype:

List[float]

perform_inversion

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

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:

Array2D

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 adapt 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.

Parameters:
  • grid (Grid2D) – The grid (or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the potential is calculated on.

  • galaxies ([Galaxy]) – The galaxies whose mass profiles are used to compute the surface densities.

Return type:

ndarray

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.

Parameters:
  • grid (Grid2D) – The grid (or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the potential is calculated on.

  • galaxies ([Galaxy]) – The galaxies whose mass profiles are used to compute the surface densities.

Return type:

ndarray

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]

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.