autolens.Galaxy#
- class Galaxy[source]#
Bases:
ModelObject
,OperateImageList
,OperateDeflections
Class representing a galaxy, which is composed of attributes used for fitting galaxies (e.g. light profiles, mass profiles, pixelizations, etc.).
All has_ methods retun True if galaxy has that attribute, False if not.
- Parameters
redshift (
float
) – The redshift of the galaxy.pixelization – The pixelization of the galaxy used to reconstruct an observed image using an inversion.
- adapt_model_image#
The best-fit model image to the observed image from a previous analysis search. This provides the total light attributed to each image pixel by the model.
- adapt_galaxy_image#
A model image of the galaxy (from light profiles or an inversion) from a previous analysis search.
Methods
area_within_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 galaxy which are an instance of the input cls.
Returns the summed 1D convergence of the galaxy's mass profiles using a grid of Cartesian (y,x) coordinates.
Returns the summed 2D convergence of the galaxy's mass profiles from a 2D grid of Cartesian (y,x) coordinates.
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):
Returns the summed 2D deflection angles of the galaxy's mass profiles from a 2D grid of Cartesian (y,x) coordinates.
A dictionary representation of this object
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 and its children profiles in the galaxy as a ValueIrregular or Grid2DIrregular object.
from_dict
Recursively parse a dictionary returning the model, collection or instance that is represents.
grid_radial_from
has
Does this instance have an attribute which is of type cls?
hessian_from
Returns the Hessian of the lensing object, where the Hessian is the second partial derivatives of the potential (see equation 55 https://www.tau.ac.il/~lab3/MICROLENSING/JeruLect.pdf):
Returns the summed 1D image of the galaxy's light profiles using a grid of Cartesian (y,x) coordinates.
Returns the summed 2D image of the galaxy's light profiles from a 2D grid of Cartesian (y,x) coordinates.
Returns a list of the 2D images of the galaxy's light profiles from a 2D grid of Cartesian (y,x) coordinates.
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).
Returns the total luminosity of the galaxy's light profiles within a circle of specified radius.
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):
Integrate the mass profiles's convergence profile to compute the total mass within a circle of specified radius.
next_id
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.
Returns the summed 1D potential of the galaxy's mass profiles using a grid of Cartesian (y,x) coordinates.
Returns the summed 2D potential of the galaxy's mass profiles from a 2D grid of Cartesian (y,x) coordinates.
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:
replacing_for_path
Create a new model replacing the value for a given path with a new value
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_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:
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
component_number
half_light_radius
identifier
label
profile_dict
- rtype
- cls_list_from(cls, cls_filtered=None)[source]#
Returns a list of objects in the galaxy which are an instance of the input cls.
The optional cls_filtered input removes classes of an input instance type.
For example:
If the input is cls=ag.LightProfile, a list containing all light profiles in the galaxy is returned.
If cls=ag.LightProfile and cls_filtered=ag.LightProfileLinear, a list of all light profiles excluding those which are linear light profiles will be returned.
- image_2d_from(grid, operated_only=None)[source]#
Returns the summed 2D image of the galaxy’s light profiles from a 2D grid of Cartesian (y,x) coordinates.
If the galaxy has no light profiles, a numpy array of zeros is returned.
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.
See the autogalaxy.profiles.light package for details of how images are computed from a light profile.
The decorator grid_2d_to_structure converts the output arrays from ndarrays to an Array2D data structure using the input grid’s attributes.
- 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
- image_2d_list_from(grid, operated_only=None)[source]#
Returns a list of the 2D images of the galaxy’s light profiles from a 2D grid of Cartesian (y,x) coordinates.
This function is primarily used in the autogalaxy.operate.image package, to output images of the Galaxy that have operations such as a 2D convolution or Fourier transform applied to them.
If the galaxy has no light profiles, a numpy array of zeros is returned.
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.
See the autogalaxy.profiles.light package for details of how images are computed from a light profile.
- 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 returnd list contains all light profile images (irrespective of whether they have been operated on or not). If this input is included as a bool, only images which are or are not already operated are included in the list, with the images of other light profiles created as a numpy array of zeros.
- Return type
- image_1d_from(grid)[source]#
Returns the summed 1D image of the galaxy’s light profiles using a grid of Cartesian (y,x) coordinates.
If the galaxy has no light profiles, a grid of zeros is returned.
See profiles.light module for details of how this is performed.
The decorator grid_1d_output_structure converts the output arrays from ndarrays to an Array1D data structure using the input grid’s attributes.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 1D (x,) coordinates where values of the image are evaluated.- Return type
ndarray
- deflections_yx_2d_from(grid)[source]#
Returns the summed 2D deflection angles of the galaxy’s mass profiles from a 2D grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a numpy array of zeros is returned.
See the autogalaxy.profiles.mass package for details of how deflection angles are computed from a mass profile.
The decorator grid_2d_to_vector_yx converts the output arrays from ndarrays to a VectorYX2D data structure using the input grid’s attributes.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 2D (y, x) coordinates where values of the deflection angles are evaluated.- Return type
ndarray
- convergence_2d_from(grid)[source]#
Returns the summed 2D convergence of the galaxy’s mass profiles from a 2D grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a numpy array of zeros is returned.
See the autogalaxy.profiles.mass package for details of how convergences are computed from a mass profile.
The decorator grid_2d_to_structure converts the output arrays from ndarrays to an Array2D data structure using the input grid’s attributes.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 2D (y, x) coordinates where values of the convergence are evaluated.- Return type
ndarray
- convergence_1d_from(grid)[source]#
Returns the summed 1D convergence of the galaxy’s mass profiles using a grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a grid of zeros is returned.
See profiles.mass module for details of how this is performed.
The decorator grid_1d_output_structure converts the output arrays from ndarrays to an Array1D data structure using the input grid’s attributes.
- Parameters
grid (
Union
[ndarray
,Grid1D
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 1D (x,) coordinates where values of the convergence are evaluated.- Return type
ndarray
- potential_2d_from(grid)[source]#
Returns the summed 2D potential of the galaxy’s mass profiles from a 2D grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a numpy array of zeros is returned.
See the autogalaxy.profiles.mass package for details of how potentials are computed from a mass profile.
The decorator grid_2d_to_structure converts the output arrays from ndarrays to an Array2D data structure using the input grid’s attributes.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 2D (y, x) coordinates where values of the potential are evaluated.- Return type
ndarray
- potential_1d_from(grid)[source]#
Returns the summed 1D potential of the galaxy’s mass profiles using a grid of Cartesian (y,x) coordinates.
If the galaxy has no mass profiles, a grid of zeros is returned.
See profiles.mass module for details of how this is performed.
The decorator grid_1d_output_structure converts the output arrays from ndarrays to an Array1D data structure using the input grid’s attributes.
- Parameters
grid (
Union
[ndarray
,Grid2D
,Grid2DIterate
,Grid2DIrregular
]) – The 1D (x,) coordinates where values of the potential are evaluated.- Return type
ndarray
- extract_attribute(cls, attr_name)[source]#
Returns an attribute of a class and its children profiles in the galaxy as a ValueIrregular or Grid2DIrregular object.
For example, if a galaxy has two light profiles and we want the LightProfile axis-ratios, the following:
galaxy.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 the MassProfile centres, the following:
galaxy.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 light profiles colored by their profile.
- luminosity_within_circle_from(radius)[source]#
Returns the total luminosity of the galaxy’s light profiles within a circle of specified radius.
See light_profile.luminosity_within_circle for details of how this is performed.
- Parameters
radius (
float
) – The radius of the circle to compute the dimensionless mass within.unit_luminosity – The unit_label the luminosity is returned in {esp, counts}.
exposure_time – The exposure time of the observation, which converts luminosity from electrons per second unit_label to counts.
- mass_angular_within_circle_from(radius)[source]#
Integrate the mass profiles’s convergence profile to compute the total mass within a circle of specified radius. This is centred on the mass profile.
The following unit_label for mass can be specified and output:
Dimensionless angular unit_label (default) - ‘angular’.
Solar masses - ‘angular’ (multiplies the angular mass by the critical surface mass density).
- Parameters
radius (dim.Length) – The radius of the circle to compute the dimensionless mass within.
unit_mass – The unit_label the mass is returned in {angular, angular}.
None (critical_surface_density or) – The critical surface mass density of the strong lens configuration, which converts mass from angulalr unit_label to phsical unit_label (e.g. solar masses).