# autogalaxy.profiles.geometry_profiles.EllProfile#

class EllProfile[source]#

Bases: SphProfile

An elliptical profile, which describes the geometry of profiles defined by an ellipse.

The elliptical components (ell_comps) of this profile are used to define the axis_ratio (q) and angle (phi) :

Math:

phi = (180/pi) * arctan2(e_y / e_x) / 2

Math:

f = sqrt(e_y^2 + e_x^2)

Math:

q = (1 - f) / (1 + f)

Where:

e_y = y elliptical component = ell_comps[0] e_x = x elliptical component = ell_comps[1] q = axis_ratio (major_axis / minor_axis)

This means that given an axis-ratio and angle the elliptical components can be computed as:

Math:

f = (1 - q) / (1 + q)

Math:

e_y = f * sin(2*phi)

Math:

e_x = f * cos(2*phi)

For an input (y,x) grid of Cartesian coordinates this is used to compute the elliptical coordinates of a profile:

$\xi = q^{0.5} * ((y-y_c^2 + x-x_c^2 / q^2)^{0.5}$

Where:

y_c = profile y centre = centre[0] x_c = profile x centre = centre[1]

The majority of elliptical profiles use xi to compute their image.

Parameters:

Methods

 angle_to_profile_grid_from The angle between each angle theta on the grid and the profile, in radians. eccentric_radii_grid_from Convert 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_from Convert a grid of (y,x) coordinates to their elliptical radii values: :math: (x^2 + (y^2/q))^0.5 has Does this instance have an attribute which is of type cls? radial_grid_from Convert a grid of (y, x) coordinates, to their radial distances from the profile centre (e.g. rotated_grid_from_reference_frame_from Rotate 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_from Transform a grid of (y,x) coordinates from the reference frame of the profile to the original observer reference frame. transformed_to_reference_frame_grid_from Transform a grid of (y,x) coordinates to the reference frame of the profile.

Attributes

 angle The 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_radians The 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). axis_ratio The ratio of the minor-axis to major-axis (b/a) of the ellipse defined by profile (0.0 > q > 1.0).
property axis_ratio: float#

The ratio of the minor-axis to major-axis (b/a) of the ellipse defined by profile (0.0 > q > 1.0).

Return type:

float

property angle: float#

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

Return type:

float

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

Return type:

float

angle_to_profile_grid_from(grid_angles)[source]#

The angle between each angle theta on the grid and the profile, in radians.

Parameters:

grid_angles – The angle theta counter-clockwise from the positive x-axis to each coordinate in radians.

rotated_grid_from_reference_frame_from(grid, angle=None)[source]#

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

Note that unlike the method transformed_from_reference_frame_grid_from the coordinates are not translated back to the profile’s original centre.

This routine is used after computing deflection angles in the reference frame of the profile, so that the deflection angles can be re-rotated to the frame of the original coordinates before performing ray-tracing.

Parameters:
• grid – The (y, x) coordinates in the reference frame of an elliptical profile.

• angle (Optional[float]) – Manually input an angle which is used instead of the profile’s angle attribute. This is used in certain circumstances where the angle applied is different to the profile’s angle attribute, for example weak lensing rotations which are typically twice that profile’s angle attribute.

Convert a grid of (y,x) coordinates to their elliptical radii values: :math: (x^2 + (y^2/q))^0.5

If the coordinates have not been transformed to the profile’s geometry (e.g. translated to the profile centre), this is performed automatically.

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIterate, Grid2DIrregular]) – The (y, x) coordinates in the reference frame of the elliptical profile.

Return type:

ndarray

Convert a grid of (y,x) coordinates to an eccentric radius: :math: axis_ratio^0.5 (x^2 + (y^2/q))^0.5

This is used in certain light profiles define their half-light radii as a circular radius.

If the coordinates have not been transformed to the profile’s geometry (e.g. translated to the profile centre), this is performed automatically.

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIterate, Grid2DIrregular]) – The (y, x) coordinates in the reference frame of the elliptical profile.

Return type:

ndarray

transformed_to_reference_frame_grid_from(grid)[source]#

Transform a grid of (y,x) coordinates to the reference frame of the profile.

This includes a translation to the profile’s centre and a rotation using its angle.

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIterate, Grid2DIrregular]) – The (y, x) coordinates in the original reference frame of the grid.

Return type:

Grid2DTransformedNumpy

transformed_from_reference_frame_grid_from(grid)[source]#

Transform a grid of (y,x) coordinates from the reference frame of the profile to the original observer reference frame.

This includes a translation from the profile’s centre and a rotation using its angle.

Parameters:

grid (Union[ndarray, Grid2D, Grid2DIterate, Grid2DIrregular]) – The (y, x) coordinates in the reference frame of the profile.

Return type:

Union[ndarray, Grid2D, Grid2DIterate, Grid2DIrregular]