autogalaxy.profiles.basis.Basis#
- class Basis[source]#
Bases:
LightProfile,MassProfileA basis is a collection of multiple light or mass profiles that are used to represent the light or mass distribution of a galaxy.
A basis is typically used to decompose a galaxy’s light or mass distribution into many profiles, each of which fit a small part of the overall light or mass distribution.
For example, a common basis uses of order 10-100 Gaussian light or mass profiles, where each Gaussian represents a small part of the overall light or mass distribution of a galaxy. By decomposing the light or mass distribution into many profiles, more detailed structures can be captured and fitted that ordinary profiles would struggle to capture.
This contrasts most standard light profiles (e.g. a Sersic) or mass profiles (e.g. an Isothermal) which represent the entire light or mass distribution of a galaxy.
- Parameters:
profile_list (
List[Union[LightProfile,MassProfile]]) – The light or mass profiles that make up the basis.regularization (
Optional[AbstractRegularization]) – The regularization scheme applied to the basis, which is used to regularize the solution to the linear inversion that fits the basis to the data.
Methods
angleThe position angle in degrees of the major-axis of the ellipse defined by profile, defined counter clockwise from the positive x-axis (0.0 > angle > 180.0).
angle_radiansThe position angle in radians of the major-axis of the ellipse defined by profile, defined counter clockwise from the positive x-axis (0.0 > angle > 2pi).
angle_to_profile_grid_fromThe angle between each angle theta on the grid and the profile, in radians.
axis_ratioThe ratio of the minor-axis to major-axis (b/a) of the ellipse defined by profile (0.0 > q > 1.0).
blurred_image_2d_fromEvaluate the light object's 2D image from a input 2D grid of coordinates and convolve it with a PSF.
Returns the summed convergence of all mass profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
convergence_funcReturns the convergence of the mass profile as a function of the radial coordinate.
deflections_2d_via_potential_2d_fromReturns the 2D deflection angles of the mass profile by numerically differentiating the lensing potential on the input grid.
Returns the summed deflections of all mass profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
density_between_circular_annuliCalculate the mass between two circular annuli and compute the density by dividing by the annuli surface area.
eccentric_radii_grid_fromConvert a grid of (y,x) coordinates to an eccentric radius: :math: axis_ratio^0.5 (x^2 + (y^2/q))^0.5
elliptical_radii_grid_fromConvert a grid of (y,x) coordinates to their elliptical radii values: :math: (x^2 + (y^2/q))^0.5
extract_attributeReturns an attribute of a class and its children profiles in the galaxy as a ValueIrregular or Grid2DIrregular object.
hasReturns True if any attribute of this profile is an instance of the input class cls, else False.
Returns the summed image of all light profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
Returns each image of each light profiles in the basis as a list, from a 2D grid of Cartesian (y,x) coordinates.
image_2d_via_radii_fromReturns the light profile's 2D image from a 1D grid of coordinates which are the radial distance of each coordinate from the light profile centre.
luminosity_integralRoutine to integrate the luminosity of an elliptical light profile.
luminosity_within_circle_fromIntegrate the light profile to compute the total luminosity within a circle of specified radius.
mass_angular_within_circle_fromIntegrate the mass profiles's convergence profile to compute the total mass within a circle of specified radius.
mass_integralIntegrand used by mass_angular_within_circle_from to compute the total projected mass within a circle.
padded_image_2d_fromEvaluate 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 potential of all mass profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
potential_funcReturns the integrand of the lensing potential at a single point, used in numerical integration schemes for computing the potential from the mass profile's convergence.
radial_deflection_fromradial_grid_fromConvert a grid of (y, x) coordinates, to their radial distances from the profile centre (e.g. :math: r = sqrt(x**2 + y**2)).
rotated_grid_from_reference_frame_fromRotate a grid of (y,x) coordinates which have been transformed to the elliptical reference frame of a profile back to the original unrotated coordinate grid reference frame.
transformed_from_reference_frame_grid_fromTransform a grid of (y,x) coordinates from the reference frame of the profile to the original observer reference frame.
transformed_to_reference_frame_grid_fromTransform a grid of (y,x) coordinates to the reference frame of the profile.
unmasked_blurred_image_2d_fromEvaluate 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.
visibilities_fromEvaluate 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.
vmapped_deflections_fromAttributes
average_convergence_of_1_radiusThe radius a critical curve forms for this mass profile, e.g. where the mean convergence is equal to 1.0.
coefficient_tagA short string tag used to label the intensity coefficient when this profile is used inside a Basis object (e.g. for multi-Gaussian expansion or shapelet decomposition).
ellipticity_rescaleA rescaling factor applied to account for the ellipticity of the mass profile when computing the Einstein radius from the average convergence equals unity criterion.
half_light_radiusThe radius that contains half of the total light of the profile (the half-light radius).
Returns a list of all light profiles in the Basis object.
Returns a list of all mass profiles in the Basis object.
- property light_profile_list: List[LightProfile]#
Returns a list of all light profiles in the Basis object.
This is used for computing light profile quantities of each individual light profile in the Basis object and then summing them to get the overall quantity (e.g. the image, surface brightness, etc.).
- Return type:
The list of light profiles in the Basis object.
- property mass_profile_list: List[MassProfile]#
Returns a list of all mass profiles in the Basis object.
This is used for computing mass profile quantities of each individual mass profile in the Basis object and then summing them to get the overall quantity (e.g. the convergence, potential, etc.).
- Return type:
The list of mass profiles in the Basis object.
- image_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, operated_only=None, **kwargs)[source]#
Returns the summed image of all light profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
Normal steps in the calculation of an image, like shifting the input grid to the profile’s centre, rotating it to its position angle, and checking if its already operated on are all handled internally by each profiles image_2d_from method when it is called.
- Parameters:
grid (
Union[ndarray,Grid2D,Grid2DIrregular]) – The 2D (y, x) coordinates in the original reference frame of the grid.operated_only (
Optional[bool]) – By default, the returned 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:
The image of the light profiles in the basis summed together.
- image_2d_list_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, operated_only=None)[source]#
Returns each image of each light profiles in the basis as a list, from a 2D grid of Cartesian (y,x) coordinates.
Normal steps in the calculation of an image, like shifting the input grid to the profile’s centre, rotating it to its position angle, and checking if its already operated on are all handled internally by each profiles image_2d_from method when it is called.
- Parameters:
grid (
Union[ndarray,Grid2D,Grid2DIrregular]) – The 2D (y, x) coordinates in the original reference frame of the grid.operated_only (
Optional[bool]) – By default, the returned 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:
The image of the light profiles in the basis summed together.
- convergence_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#
Returns the summed convergence of all mass profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
Normal steps in the calculation of a convergence, like shifting the input grid to the profile’s centre and rotating it to its position angle are all handled internally by each profile’s convergence_2d_from method when it is called.
- Parameters:
grid (
Union[ndarray,Grid2D,Grid2DIrregular]) – The 2D (y, x) coordinates in the original reference frame of the grid.- Return type:
The convergence of the mass profiles in the basis summed together.
- potential_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#
Returns the summed potential of all mass profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
Normal steps in the calculation of a potential, like shifting the input grid to the profile’s centre and rotating it to its position angle are all handled internally by each profile’s potential_2d_from method when it is called.
- Parameters:
grid (
Union[ndarray,Grid2D,Grid2DIrregular]) – The 2D (y, x) coordinates in the original reference frame of the grid.- Return type:
The potential of the mass profiles in the basis summed together.
- deflections_yx_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, **kwargs)[source]#
Returns the summed deflections of all mass profiles in the basis from a 2D grid of Cartesian (y,x) coordinates.
Normal steps in the calculation of a deflections, like shifting the input grid to the profile’s centre and rotating it to its position angle are all handled internally by each profile’s deflections_2d_from method when it is called.
- Parameters:
grid (
Union[ndarray,Grid2D,Grid2DIrregular]) – The 2D (y, x) coordinates in the original reference frame of the grid.- Return type:
The deflections of the mass profiles in the basis summed together.