eta = np.multiply(<NUM_LIT:1.> / self.scale_radius, self.grid_to_grid_radii(grid=grid))<EOL>deflection_r = np.multiply(<NUM_LIT> * self.kappa_s * self.scale_radius, self.deflection_func_sph(eta))<EOL>return self.grid_to_grid_cartesian(grid, deflection_r)<EOL>

Calculate the deflection angles at a given set of arc-second gridded coordinates.

Parameters
----------
grid : grids.RegularGrid
    The grid of (y,x) arc-second coordinates the deflection angles are computed on.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>einstein_radius: dim.Length = <NUM_LIT:1.0>,<EOL>slope: float = <NUM_LIT>,<EOL>core_radius: dim.Length = <NUM_LIT>):<DEDENT>

super(SphericalCoredPowerLaw, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>,<EOL>einstein_radius=einstein_radius, slope=slope,<EOL>core_radius=core_radius)<EOL>

Represents a cored spherical power-law density distribution

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
einstein_radius : float
    The arc-second Einstein radius.
slope : float
    The density slope of the power-law (lower value -> shallower profile, higher value -> steeper profile).
core_radius : float
    The arc-second radius of the inner core.


return self.convergence_func(self.grid_to_eccentric_radii(grid))<EOL>

Calculate the projected convergence at a given set of arc-second gridded coordinates.

        Parameters
        ----------
        grid : grids.RegularGrid
            The grid of (y,x) arc-second coordinates the surface density is computed on.


factor = <NUM_LIT> * self.einstein_radius_rescaled * self.axis_ratio / np.sqrt(<NUM_LIT:1> - self.axis_ratio ** <NUM_LIT:2>)<EOL>psi = np.sqrt(np.add(np.multiply(self.axis_ratio ** <NUM_LIT:2>, np.square(grid[:, <NUM_LIT:1>])), np.square(grid[:, <NUM_LIT:0>])))<EOL>deflection_y = np.arctanh(np.divide(np.multiply(np.sqrt(<NUM_LIT:1> - self.axis_ratio ** <NUM_LIT:2>), grid[:, <NUM_LIT:0>]), psi))<EOL>deflection_x = np.arctan(np.divide(np.multiply(np.sqrt(<NUM_LIT:1> - self.axis_ratio ** <NUM_LIT:2>), grid[:, <NUM_LIT:1>]), psi))<EOL>return self.rotate_grid_from_profile(np.multiply(factor, np.vstack((deflection_y, deflection_x)).T))<EOL>

Calculate the deflection angles at a given set of arc-second gridded coordinates.

For coordinates (0.0, 0.0) the analytic calculation of the deflection angle gives a NaN. Therefore, \
coordinates at (0.0, 0.0) are shifted slightly to (1.0e-8, 1.0e-8).

Parameters
----------
grid : grids.RegularGrid
    The grid of (y,x) arc-second coordinates the deflection angles are computed on.


return self.intensity * np.exp(<EOL>-self.sersic_constant * (((radius / self.effective_radius) ** (<NUM_LIT:1.> / self.sersic_index)) - <NUM_LIT:1>))<EOL>

Compute the intensity of the profile at a given radius.

        Parameters
        ----------
        radius : float
            The distance from the centre of the profile.


@jit_integrand<EOL>def deflection_integrand(x, kappa_radius, scale_radius, inner_slope):<EOL><INDENT>return (x + kappa_radius / scale_radius) ** (inner_slope - <NUM_LIT:3>) * ((<NUM_LIT:1> - np.sqrt(<NUM_LIT:1> - x ** <NUM_LIT:2>)) / x)<EOL><DEDENT>eta_min, eta_max, minimum_log_eta, maximum_log_eta, bin_size = self.tabulate_integral(grid, tabulate_bins)<EOL>potential_grid = np.zeros(grid.shape[<NUM_LIT:0>])<EOL>deflection_integral = np.zeros((tabulate_bins,))<EOL>for i in range(tabulate_bins):<EOL><INDENT>eta = <NUM_LIT> ** (minimum_log_eta + (i - <NUM_LIT:1>) * bin_size)<EOL>integral =quad(deflection_integrand, a=<NUM_LIT:0.0>, b=<NUM_LIT:1.0>, args=(eta, self.scale_radius, self.inner_slope),<EOL>epsrel=EllipticalGeneralizedNFW.epsrel)[<NUM_LIT:0>]<EOL>deflection_integral[i] = ((eta / self.scale_radius) ** (<NUM_LIT:2> - self.inner_slope)) * (<EOL>(<NUM_LIT:1.0> / (<NUM_LIT:3> - self.inner_slope)) *<EOL>special.hyp2f1(<NUM_LIT:3> - self.inner_slope, <NUM_LIT:3> - self.inner_slope, <NUM_LIT:4> - self.inner_slope,<EOL>- (eta / self.scale_radius)) + integral)<EOL><DEDENT>for i in range(grid.shape[<NUM_LIT:0>]):<EOL><INDENT>potential_grid[i] = (<NUM_LIT> * self.kappa_s * self.axis_ratio) *quad(self.potential_func, a=<NUM_LIT:0.0>, b=<NUM_LIT:1.0>, args=(grid[i, <NUM_LIT:0>], grid[i, <NUM_LIT:1>],<EOL>self.axis_ratio, minimum_log_eta,<EOL>maximum_log_eta, tabulate_bins,<EOL>deflection_integral),<EOL>epsrel=EllipticalGeneralizedNFW.epsrel)[<NUM_LIT:0>]<EOL><DEDENT>return potential_grid<EOL>

Calculate the potential at a given set of arc-second gridded coordinates.

Parameters
----------
grid : grids.RegularGrid
    The grid of (y,x) arc-second coordinates the deflection angles are computed on.
tabulate_bins : int
    The number of bins to tabulate the inner integral of this profile.


@map_types<EOL><INDENT>def __init__(self,<EOL>magnitude: float = <NUM_LIT>,<EOL>phi: float = <NUM_LIT:0.0>):<DEDENT>

super(ExternalShear, self).__init__(centre=(<NUM_LIT:0.0>, <NUM_LIT:0.0>), phi=phi, axis_ratio=<NUM_LIT:1.0>)<EOL>self.magnitude = magnitude<EOL>

An external shear term, to model the line-of-sight contribution of other galaxies / satellites.

Parameters
----------
magnitude : float
    The overall magnitude of the shear (gamma).
phi : float
    The rotation axis of the shear.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>einstein_radius: dim.Length = <NUM_LIT:1.0>):<DEDENT>

super(EllipticalIsothermal, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi,<EOL>einstein_radius=einstein_radius, slope=<NUM_LIT>)<EOL>

Represents an elliptical isothermal density distribution, which is equivalent to the elliptical power-law
density distribution for the value slope: float = 2.0

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
axis_ratio : float
    The elliptical mass profile's minor-to-major axis ratio (b/a).
phi : float
    Rotation angle of mass profile's ellipse counter-clockwise from positive x-axis.
einstein_radius : float
    The arc-second Einstein radius.


eta = (<NUM_LIT:1.0> / self.scale_radius) * self.grid_to_grid_radii(grid) + <NUM_LIT><EOL>return np.real(<NUM_LIT> * self.scale_radius * self.kappa_s * self.potential_func_sph(eta))<EOL>

Calculate the potential at a given set of arc-second gridded coordinates.

Parameters
----------
grid : grids.RegularGrid
    The grid of (y,x) arc-second coordinates the deflection angles are computed on.


def calculate_deflection_component(npow, index):<EOL><INDENT>einstein_radius_rescaled = self.einstein_radius_rescaled<EOL>deflection_grid = self.axis_ratio * grid[:, index]<EOL>deflection_grid *= quad_grid(self.deflection_func, <NUM_LIT:0.0>, <NUM_LIT:1.0>,<EOL>grid, args=(npow, self.axis_ratio,<EOL>einstein_radius_rescaled, self.slope,<EOL>self.core_radius))[<NUM_LIT:0>]<EOL>return deflection_grid<EOL><DEDENT>deflection_y = calculate_deflection_component(<NUM_LIT:1.0>, <NUM_LIT:0>)<EOL>deflection_x = calculate_deflection_component(<NUM_LIT:0.0>, <NUM_LIT:1>)<EOL>return self.rotate_grid_from_profile(np.multiply(<NUM_LIT:1.0>, np.vstack((deflection_y, deflection_x)).T))<EOL>


potential_grid = quad_grid(self.potential_func, <NUM_LIT:0.0>, <NUM_LIT:1.0>, grid,<EOL>args=(self.axis_ratio, self.kappa_s, self.scale_radius),<EOL>epsrel=<NUM_LIT>)[<NUM_LIT:0>]<EOL>return potential_grid<EOL>


deflection_y = -np.multiply(self.magnitude, grid[:, <NUM_LIT:0>])<EOL>deflection_x = np.multiply(self.magnitude, grid[:, <NUM_LIT:1>])<EOL>return self.rotate_grid_from_profile(np.vstack((deflection_y, deflection_x)).T)<EOL>


eta = np.multiply(<NUM_LIT:1.> / self.scale_radius, self.grid_to_grid_radii(grid))<EOL>deflection_grid = np.multiply((<NUM_LIT> * self.kappa_s * self.scale_radius / eta), self.deflection_func_sph(eta))<EOL>return self.grid_to_grid_cartesian(grid, deflection_grid)<EOL>


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>,<EOL>sersic_index: float = <NUM_LIT>,<EOL>mass_to_light_ratio: dim.MassOverLuminosity = <NUM_LIT:1.0>):<DEDENT>

super(AbstractEllipticalSersic, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>super(EllipticalMassProfile, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>self.mass_to_light_ratio = mass_to_light_ratio<EOL>self.intensity = intensity<EOL>self.effective_radius = effective_radius<EOL>self.sersic_index = sersic_index<EOL>

The Sersic mass profile, the mass profiles of the light profiles that are used to fit and subtract the lens \
model_galaxy's light.

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
axis_ratio : float
    Ratio of profiles ellipse's minor and major axes (b/a).
phi : float
    Rotational angle of profiles ellipse counter-clockwise from positive x-axis.
intensity : float
    Overall flux intensity normalisation in the light profiles (electrons per second).
effective_radius : float
    The radius containing half the light of this profile.
sersic_index : float
    Controls the concentration of the of the profile (lower value -> less concentrated, \
    higher value -> more concentrated).
mass_to_light_ratio : float
    The mass-to-light ratio of the light profiles


def average_convergence_of_1_radius_in_units(self, unit_length='<STR_LIT>', kpc_per_arcsec=None):

def func(radius):<EOL><INDENT>radius = dim.Length(radius, unit_length=unit_length)<EOL>return self.mass_within_circle_in_units(radius=radius) - np.pi * radius ** <NUM_LIT><EOL><DEDENT>radius = self.ellipticity_rescale * root_scalar(func, bracket=[<NUM_LIT>, <NUM_LIT>]).root<EOL>radius = dim.Length(radius, unit_length)<EOL>return radius.convert(unit_length=unit_length, kpc_per_arcsec=kpc_per_arcsec)<EOL>

The radius a critical curve forms for this mass profile, e.g. where the mean convergence is equal to 1.0.

         In case of ellipitical mass profiles, the 'average' critical curve is used, whereby the convergence is \
         rescaled into a circle using the axis ratio.

         This radius corresponds to the Einstein radius of the mass profile, and is a property of a number of \
         mass profiles below.


return ((<NUM_LIT:3> - self.slope) / (<NUM_LIT:1> + self.axis_ratio)) * self.einstein_radius ** (self.slope - <NUM_LIT:1>)<EOL>

Rescale the einstein radius by slope and axis_ratio, to reduce its degeneracy with other mass-profiles
        parameters


eta = self.grid_to_grid_radii(grid=grid)<EOL>deflection = np.multiply(<NUM_LIT> * self.einstein_radius_rescaled, np.divide(<EOL>np.add(np.power(np.add(self.core_radius ** <NUM_LIT:2>, np.square(eta)), (<NUM_LIT> - self.slope) / <NUM_LIT>),<EOL>-self.core_radius ** (<NUM_LIT:3> - self.slope)), np.multiply((<NUM_LIT> - self.slope), eta)))<EOL>return self.grid_to_grid_cartesian(grid=grid, radius=deflection)<EOL>


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>einstein_radius: dim.Length = <NUM_LIT:1.0>,<EOL>slope: float = <NUM_LIT>,<EOL>core_radius: dim.Length = <NUM_LIT>):<DEDENT>

super(EllipticalCoredPowerLaw, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>self.einstein_radius = einstein_radius<EOL>self.slope = slope<EOL>self.core_radius = core_radius<EOL>

Represents a cored elliptical power-law density distribution

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
axis_ratio : float
    The elliptical mass profile's minor-to-major axis ratio (b/a).
phi : float
    Rotation angle of mass profile's ellipse counter-clockwise from positive x-axis.
einstein_radius : float
    The arc-second Einstein radius.
slope : float
    The density slope of the power-law (lower value -> shallower profile, higher value -> steeper profile).
core_radius : float
    The arc-second radius of the inner core.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>,<EOL>sersic_index: float = <NUM_LIT>,<EOL>mass_to_light_ratio: dim.MassOverLuminosity = <NUM_LIT:1.0>,<EOL>mass_to_light_gradient: float = <NUM_LIT:0.0>):<DEDENT>

super(EllipticalSersicRadialGradient, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi,<EOL>intensity=intensity, effective_radius=effective_radius,<EOL>sersic_index=sersic_index,<EOL>mass_to_light_ratio=mass_to_light_ratio)<EOL>self.mass_to_light_gradient = mass_to_light_gradient<EOL>

Setup a Sersic mass and light profiles.

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
axis_ratio : float
    Ratio of profiles ellipse's minor and major axes (b/a).
phi : float
    Rotational angle of profiles ellipse counter-clockwise from positive x-axis.
intensity : float
    Overall flux intensity normalisation in the light profiles (electrons per second).
effective_radius : float
    The circular radius containing half the light of this profile.
sersic_index : float
    Controls the concentration of the of the profile (lower value -> less concentrated, \
    higher value -> more concentrated).
mass_to_light_ratio : float
    The mass-to-light ratio of the light profile.
mass_to_light_gradient : float
    The mass-to-light radial gradient.


def calculate_deflection_component(npow, index):<EOL><INDENT>sersic_constant = self.sersic_constant<EOL>deflection_grid = self.axis_ratio * grid[:, index]<EOL>deflection_grid *= quad_grid(self.deflection_func, <NUM_LIT:0.0>, <NUM_LIT:1.0>, grid,<EOL>args=(npow, self.axis_ratio, self.intensity,<EOL>self.sersic_index, self.effective_radius,<EOL>self.mass_to_light_ratio, sersic_constant))[<NUM_LIT:0>]<EOL>return deflection_grid<EOL><DEDENT>deflection_y = calculate_deflection_component(<NUM_LIT:1.0>, <NUM_LIT:0>)<EOL>deflection_x = calculate_deflection_component(<NUM_LIT:0.0>, <NUM_LIT:1>)<EOL>return self.rotate_grid_from_profile(np.multiply(<NUM_LIT:1.0>, np.vstack((deflection_y, deflection_x)).T))<EOL>


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>,<EOL>mass_to_light_ratio: dim.MassOverLuminosity = <NUM_LIT:1.0>):<DEDENT>

super(SphericalExponential, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, intensity=intensity,<EOL>effective_radius=effective_radius,<EOL>mass_to_light_ratio=mass_to_light_ratio)<EOL>

The Exponential mass profile, the mass profiles of the light profiles that are used to fit and subtract the lens
model_galaxy's light.

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
intensity : float
    Overall flux intensity normalisation in the light profiles (electrons per second).
effective_radius : float
    The circular radius containing half the light of this profile.
mass_to_light_ratio : float
    The mass-to-light ratio of the light profiles.


def mass_within_ellipse_in_units(self, major_axis, unit_mass='<STR_LIT>', kpc_per_arcsec=None,<EOL>critical_surface_density=None):

self.check_units_of_radius_and_critical_surface_density(<EOL>radius=major_axis, critical_surface_density=critical_surface_density)<EOL>profile = self.new_profile_with_units_converted(<EOL>unit_length=major_axis.unit_length, unit_mass='<STR_LIT>',<EOL>kpc_per_arcsec=kpc_per_arcsec, critical_surface_density=critical_surface_density)<EOL>mass_angular = dim.Mass(value=quad(profile.mass_integral, a=<NUM_LIT:0.0>, b=major_axis, args=(self.axis_ratio,))[<NUM_LIT:0>],<EOL>unit_mass='<STR_LIT>')<EOL>return mass_angular.convert(unit_mass=unit_mass, critical_surface_density=critical_surface_density)<EOL>

Integrate the mass profiles's convergence profile to compute the total angular mass within an ellipse of \
        specified major axis. This is centred on the mass profile.

        The following units for mass can be specified and output:

        - Dimensionless angular units (default) - 'angular'.
        - Solar masses - 'angular' (multiplies the angular mass by the critical surface mass density)

        Parameters
        ----------
        major_axis : float
            The major-axis radius of the ellipse.
        unit_mass : str
            The units the mass is returned in (angular | angular).
        critical_surface_density : float or None
            The critical surface mass density of the strong lens configuration, which converts mass from angular \
            units to phsical units (e.g. solar masses).


def calculate_deflection_component(npow, index):<EOL><INDENT>sersic_constant = self.sersic_constant<EOL>deflection_grid = self.axis_ratio * grid[:, index]<EOL>deflection_grid *= quad_grid(self.deflection_func, <NUM_LIT:0.0>, <NUM_LIT:1.0>, grid,<EOL>args=(npow, self.axis_ratio, self.intensity,<EOL>self.sersic_index, self.effective_radius,<EOL>self.mass_to_light_ratio, self.mass_to_light_gradient,<EOL>sersic_constant))[<NUM_LIT:0>]<EOL>return deflection_grid<EOL><DEDENT>deflection_y = calculate_deflection_component(<NUM_LIT:1.0>, <NUM_LIT:0>)<EOL>deflection_x = calculate_deflection_component(<NUM_LIT:0.0>, <NUM_LIT:1>)<EOL>return self.rotate_grid_from_profile(np.multiply(<NUM_LIT:1.0>, np.vstack((deflection_y, deflection_x)).T))<EOL>


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>kappa_s: float = <NUM_LIT>,<EOL>inner_slope: float = <NUM_LIT:1.0>,<EOL>scale_radius: dim.Length = <NUM_LIT:1.0>):<DEDENT>

super(AbstractEllipticalGeneralizedNFW, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>super(MassProfile, self).__init__()<EOL>self.kappa_s = kappa_s<EOL>self.scale_radius = scale_radius<EOL>self.inner_slope = inner_slope<EOL>

The elliptical NFW profiles, used to fit the dark matter halo of the lens.

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
axis_ratio : float
    Ratio of profiles ellipse's minor and major axes (b/a).
phi : float
    Rotational angle of profiles ellipse counter-clockwise from positive x-axis.
kappa_s : float
    The overall normalization of the dark matter halo \
    (kappa_s = (rho_s * scale_radius)/lensing_critical_density)
inner_slope : float
    The inner slope of the dark matter halo
scale_radius : float
    The arc-second radius where the average density within this radius is 200 times the critical density of \
    the Universe..


def density_between_circular_annuli_in_angular_units(self, inner_annuli_radius, outer_annuli_radius):

annuli_area = (np.pi * outer_annuli_radius ** <NUM_LIT>) - (np.pi * inner_annuli_radius ** <NUM_LIT>)<EOL>return (self.mass_within_circle_in_units(radius=outer_annuli_radius) -<EOL>self.mass_within_circle_in_units(radius=inner_annuli_radius))/ annuli_area<EOL>

Calculate the mass between two circular annuli and compute the density by dividing by the annuli surface
        area.

        The value returned by the mass integral is dimensionless, therefore the density between annuli is returned in \
        units of inverse radius squared. A conversion factor can be specified to convert this to a physical value \
        (e.g. the critical surface mass density).

        Parameters
        -----------
        inner_annuli_radius : float
            The radius of the inner annulus outside of which the density are estimated.
        outer_annuli_radius : float
            The radius of the outer annulus inside of which the density is estimated.


r = x * axis_ratio<EOL>return <NUM_LIT:2> * np.pi * r * self.convergence_func(x)<EOL>

Routine to integrate an elliptical light profiles - set axis ratio to 1 to compute the luminosity within a \
        circle


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>kappa_s: float = <NUM_LIT>,<EOL>inner_slope: float = <NUM_LIT:1.0>,<EOL>scale_radius: dim.Length = <NUM_LIT:1.0>):<DEDENT>

super(SphericalGeneralizedNFW, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, kappa_s=kappa_s,<EOL>inner_slope=inner_slope, scale_radius=scale_radius)<EOL>

The spherical NFW profiles, used to fit the dark matter halo of the lens.

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
kappa_s : float
    The overall normalization of the dark matter halo \
    (kappa_s = (rho_s * scale_radius)/lensing_critical_density)
inner_slope : float
    The inner slope of the dark matter halo.
scale_radius : float
    The arc-second radius where the average density within this radius is 200 times the critical density of \
    the Universe..


potential_grid = quad_grid(self.potential_func, <NUM_LIT:0.0>, <NUM_LIT:1.0>, grid,<EOL>args=(self.axis_ratio, self.slope, self.core_radius))[<NUM_LIT:0>]<EOL>return self.einstein_radius_rescaled * self.axis_ratio * potential_grid<EOL>


super(SphericalDevVaucouleurs, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, intensity=intensity,<EOL>effective_radius=effective_radius,<EOL>mass_to_light_ratio=mass_to_light_ratio)<EOL>

The DevVaucouleurs mass profile, the mass profiles of the light profiles that are used to fit and subtract the
lens model_galaxy's light.

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
intensity : float
    Overall flux intensity normalisation in the light profiles (electrons per second).
effective_radius : float
    The circular radius containing half the light of this profile.
mass_to_light_ratio : float
    The mass-to-light ratio of the light profiles.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>einstein_radius: dim.Length = <NUM_LIT:1.0>):<DEDENT>

super(SphericalIsothermal, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>,<EOL>einstein_radius=einstein_radius)<EOL>

Represents a spherical isothermal density distribution, which is equivalent to the spherical power-law
density distribution for the value slope: float = 2.0

Parameters
----------
centre: (float, float)
    The (y,x) arc-second coordinates of the profile centre.
einstein_radius : float
    The arc-second Einstein radius.


def tabulate_integral(self, grid, tabulate_bins):

eta_min = <NUM_LIT><EOL>eta_max = <NUM_LIT> * np.max(self.grid_to_elliptical_radii(grid))<EOL>minimum_log_eta = np.log10(eta_min)<EOL>maximum_log_eta = np.log10(eta_max)<EOL>bin_size = (maximum_log_eta - minimum_log_eta) / (tabulate_bins - <NUM_LIT:1>)<EOL>return eta_min, eta_max, minimum_log_eta, maximum_log_eta, bin_size<EOL>

Tabulate an integral over the surface density of deflection potential of a mass profile. This is used in \
        the GeneralizedNFW profile classes to speed up the integration procedure.

        Parameters
        -----------
        grid : grids.RegularGrid
            The grid of (y,x) arc-second coordinates the potential / deflection_stacks are computed on.
        tabulate_bins : int
            The number of bins to tabulate the inner integral of this profile.


def plot_deflections_x(<EOL>mass_profile, grid, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, <EOL>as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

deflections = mass_profile.deflections_from_grid(grid)<EOL>deflections_x = grid.scaled_array_2d_from_array_1d(deflections[:, <NUM_LIT:1>])<EOL>array_plotters.plot_array(<EOL>array=deflections_x, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize, grid_pointsize=grid_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the x component of the deflection angles of a mass profile, on a regular grid of (y,x) coordinates.

     Set *autolens.hyper.array.plotters.array_plotters* for a description of all innput parameters not described below.

     Parameters
     -----------
     mass_profile : model.profiles.mass_profiles.MassProfile
         The mass profile whose x deflecton angles are plotted.
     grid : ndarray or hyper.array.grid_stacks.RegularGrid
         The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)


def plot_convergence(<EOL>mass_profile, grid, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, <EOL>as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

convergence = mass_profile.convergence_from_grid(grid=grid)<EOL>convergence = grid.scaled_array_2d_from_array_1d(convergence)<EOL>array_plotters.plot_array(<EOL>array=convergence, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize, grid_pointsize=grid_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the convergence of a mass profile, on a regular grid of (y,x) coordinates.

    Set *autolens.hyper.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    mass_profile : model.profiles.mass_profiles.MassProfile
        The mass profile whose convergence is plotted.
    grid : ndarray or hyper.array.grid_stacks.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)


def plot_potential(<EOL>mass_profile, grid, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, <EOL>as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

potential = mass_profile.potential_from_grid(grid=grid)<EOL>potential = grid.scaled_array_2d_from_array_1d(potential)<EOL>array_plotters.plot_array(<EOL>array=potential, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize, grid_pointsize=grid_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the potential of a mass profile, on a regular grid of (y,x) coordinates.

    Set *autolens.hyper.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    mass_profile : model.profiles.mass_profiles.MassProfile
        The mass profile whose potential is plotted.
    grid : ndarray or hyper.array.grid_stacks.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)


def plot_intensities(<EOL>light_profile, grid, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, <EOL>as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

intensities = light_profile.intensities_from_grid(grid=grid)<EOL>intensities = grid.scaled_array_2d_from_array_1d(intensities)<EOL>array_plotters.plot_array(<EOL>array=intensities, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize, grid_pointsize=grid_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the intensities (e.g. the image) of a light profile, on a regular grid of (y,x) coordinates.

    Set *autolens.hyper.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    light_profile : model.profiles.light_profiles.LightProfile
        The light profile whose intensities are plotted.
    grid : ndarray or hyper.array.grid_stacks.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)


phi_radians = np.radians(self.phi)<EOL>return np.cos(phi_radians), np.sin(phi_radians)<EOL>

Determine the sin and cosine of the angle between the profile's ellipse and the positive x-axis, \
        counter-clockwise.


if self.__class__.__name__.startswith("<STR_LIT>"):<EOL><INDENT>return super().transform_grid_to_reference_frame(grid)<EOL><DEDENT>shifted_coordinates = np.subtract(grid, self.centre)<EOL>radius = np.sqrt(np.sum(shifted_coordinates ** <NUM_LIT>, <NUM_LIT:1>))<EOL>theta_coordinate_to_profile = np.arctan2(shifted_coordinates[:, <NUM_LIT:0>],<EOL>shifted_coordinates[:, <NUM_LIT:1>]) - self.phi_radians<EOL>transformed = np.vstack(<EOL>(radius * np.sin(theta_coordinate_to_profile), radius * np.cos(theta_coordinate_to_profile))).T<EOL>return transformed.view(TransformedGrid)<EOL>

Transform a grid of (y,x) coordinates to the reference frame of the profile, including a translation to \
        its centre and a rotation to it orientation.

        Parameters
        ----------
        grid : ndarray
            The (y, x) coordinates in the original reference frame of the grid.


y = np.add(np.multiply(grid_elliptical[:, <NUM_LIT:1>], self.sin_phi), np.multiply(grid_elliptical[:, <NUM_LIT:0>], self.cos_phi))<EOL>x = np.add(np.multiply(grid_elliptical[:, <NUM_LIT:1>], self.cos_phi), - np.multiply(grid_elliptical[:, <NUM_LIT:0>], self.sin_phi))<EOL>return np.vstack((y, x)).T<EOL>

Rotate a grid of elliptical (y,x) coordinates from the reference frame of the profile back to the \
        unrotated coordinate grid reference frame (coordinates are not shifted back to their 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_elliptical : TransformedGrid(ndarray)
            The (y, x) coordinates in the reference frame of an elliptical profile.


return np.multiply(np.sqrt(self.axis_ratio), self.grid_to_elliptical_radii(grid)).view(np.ndarray)<EOL>

Convert a grid of (y,x) coordinates to an eccentric radius, which is (1.0/axis_ratio) * elliptical radius \
        and used to define light profile half-light radii using circular radii.

        If the coordinates have not been transformed to the profile's geometry, this is performed automatically.

        Parameters
        ----------
        grid : TransformedGrid(ndarray)
            The (y, x) coordinates in the reference frame of the elliptical profile.


return np.sqrt(np.add(np.square(grid[:, <NUM_LIT:1>]), np.square(np.divide(grid[:, <NUM_LIT:0>], self.axis_ratio))))<EOL>

Convert a grid of (y,x) coordinates to an elliptical radius.

        If the coordinates have not been transformed to the profile's geometry, this is performed automatically.

        Parameters
        ----------
        grid : TransformedGrid(ndarray)
            The (y, x) coordinates in the reference frame of the elliptical profile.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>)):<DEDENT>

super(SphericalProfile, self).__init__(centre=centre)<EOL>

A spherical profile, which describes profiles with y and x centre Cartesian coordinates.

        Parameters
        ----------
        centre: (float, float)
            The (y,x) arc-second coordinates of the profile centre.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>):<DEDENT>

super(EllipticalProfile, self).__init__(centre=centre)<EOL>self.axis_ratio = axis_ratio<EOL>self.phi = phi<EOL>

An elliptical profile, which describes profiles with y and x centre Cartesian coordinates, an axis-ratio \
        and rotational angle phi.

        Parameters
        ----------
        centre: (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        axis_ratio : float
            Ratio of profiles ellipse's minor and major axes (b/a)
        phi : float
            Rotation angle of profiles ellipse counter-clockwise from positive x-axis


return np.sqrt(np.add(np.square(grid[:, <NUM_LIT:0>]), np.square(grid[:, <NUM_LIT:1>])))<EOL>

Convert a grid of (y, x) coordinates to a grid of their circular radii.

        If the coordinates have not been transformed to the profile's centre, this is performed automatically.

        Parameters
        ----------
        grid : TransformedGrid(ndarray)
            The (y, x) coordinates in the reference frame of the profile.


transformed = np.add(grid, self.centre)<EOL>return transformed.view(TransformedGrid)<EOL>

Transform a grid of (y,x) coordinates from the reference frame of the profile to the original observer \
        reference frame, including a translation from the profile's centre.

        Parameters
        ----------
        grid : TransformedGrid(ndarray)
            The (y, x) coordinates in the reference frame of the profile.


return np.cos(grid_thetas), np.sin(grid_thetas)<EOL>

The angle between each (y,x) coordinate on the grid and the profile, in radians.

        Parameters
        -----------
        grid_thetas : ndarray
            The angle theta counter-clockwise from the positive x-axis to each coordinate in radians.


theta_coordinate_to_profile = np.add(grid_thetas, - self.phi_radians)<EOL>return np.cos(theta_coordinate_to_profile), np.sin(theta_coordinate_to_profile)<EOL>

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

        Parameters
        -----------
        grid_thetas : ndarray
            The angle theta counter-clockwise from the positive x-axis to each coordinate in radians.


@wraps(func)<EOL>def wrapper(profile, grid, *args, **kwargs):<EOL><INDENT>"""<STR_LIT>"""<EOL>if not isinstance(grid, TransformedGrid):<EOL><INDENT>return func(profile, profile.transform_grid_to_reference_frame(grid), *args, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>return func(profile, grid, *args, **kwargs)<EOL><DEDENT><DEDENT>return wrapper<EOL>

Wrap the function in a function that checks whether the coordinates have been transformed. If they have not \
    been transformed then they are transformed.

    Parameters
    ----------
    func : (profiles, *args, **kwargs) -> Object
        A function that requires transformed coordinates

    Returns
    -------
        A function that can except cartesian or transformed coordinates


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>,<EOL>sersic_index: float = <NUM_LIT>,<EOL>radius_break: dim.Length = <NUM_LIT>,<EOL>intensity_break: dim.Luminosity = <NUM_LIT>,<EOL>gamma: float = <NUM_LIT>,<EOL>alpha: float = <NUM_LIT>):<DEDENT>

super(EllipticalCoreSersic, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi, intensity=intensity,<EOL>effective_radius=effective_radius, sersic_index=sersic_index)<EOL>self.radius_break = radius_break<EOL>self.intensity_break = intensity_break<EOL>self.alpha = alpha<EOL>self.gamma = gamma<EOL>

The elliptical cored-Sersic light profile.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        axis_ratio : float
            Ratio of light profiles ellipse's minor and major axes (b/a).
        phi : float
            Rotation angle of light profile counter-clockwise from positive x-axis.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.
        sersic_index : Int
            Controls the concentration of the of the profile (lower value -> less concentrated, \
            higher value -> more concentrated).
        radius_break : Float
            The break radius separating the inner power-law (with logarithmic slope gamma) and outer Sersic function.
        intensity_break : Float
            The intensity at the break radius.
        gamma : Float
            The logarithmic power-law slope of the inner core profiles
        alpha :
            Controls the sharpness of the transition between the inner core / outer Sersic profiles.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>,<EOL>sersic_index: float = <NUM_LIT>,<EOL>radius_break: dim.Length = <NUM_LIT>,<EOL>intensity_break: dim.Luminosity = <NUM_LIT>,<EOL>gamma: float = <NUM_LIT>,<EOL>alpha: float = <NUM_LIT>):<DEDENT>

super(SphericalCoreSersic, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, intensity=intensity,<EOL>effective_radius=effective_radius, sersic_index=sersic_index,<EOL>radius_break=radius_break, intensity_break=intensity_break,<EOL>gamma=gamma, alpha=alpha)<EOL>self.radius_break = radius_break<EOL>self.intensity_break = intensity_break<EOL>self.alpha = alpha<EOL>self.gamma = gamma<EOL>

The elliptical cored-Sersic light profile.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.
        sersic_index : Int
            Controls the concentration of the of the profile (lower value -> less concentrated, \
            higher value -> more concentrated).
        radius_break : Float
            The break radius separating the inner power-law (with logarithmic slope gamma) and outer Sersic function.
        intensity_break : Float
            The intensity at the break radius.
        gamma : Float
            The logarithmic power-law slope of the inner core profiles
        alpha :
            Controls the sharpness of the transition between the inner core / outer Sersic profiles.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>,<EOL>sersic_index: float = <NUM_LIT>):<DEDENT>

super(AbstractEllipticalSersic, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>self.intensity = intensity<EOL>self.effective_radius = effective_radius<EOL>self.sersic_index = sersic_index<EOL>

Abstract base class for an elliptical Sersic light profile, used for computing its effective radius and
        Sersic constant.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        axis_ratio : float
            Ratio of light profiles ellipse's minor and major axes (b/a)
        phi : float
            Rotational angle of profiles ellipse counter-clockwise from positive x-axis
        intensity : float
            Overall intensity normalisation in the light profiles (electrons per second)
        effective_radius : float
            The circular radius containing half the light of this model_mapper
        sersic_index : Int
            Controls the concentration of the of the profile (lower value -> less concentrated, \
            higher value -> more concentrated).


def luminosity_integral(self, x, axis_ratio):

r = x * axis_ratio<EOL>return <NUM_LIT:2> * np.pi * r * self.intensities_from_grid_radii(x)<EOL>

Routine to integrate the luminosity of an elliptical light profile.

        The axis ratio is set to 1.0 for computing the luminosity within a circle


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>sigma: dim.Length = <NUM_LIT>):<DEDENT>

super(SphericalGaussian, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, intensity=intensity,<EOL>sigma=sigma)<EOL>

The spherical Gaussian light profile.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        sigma : float
            The full-width half-maximum of the Gaussian.


return self.effective_radius / np.sqrt(self.axis_ratio)<EOL>

The effective_radius of a Sersic light profile is defined as the circular effective radius. This is the \
        radius within which a circular aperture contains half the profiles's total integrated light. For elliptical \
        systems, this won't robustly capture the light profile's elliptical shape.

        The elliptical effective radius instead describes the major-axis radius of the ellipse containing \
        half the light, and may be more appropriate for highly flattened systems like disk galaxies.


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>):<DEDENT>

super(SphericalDevVaucouleurs, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, intensity=intensity,<EOL>effective_radius=effective_radius)<EOL>

The spherical Dev Vaucouleurs light profile.

        This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 1.0.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.


super(SphericalExponential, self).__init__(centre=centre, axis_ratio=<NUM_LIT:1.0>, phi=<NUM_LIT:0.0>, intensity=intensity,<EOL>effective_radius=effective_radius)<EOL>

The spherical exponential profile.

        This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 1.0.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.


super(EllipticalSersic, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi, intensity=intensity,<EOL>effective_radius=effective_radius, sersic_index=sersic_index)<EOL>

The elliptical Sersic light profile.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        axis_ratio : float
            Ratio of light profiles ellipse's minor and major axes (b/a).
        phi : float
            Rotation angle of light profile counter-clockwise from positive x-axis.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.
        sersic_index : Int
            Controls the concentration of the of the profile (lower value -> less concentrated, \
            higher value -> more concentrated).


@map_types<EOL><INDENT>def __init__(self,<EOL>centre: dim.Position = (<NUM_LIT:0.0>, <NUM_LIT:0.0>),<EOL>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>effective_radius: dim.Length = <NUM_LIT>):<DEDENT>

super(EllipticalExponential, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi, intensity=intensity,<EOL>effective_radius=effective_radius, sersic_index=<NUM_LIT:1.0>)<EOL>

The elliptical exponential profile.

        This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 1.0.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second centre of the light profile.
        axis_ratio : float
            Ratio of light profiles ellipse's minor and major axes (b/a).
        phi : float
            Rotation angle of light profile counter-clockwise from positive x-axis.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.


super(EllipticalDevVaucouleurs, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi,<EOL>intensity=intensity, effective_radius=effective_radius,<EOL>sersic_index=<NUM_LIT>)<EOL>

The elliptical Dev Vaucouleurs light profile.

        This is a subset of the elliptical Sersic profile, specific to the case that sersic_index = 4.0.

        Parameters
        ----------
        centre : (float, float)
            The (y,x) arc-second coordinates of the profile centre.
        axis_ratio : float
            Ratio of light profiles ellipse's minor and major axes (b/a).
        phi : float
            Rotation angle of light profile counter-clockwise from positive x-axis.
        intensity : float
            Overall intensity normalisation of the light profiles (electrons per second).
        effective_radius : float
            The circular radius containing half the light of this profile.


def luminosity_within_ellipse_in_units(self, major_axis, unit_luminosity='<STR_LIT>', kpc_per_arcsec=None,<EOL>exposure_time=None):

if not isinstance(major_axis, dim.Length):<EOL><INDENT>major_axis = dim.Length(major_axis, '<STR_LIT>')<EOL><DEDENT>profile = self.new_profile_with_units_converted(unit_length=major_axis.unit_length,<EOL>unit_luminosity=unit_luminosity,<EOL>kpc_per_arcsec=kpc_per_arcsec, exposure_time=exposure_time)<EOL>luminosity = quad(profile.luminosity_integral, a=<NUM_LIT:0.0>, b=major_axis, args=(self.axis_ratio,))[<NUM_LIT:0>]<EOL>return dim.Luminosity(luminosity, unit_luminosity)<EOL>

Integrate the light profiles to compute the total luminosity within an ellipse of specified major axis. \
        This is centred on the light profile's centre.

        The following units for mass can be specified and output:

        - Electrons per second (default) - 'eps'.
        - Counts - 'counts' (multiplies the luminosity in electrons per second by the exposure time).

        Parameters
        ----------
        major_axis : float
            The major-axis radius of the ellipse.
        unit_luminosity : str
            The units the luminosity is returned in (eps | counts).
        exposure_time : float or None
            The exposure time of the observation, which converts luminosity from electrons per second units to counts.


return self.intensity * np.exp(<EOL>-self.sersic_constant * (((radius / self.effective_radius) ** (<NUM_LIT:1.> / self.sersic_index)) - <NUM_LIT:1>))<EOL>

Compute the intensity of the profile at a given radius.

        Parameters
        ----------
        radius : float
            The distance from the centre of the profile.


def luminosity_within_circle_in_units(self, radius: dim.Length, unit_luminosity='<STR_LIT>', kpc_per_arcsec=None,<EOL>exposure_time=None):

if not isinstance(radius, dim.Length):<EOL><INDENT>radius = dim.Length(value=radius, unit_length='<STR_LIT>')<EOL><DEDENT>profile = self.new_profile_with_units_converted(unit_length=radius.unit_length, unit_luminosity=unit_luminosity,<EOL>kpc_per_arcsec=kpc_per_arcsec, exposure_time=exposure_time)<EOL>luminosity = quad(profile.luminosity_integral, a=<NUM_LIT:0.0>, b=radius, args=(<NUM_LIT:1.0>,))[<NUM_LIT:0>]<EOL>return dim.Luminosity(luminosity, unit_luminosity)<EOL>

Integrate the light profile to compute the total luminosity within a circle of specified radius. This is \
        centred on the light profile's centre.

        The following units for mass can be specified and output:

        - Electrons per second (default) - 'eps'.
        - Counts - 'counts' (multiplies the luminosity in electrons per second by the exposure time).

        Parameters
        ----------
        radius : float
            The radius of the circle to compute the dimensionless mass within.
        unit_luminosity : str
            The units the luminosity is returned in (eps | counts).
        exposure_time : float or None
            The exposure time of the observation, which converts luminosity from electrons per second units to counts.


def __init__(self, galaxy_data, mask, sub_grid_size=<NUM_LIT:2>, use_intensities=False, use_convergence=False,<EOL>use_potential=False, use_deflections_y=False, use_deflections_x=False):

self.image = galaxy_data.image<EOL>self.pixel_scale = galaxy_data.pixel_scale<EOL>self.noise_map = galaxy_data.noise_map<EOL>self.mask = mask<EOL>self.image_1d = mask.map_2d_array_to_masked_1d_array(array_2d=self.image)<EOL>self.noise_map_1d = mask.map_2d_array_to_masked_1d_array(array_2d=self.noise_map)<EOL>self.mask_1d = mask.map_2d_array_to_masked_1d_array(array_2d=mask)<EOL>self.sub_grid_size = sub_grid_size<EOL>self.grid_stack = grids.GridStack.grid_stack_from_mask_sub_grid_size_and_psf_shape(mask=mask,<EOL>sub_grid_size=sub_grid_size,<EOL>psf_shape=(<NUM_LIT:1>, <NUM_LIT:1>))<EOL>self.padded_grid_stack = grids.GridStack.padded_grid_stack_from_mask_sub_grid_size_and_psf_shape(<EOL>mask=mask, sub_grid_size=sub_grid_size, psf_shape=(<NUM_LIT:1>, <NUM_LIT:1>))<EOL>if all(not element for element in [use_intensities, use_convergence, use_potential,<EOL>use_deflections_y, use_deflections_x]):<EOL><INDENT>raise exc.GalaxyException('<STR_LIT>')<EOL><DEDENT>if sum([use_intensities, use_convergence, use_potential, use_deflections_y, use_deflections_x]) > <NUM_LIT:1>:<EOL><INDENT>raise exc.GalaxyException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>self.use_intensities = use_intensities<EOL>self.use_convergence = use_convergence<EOL>self.use_potential = use_potential<EOL>self.use_deflections_y = use_deflections_y<EOL>self.use_deflections_x = use_deflections_x<EOL>

A galaxy-fit data is a collection of fit data components which are used to fit a galaxy to another galaxy. \
        This is where a component of a galaxy's light profiles (e.g. intensities) or mass profiles (e.g. surface \
        density, potential or deflection angles) are fitted to one another.

        This is primarily performed for automatic prior linking, as a means to efficiently link the priors of a galaxy \
        using one inferred parametrization of light or mass profiles to a new galaxy with a different parametrization \
        of light or mass profiles.

        This omits a number of the fit data components typically used when fitting an image (e.g. the observed image, PSF, \
        exposure time map), but still has a number of the other components (e.g. an effective noise_map-map, grid_stacks).

        Parameters
        ----------
        galaxy_data : GalaxyData
            The collection of data about the galaxy (image of its profile map, noise-map, etc.) that is fitted.
        mask: msk.Mask
            The 2D masks that is applied to image fit data.
        sub_grid_size : int
            The size of the sub-grid used for computing the SubGrid (see ccd.masks.SubGrid).

        Attributes
        ----------
        noise_map_1d : ndarray
            The masked 1D array of the noise_map-map
        grid_stacks : ccd.masks.GridStack
            Grids of (y,x) Cartesian coordinates which map over the masked 1D fit data array's pixels (includes an \
            regular-grid, sub-grid, etc.)
        padded_grid_stack : ccd.masks.GridStack
            Grids of padded (y,x) Cartesian coordinates which map over the every fit data array's pixel in 1D and a \
            padded regioon to include edge's for accurate PSF convolution (includes an regular-grid, sub-grid, etc.)


if self.has_mass_profile:<EOL><INDENT>return sum(map(lambda p: p.deflections_from_grid(grid), self.mass_profiles))<EOL><DEDENT>else:<EOL><INDENT>return np.full((grid.shape[<NUM_LIT:0>], <NUM_LIT:2>), <NUM_LIT:0.0>)<EOL><DEDENT>

Compute the summed (y,x) deflection angles of the galaxy's mass profiles using a grid of Cartesian (y,x) \
        coordinates.

        If the galaxy has no mass profiles, two grid of zeros are returned.

        See *profiles.mass_profiles* module for details of how this is performed.

        Parameters
        ----------
        grid : ndarray
            The (y, x) coordinates in the original reference frame of the grid.


def hyper_noise_from_contributions(self, noise_map, contributions):

return self.noise_factor * (noise_map * contributions) ** self.noise_power<EOL>

Compute a scaled galaxy hyper noise-map from a baseline noise-map.

        This uses the galaxy contribution map and the *noise_factor* and *noise_power* hyper-parameters.

        Parameters
        -----------
        noise_map : ndarray
            The observed noise-map (before scaling).
        contributions : ndarray
            The galaxy contribution map.


if self.has_mass_profile:<EOL><INDENT>return sum(map(lambda p: p.convergence_from_grid(grid), self.mass_profiles))<EOL><DEDENT>else:<EOL><INDENT>return np.zeros((grid.shape[<NUM_LIT:0>],))<EOL><DEDENT>

Compute the summed 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_profiles* module for details of how this is performed.

        Parameters
        ----------
        grid : ndarray
            The (y, x) coordinates in the original reference frame of the grid.


def __init__(self, contribution_factor=<NUM_LIT:0.0>, noise_factor=<NUM_LIT:0.0>, noise_power=<NUM_LIT:1.0>):

self.contribution_factor = contribution_factor<EOL>self.noise_factor = noise_factor<EOL>self.noise_power = noise_power<EOL>self.component_number = next(self._ids)<EOL>

If a *Galaxy* is given a *HyperGalaxy* as an attribute, the noise-map in the regions of the image that the \
        galaxy is located will be scaled, to prevent over-fitting of the galaxy.

        This is performed by first computing the hyper-galaxy's 'contribution-map', which determines the fraction of \
        flux in every pixel of the image that can be associated with this particular hyper-galaxy. This is computed \
        using  hyper-hyper set (e.g. fitting.fit_data.FitDataHyper), which includes  best-fit unblurred_image_1d of \
        the galaxy's light from a previous analysis phase.

        The *HyperGalaxy* class contains the hyper-parameters which are associated with this galaxy for scaling the \
        noise-map.

        Parameters
        -----------
        contribution_factor : float
            Factor that adjusts how much of the galaxy's light is attributed to the contribution map.
        noise_factor : float
            Factor by which the noise-map is increased in the regions of the galaxy's contribution map.
        noise_power : float
            The power to which the contribution map is raised when scaling the noise-map.


if galaxies:<EOL><INDENT>return sum(map(lambda g: g.convergence_from_grid(grid), galaxies))<EOL><DEDENT>else:<EOL><INDENT>return np.full((grid.shape[<NUM_LIT:0>]), <NUM_LIT:0.0>)<EOL><DEDENT>

Compute the convergence of a list of galaxies from an input grid, by summing the individual convergence \
    of each galaxy's mass profile.

    If the input grid is a *grids.SubGrid*, the convergence is calculated on the sub-grid and binned-up to the \
    original regular grid by taking the mean value of every set of sub-pixels.

    If no galaxies are entered into the function, an array of all zeros is returned.

    Parameters
    -----------
    grid : RegularGrid
        The grid (regular or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the \
        convergence is calculated on.
    galaxies : [galaxy.Galaxy]
        The galaxies whose mass profiles are used to compute the convergence.


if galaxies:<EOL><INDENT>return sum(map(lambda galaxy: galaxy.deflections_from_grid(sub_grid), galaxies))<EOL><DEDENT>else:<EOL><INDENT>return np.full((sub_grid.shape[<NUM_LIT:0>], <NUM_LIT:2>), <NUM_LIT:0.0>)<EOL><DEDENT>

Compute the deflections of a list of galaxies from an input sub-grid, by summing the individual deflections \
    of each galaxy's mass profile.

    The deflections are calculated on the sub-grid and binned-up to the original regular grid by taking the mean value \
    of every set of sub-pixels.

    If no galaxies are entered into the function, an array of all zeros is returned.

    Parameters
    -----------
    sub_grid : RegularGrid
        The grid (regular or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the \
        deflections is calculated on.
    galaxies : [galaxy.Galaxy]
        The galaxies whose mass profiles are used to compute the surface densities.


if len(galaxies) > <NUM_LIT:0>:<EOL><INDENT>deflections = sum(map(lambda galaxy: galaxy.deflections_from_grid(grid), galaxies))<EOL><DEDENT>else:<EOL><INDENT>deflections = np.full((grid.shape[<NUM_LIT:0>], <NUM_LIT:2>), <NUM_LIT:0.0>)<EOL><DEDENT>if isinstance(grid, grids.SubGrid):<EOL><INDENT>return np.asarray([grid.regular_data_1d_from_sub_data_1d(deflections[:, <NUM_LIT:0>]),<EOL>grid.regular_data_1d_from_sub_data_1d(deflections[:, <NUM_LIT:1>])]).T<EOL><DEDENT>return deflections<EOL>

Compute the deflections of a list of galaxies from an input grid, by summing the individual deflections \
    of each galaxy's mass profile.

    If the input grid is a *grids.SubGrid*, the potential is calculated on the sub-grid and binned-up to the \
    original regular grid by taking the mean value of every set of sub-pixels.

    If no galaxies are entered into the function, an array of all zeros is returned.

    Parameters
    -----------
    grid : RegularGrid
        The grid (regular or sub) of (y,x) arc-second coordinates at the centre of every unmasked pixel which the \
        deflections is calculated on.
    galaxies : [galaxy.Galaxy]
        The galaxies whose mass profiles are used to compute the surface densities.


def plot_potential(<EOL>galaxy, grid, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

potential = galaxy.potential_from_grid(grid=grid)<EOL>potential = grid.scaled_array_2d_from_array_1d(potential)<EOL>array_plotters.plot_array(<EOL>array=potential, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize, grid_pointsize=grid_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the potential of a galaxy, on a regular grid of (y,x) coordinates.

     Set *autolens.datas.array.plotters.array_plotters* for a description of all innput parameters not described below.

     Parameters
     -----------
    galaxy : model.galaxy.galaxy.Galaxy
         The galaxy whose potential is plotted.
    grid : ndarray or datas.array.grid_stacks.RegularGrid
         The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)


def plot_convergence(<EOL>galaxy, grid, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

convergence = galaxy.convergence_from_grid(grid=grid)<EOL>convergence = grid.scaled_array_2d_from_array_1d(convergence)<EOL>array_plotters.plot_array(<EOL>array=convergence, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize, grid_pointsize=grid_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the convergence of a galaxy, on a regular grid of (y,x) coordinates.

    Set *autolens.datas.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    galaxy : model.galaxy.galaxy.Galaxy
        The galaxy whose convergence is plotted.
    grid : ndarray or datas.array.grid_stacks.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)


return [prior for prior_model in self.prior_models for prior in prior_model.prior_tuples]<EOL>

Returns
-------
priors: [PriorTuple]
    A list of priors associated with prior models in this galaxy prior.


return {key: value for key, value in<EOL>filter(lambda t: isinstance(t[<NUM_LIT:1>], pm.PriorModel) and is_profile_class(t[<NUM_LIT:1>].cls),<EOL>self.__dict__.items())}<EOL>

Returns
-------
profile_prior_model_dict: {str: PriorModel}
    A dictionary mapping_matrix instance variable names to variable profiles.


profiles = {**{key: value.instance_for_arguments(arguments)<EOL>for key, value<EOL>in self.profile_prior_model_dict.items()}, **self.constant_profile_dict}<EOL>try:<EOL><INDENT>redshift = self.redshift.instance_for_arguments(arguments)<EOL><DEDENT>except AttributeError:<EOL><INDENT>redshift = self.redshift<EOL><DEDENT>pixelization = self.pixelization.instance_for_arguments(arguments)if isinstance(self.pixelization, pm.PriorModel)else self.pixelization<EOL>regularization = self.regularization.instance_for_arguments(arguments)if isinstance(self.regularization, pm.PriorModel)else self.regularization<EOL>hyper_galaxy = self.hyper_galaxy.instance_for_arguments(arguments)if isinstance(self.hyper_galaxy, pm.PriorModel)else self.hyper_galaxy<EOL>return galaxy.Galaxy(redshift=redshift, pixelization=pixelization, regularization=regularization,<EOL>hyper_galaxy=hyper_galaxy, **profiles)<EOL>

Create an instance of the associated class for a set of arguments

Parameters
----------
arguments: {Prior: value}
    Dictionary mapping_matrix priors to attribute analysis_path and value pairs

Returns
-------
    An instance of the class


def bulge_disk_tag_from_align_bulge_disks(align_bulge_disk_centre, align_bulge_disk_axis_ratio, align_bulge_disk_phi):

align_bulge_disk_centre_tag = align_bulge_disk_centre_tag_from_align_bulge_disk_centre(<EOL>align_bulge_disk_centre=align_bulge_disk_centre)<EOL>align_bulge_disk_axis_ratio_tag = align_bulge_disk_axis_ratio_tag_from_align_bulge_disk_axis_ratio(<EOL>align_bulge_disk_axis_ratio=align_bulge_disk_axis_ratio)<EOL>align_bulge_disk_phi_tag = align_bulge_disk_phi_tag_from_align_bulge_disk_phi(<EOL>align_bulge_disk_phi=align_bulge_disk_phi)<EOL>return align_bulge_disk_centre_tag + align_bulge_disk_axis_ratio_tag + align_bulge_disk_phi_tag<EOL>

Generate a tag for the alignment of the geometry of the bulge and disk of a bulge-disk system, to customize \
    phase names based on the bulge-disk model. This adds together the bulge_disk tags generated in the 3 functions
    above


if not align_bulge_disk_centre:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif align_bulge_disk_centre:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>

Generate a tag for if the bulge and disk of a bulge-disk system are aligned or not, to customize phase names \
    based on the bulge-disk model. This changee the phase name 'phase_name' as follows:

    bd_align_centres = False -> phase_name
    bd_align_centres = True -> phase_name_bd_align_centres


if image_psf_shape is None:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>y = str(image_psf_shape[<NUM_LIT:0>])<EOL>x = str(image_psf_shape[<NUM_LIT:1>])<EOL>return ('<STR_LIT>' + y + '<STR_LIT:x>' + x)<EOL><DEDENT>

Generate an image psf shape tag, to customize phase names based on size of the image PSF that the original PSF \
    is trimmed to for faster run times.

    This changes the phase name 'phase_name' as follows:

    image_psf_shape = 1 -> phase_name
    image_psf_shape = 2 -> phase_name_image_psf_shape_2
    image_psf_shape = 2 -> phase_name_image_psf_shape_2


return '<STR_LIT>' + str(sub_grid_size)<EOL>

Generate a sub-grid tag, to customize phase names based on the sub-grid size used.

    This changes the phase name 'phase_name' as follows:

    sub_grid_size = None -> phase_name
    sub_grid_size = 1 -> phase_name_sub_grid_size_2
    sub_grid_size = 4 -> phase_name_sub_grid_size_4


if inner_mask_radii == None:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>'.format(inner_mask_radii)<EOL><DEDENT>

Generate an inner mask radii tag, to customize phase names based on the size of the circular masked area in the \
    centre of an image.

    This changes the phase name 'phase_name' as follows:

    inner_circular_mask_radii = 1 -> phase_name
    inner_circular_mask_radii = 2 -> phase_name_inner_circular_mask_radii_2
    inner_circular_mask_radii = 2 -> phase_name_inner_circular_mask_radii_2


if not align_bulge_disk_phi:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif align_bulge_disk_phi:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>

Generate a tag for if the bulge and disk of a bulge-disk system are aligned or not, to customize phase names \
    based on the bulge-disk model. This changes the phase name 'phase_name' as follows:

    bd_align_phi = False -> phase_name
    bd_align_phi = True -> phase_name_bd_align_phi


if not fix_lens_light:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif fix_lens_light:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>

Generate a tag for if the lens light of the pipeline and / or phase are fixed to a previous estimate, or varied \
     during he analysis, to customize phase names.

    This changes the phase name 'phase_name' as follows:

    fix_lens_light = False -> phase_name
    fix_lens_light = True -> phase_name_fix_lens_light


def run(self, positions, pixel_scale, results=None):

analysis = self.make_analysis(positions=positions, pixel_scale=pixel_scale, results=results)<EOL>result = self.run_analysis(analysis)<EOL>return self.make_result(result, analysis)<EOL>

Run this phase.

Parameters
----------
pixel_scale
positions
results: autofit.tools.pipeline.ResultsCollection
    An object describing the results of the last phase or None if no phase has been executed

Returns
-------
result: AbstractPhase.Result
    A result object comprising the best fit model and other hyper.


def decorator(func):<EOL><INDENT>@functools.wraps(func)<EOL>def wrapper(phase, new_value):<EOL><INDENT>new_value = new_value or []<EOL>for item in new_value:<EOL><INDENT>galaxy = new_value[item] if isinstance(item, str) else item<EOL>galaxy.redshift = galaxy.redshift or conf.instance.general.get("<STR_LIT>", key, float)<EOL><DEDENT>return func(phase, new_value)<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>

Load a default value for redshift from config and set it as the redshift for source or lens galaxies that have
falsey redshifts

Parameters
----------
key: str

Returns
-------
decorator
    A decorator that wraps the setter function to set defaults


def __init__(self, phase_name, tag_phases=True, phase_folders=None, galaxies=None,<EOL>optimizer_class=non_linear.MultiNest,<EOL>sub_grid_size=<NUM_LIT:2>, bin_up_factor=None, image_psf_shape=None, positions_threshold=None,<EOL>mask_function=None,<EOL>inner_mask_radii=None, cosmology=cosmo.Planck15, auto_link_priors=False):

A phase with a simple source/lens model

Parameters
----------
galaxies : [g.Galaxy] | [gm.GalaxyModel]
    A galaxy that acts as a gravitational lens or is being lensed
optimizer_class: class
    The class of a non-linear optimizer
sub_grid_size: int
    The side length of the subgrid


def make_analysis(self, galaxy_data, results=None, mask=None):

mask = setup_phase_mask(data=galaxy_data[<NUM_LIT:0>], mask=mask, mask_function=self.mask_function,<EOL>inner_mask_radii=None)<EOL>self.pass_priors(results)<EOL>if self.use_intensities or self.use_convergence or self.use_potential:<EOL><INDENT>galaxy_data = gd.GalaxyFitData(galaxy_data=galaxy_data[<NUM_LIT:0>], mask=mask, sub_grid_size=self.sub_grid_size,<EOL>use_intensities=self.use_intensities,<EOL>use_convergence=self.use_convergence,<EOL>use_potential=self.use_potential,<EOL>use_deflections_y=self.use_deflections,<EOL>use_deflections_x=self.use_deflections)<EOL>return self.__class__.AnalysisSingle(galaxy_data=galaxy_data,<EOL>cosmology=self.cosmology,<EOL>results=results)<EOL><DEDENT>elif self.use_deflections:<EOL><INDENT>galaxy_data_y = gd.GalaxyFitData(galaxy_data=galaxy_data[<NUM_LIT:0>], mask=mask, sub_grid_size=self.sub_grid_size,<EOL>use_intensities=self.use_intensities,<EOL>use_convergence=self.use_convergence,<EOL>use_potential=self.use_potential,<EOL>use_deflections_y=self.use_deflections, use_deflections_x=False)<EOL>galaxy_data_x = gd.GalaxyFitData(galaxy_data=galaxy_data[<NUM_LIT:1>], mask=mask, sub_grid_size=self.sub_grid_size,<EOL>use_intensities=self.use_intensities,<EOL>use_convergence=self.use_convergence,<EOL>use_potential=self.use_potential,<EOL>use_deflections_y=False, use_deflections_x=self.use_deflections)<EOL>return self.__class__.AnalysisDeflections(galaxy_data_y=galaxy_data_y, galaxy_data_x=galaxy_data_x,<EOL>cosmology=self.cosmology,<EOL>results=results)<EOL><DEDENT>

Create an lens object. Also calls the prior passing and lens_data modifying functions to allow child
classes to change the behaviour of the phase.

Parameters
----------
galaxy_data
mask: Mask
    The default masks passed in by the pipeline
results: autofit.tools.pipeline.ResultsCollection
    The result from the previous phase

Returns
-------
lens: Analysis
    An lens object that the non-linear optimizer calls to determine the fit of a set of values


def run(self, data, results=None, mask=None, positions=None):

model_image = results.last.unmasked_model_image<EOL>galaxy_tuples = results.last.constant.name_instance_tuples_for_class(g.Galaxy)<EOL>results_copy = copy.copy(results.last)<EOL>for name, galaxy in galaxy_tuples:<EOL><INDENT>optimizer = self.optimizer.copy_with_name_extension(name)<EOL>optimizer.variable.hyper_galaxy = g.HyperGalaxy<EOL>galaxy_image = results.last.unmasked_image_for_galaxy(galaxy)<EOL>optimizer.fit(self.__class__.Analysis(data, model_image, galaxy_image))<EOL>getattr(results_copy.variable, name).hyper_galaxy = optimizer.variable.hyper_galaxy<EOL>getattr(results_copy.constant, name).hyper_galaxy = optimizer.constant.hyper_galaxy<EOL><DEDENT>return results_copy<EOL>

Run a fit for each galaxy from the previous phase.

Parameters
----------
data: LensData
results: ResultsCollection
    Results from all previous phases
mask: Mask
    The mask
positions

Returns
-------
results: HyperGalaxyResults
    A collection of results, with one item per a galaxy


def __init__(self, phase_name, tag_phases=True, phase_folders=None, optimizer_class=non_linear.MultiNest,<EOL>sub_grid_size=<NUM_LIT:2>, bin_up_factor=None, image_psf_shape=None,<EOL>inversion_psf_shape=None, positions_threshold=None, mask_function=None, inner_mask_radii=None,<EOL>interp_pixel_scale=None, cosmology=cosmo.Planck15, auto_link_priors=False):

if tag_phases:<EOL><INDENT>phase_tag = tag.phase_tag_from_phase_settings(sub_grid_size=sub_grid_size,<EOL>bin_up_factor=bin_up_factor,<EOL>image_psf_shape=image_psf_shape,<EOL>inversion_psf_shape=inversion_psf_shape,<EOL>positions_threshold=positions_threshold,<EOL>inner_mask_radii=inner_mask_radii,<EOL>interp_pixel_scale=interp_pixel_scale)<EOL><DEDENT>else:<EOL><INDENT>phase_tag = None<EOL><DEDENT>super(PhaseImaging, self).__init__(phase_name=phase_name, phase_tag=phase_tag, phase_folders=phase_folders,<EOL>tag_phases=tag_phases,<EOL>optimizer_class=optimizer_class, cosmology=cosmology,<EOL>auto_link_priors=auto_link_priors)<EOL>self.sub_grid_size = sub_grid_size<EOL>self.bin_up_factor = bin_up_factor<EOL>self.image_psf_shape = image_psf_shape<EOL>self.inversion_psf_shape = inversion_psf_shape<EOL>self.positions_threshold = positions_threshold<EOL>self.mask_function = mask_function<EOL>self.inner_mask_radii = inner_mask_radii<EOL>self.interp_pixel_scale = interp_pixel_scale<EOL>

A phase in an lens pipeline. Uses the set non_linear optimizer to try to fit models and hyper
passed to it.

Parameters
----------
optimizer_class: class
    The class of a non_linear optimizer
sub_grid_size: int
    The side length of the subgrid


return image<EOL>

Customize an lens_data. e.g. removing lens light.

Parameters
----------
image: scaled_array.ScaledSquarePixelArray
    An lens_data that has been masked
results: autofit.tools.pipeline.ResultsCollection
    The result of the previous lens

Returns
-------
lens_data: scaled_array.ScaledSquarePixelArray
    The modified image (not changed by default)


return self.optimizer.variable<EOL>

Convenience method

Returns
-------
ModelMapper
    A model mapper comprising all the variable (prior) objects in this lens


def __init__(self, phase_name, phase_tag=None, phase_folders=None, tag_phases=True,<EOL>optimizer_class=non_linear.MultiNest,<EOL>cosmology=cosmo.Planck15, auto_link_priors=False):

super().__init__(phase_name=phase_name, phase_tag=phase_tag, phase_folders=phase_folders, tag_phases=tag_phases,<EOL>optimizer_class=optimizer_class, auto_link_priors=auto_link_priors)<EOL>self.cosmology = cosmology<EOL>

A phase in an lens pipeline. Uses the set non_linear optimizer to try to fit models and hyper
passed to it.

Parameters
----------
optimizer_class: class
    The class of a non_linear optimizer
phase_name: str
    The name of this phase


def __init__(self, phase_name, phase_tagging=True, phase_folders=None, galaxies=None, use_intensities=False,<EOL>use_convergence=False,<EOL>use_potential=False,<EOL>use_deflections=False, optimizer_class=non_linear.MultiNest, sub_grid_size=<NUM_LIT:2>,<EOL>mask_function=None, cosmology=cosmo.Planck15):

super(GalaxyFitPhase, self).__init__(phase_name=phase_name, phase_tagging=phase_tagging,<EOL>phase_folders=phase_folders,<EOL>optimizer_class=optimizer_class, cosmology=cosmology)<EOL>self.use_intensities = use_intensities<EOL>self.use_convergence = use_convergence<EOL>self.use_potential = use_potential<EOL>self.use_deflections = use_deflections<EOL>self.galaxies = galaxies<EOL>self.sub_grid_size = sub_grid_size<EOL>self.mask_function = mask_function<EOL>


def make_analysis(self, data, results=None, mask=None, positions=None):

mask = setup_phase_mask(data=data, mask=mask, mask_function=self.mask_function,<EOL>inner_mask_radii=self.inner_mask_radii)<EOL>if self.positions_threshold is not None and positions is not None:<EOL><INDENT>positions = list(map(lambda position_set: np.asarray(position_set), positions))<EOL><DEDENT>elif self.positions_threshold is None:<EOL><INDENT>positions = None<EOL><DEDENT>elif self.positions_threshold is not None and positions is None:<EOL><INDENT>raise exc.PhaseException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>lens_data = li.LensData(ccd_data=data, mask=mask, sub_grid_size=self.sub_grid_size,<EOL>image_psf_shape=self.image_psf_shape, positions=positions,<EOL>interp_pixel_scale=self.interp_pixel_scale)<EOL>modified_image = self.modify_image(image=lens_data.image, results=results)<EOL>lens_data = lens_data.new_lens_data_with_modified_image(modified_image=modified_image)<EOL>if self.bin_up_factor is not None:<EOL><INDENT>lens_data = lens_data.new_lens_data_with_binned_up_ccd_data_and_mask(bin_up_factor=self.bin_up_factor)<EOL><DEDENT>self.pass_priors(results)<EOL>self.output_phase_info()<EOL>analysis = self.__class__.Analysis(lens_data=lens_data, cosmology=self.cosmology,<EOL>positions_threshold=self.positions_threshold, results=results)<EOL>return analysis<EOL>

Create an lens object. Also calls the prior passing and lens_data modifying functions to allow child
classes to change the behaviour of the phase.

Parameters
----------
positions
mask: Mask
    The default masks passed in by the pipeline
data: im.CCD
    An lens_data that has been masked
results: autofit.tools.pipeline.ResultsCollection
    The result from the previous phase

Returns
-------
lens : Analysis
    An lens object that the non-linear optimizer calls to determine the fit of a set of values


def run(self, galaxy_data, results=None, mask=None):

analysis = self.make_analysis(galaxy_data=galaxy_data, results=results, mask=mask)<EOL>result = self.run_analysis(analysis)<EOL>return self.make_result(result, analysis)<EOL>

Run this phase.

Parameters
----------
galaxy_data
mask: Mask
    The default masks passed in by the pipeline
results: autofit.tools.pipeline.ResultsCollection
    An object describing the results of the last phase or None if no phase has been executed

Returns
-------
result: AbstractPhase.Result
    A result object comprising the best fit model and other hyper.


def __init__(self, phase_name, tag_phases=None, phase_folders=None, lens_galaxies=None, source_galaxies=None,<EOL>sensitive_galaxies=None,<EOL>optimizer_class=non_linear.MultiNest, sub_grid_size=<NUM_LIT:2>, bin_up_factor=None, mask_function=None,<EOL>cosmology=cosmo.Planck15):

super(SensitivityPhase, self).__init__(phase_name=phase_name, tag_phases=tag_phases,<EOL>phase_folders=phase_folders,<EOL>optimizer_class=optimizer_class, sub_grid_size=sub_grid_size,<EOL>bin_up_factor=bin_up_factor, mask_function=mask_function,<EOL>cosmology=cosmology)<EOL>self.lens_galaxies = lens_galaxies or []<EOL>self.source_galaxies = source_galaxies or []<EOL>self.sensitive_galaxies = sensitive_galaxies or []<EOL>


def __init__(self, ccd_data, mask, hyper_model_image, hyper_galaxy_images, hyper_minimum_values, sub_grid_size=<NUM_LIT:2>,<EOL>image_psf_shape=None, inversion_psf_shape=None, positions=None, interp_pixel_scale=None):

super().__init__(ccd_data=ccd_data, mask=mask, sub_grid_size=sub_grid_size, image_psf_shape=image_psf_shape,<EOL>inversion_psf_shape=inversion_psf_shape, positions=positions,<EOL>interp_pixel_scale=interp_pixel_scale)<EOL>self.hyper_model_image = hyper_model_image<EOL>self.hyper_galaxy_images = hyper_galaxy_images<EOL>self.hyper_minimum_values = hyper_minimum_values<EOL>self.hyper_model_image_1d = mask.map_2d_array_to_masked_1d_array(array_2d=hyper_model_image)<EOL>self.hyper_galaxy_images_1d = list(map(lambda hyper_galaxy_image :<EOL>mask.map_2d_array_to_masked_1d_array(hyper_galaxy_image),<EOL>hyper_galaxy_images))<EOL>

The lens data is the collection of data (image, noise-map, PSF), a mask, grid_stack, convolver \
and other utilities that are used for modeling and fitting an image of a strong lens.

Whilst the image, noise-map, etc. are loaded in 2D, the lens data creates reduced 1D arrays of each \
for lensing calculations.

Lens hyper-data includes the hyper-images necessary for changing different aspects of the data that is fitted \
in a Bayesian framework, for example the background-sky subtraction and noise-map.

Parameters
----------
ccd_data: im.CCD
    The ccd data all in 2D (the image, noise-map, PSF, etc.)
mask: msk.Mask
    The 2D mask that is applied to the image.
sub_grid_size : int
    The size of the sub-grid used for each lens SubGrid. E.g. a value of 2 grid_stack each image-pixel on a 2x2 \
    sub-grid.
image_psf_shape : (int, int)
    The shape of the PSF used for convolving model image generated using analytic light profiles. A smaller \
    shape will trim the PSF relative to the input image PSF, giving a faster analysis run-time.
inversion_psf_shape : (int, int)
    The shape of the PSF used for convolving the inversion mapping matrix. A smaller \
    shape will trim the PSF relative to the input image PSF, giving a faster analysis run-time.
positions : [[]]
    Lists of image-pixel coordinates (arc-seconds) that mappers close to one another in the source-plane(s), used \
    to speed up the non-linear sampling.
interp_pixel_scale : float
    If *True*, expensive to compute mass profile deflection angles will be computed on a sparse grid and \
    interpolated to the regular, sub and blurring grids.


def masses_of_galaxies_within_circles_in_units(self, radius : dim.Length, unit_mass='<STR_LIT>',<EOL>critical_surface_density=None):

return list(map(lambda galaxy: galaxy.mass_within_circle_in_units(<EOL>radius=radius, unit_mass=unit_mass, kpc_per_arcsec=self.kpc_per_arcsec,<EOL>critical_surface_density=critical_surface_density),<EOL>self.galaxies))<EOL>

Compute the total mass of all galaxies in this plane within a circle of specified radius.

        See *galaxy.angular_mass_within_circle* and *mass_profiles.angular_mass_within_circle* for details
        of how this is performed.

        Parameters
        ----------
        radius : float
            The radius of the circle to compute the dimensionless mass within.
        units_mass : str
            The units the mass is returned in (angular | solMass).
        critical_surface_density : float
            The critical surface mass density of the strong lens configuration, which converts mass from angulalr \
            units to physical units (e.g. solar masses).


return np.linspace(np.amin(self.grid_stack.regular[:, <NUM_LIT:0>]), np.amax(self.grid_stack.regular[:, <NUM_LIT:0>]), <NUM_LIT:4>)<EOL>

Compute the yticks labels of this grid_stack, used for plotting the y-axis ticks when visualizing an image \


def __init__(self, redshift, galaxies, positions, compute_deflections=True, cosmology=None):

self.redshift = redshift<EOL>self.galaxies = galaxies<EOL>self.positions = positions<EOL>if compute_deflections:<EOL><INDENT>def calculate_deflections(pos):<EOL><INDENT>return sum(map(lambda galaxy: galaxy.deflections_from_grid(pos), galaxies))<EOL><DEDENT>self.deflections = list(map(lambda pos: calculate_deflections(pos), self.positions))<EOL><DEDENT>self.cosmology = cosmology<EOL>

A plane represents a set of galaxies at a given redshift in a ray-tracer_normal and the positions of image-plane \
        coordinates which mappers close to one another in the source-plane.

        Parameters
        -----------
        galaxies : [Galaxy]
            The list of lens galaxies in this plane.
        positions : [[[]]]
            The (y,x) arc-second coordinates of image-plane pixels which (are expected to) mappers to the same
            location(s) in the final source-plane.
        compute_deflections : bool
            If true, the deflection-angles of this plane's coordinates are calculated use its galaxy's mass-profiles.


return list(map(lambda positions, deflections: np.subtract(positions, deflections),<EOL>self.positions, self.deflections))<EOL>


return np.linspace(np.amin(self.grid_stack.regular[:, <NUM_LIT:1>]), np.amax(self.grid_stack.regular[:, <NUM_LIT:1>]), <NUM_LIT:4>)<EOL>

Compute the xticks labels of this grid_stack, used for plotting the x-axis ticks when visualizing an \
        image


def masses_of_galaxies_within_ellipses_in_units(self, major_axis : dim.Length, unit_mass='<STR_LIT>',<EOL>critical_surface_density=None):

return list(map(lambda galaxy: galaxy.mass_within_ellipse_in_units(<EOL>major_axis=major_axis, unit_mass=unit_mass, kpc_per_arcsec=self.kpc_per_arcsec,<EOL>critical_surface_density=critical_surface_density),<EOL>self.galaxies))<EOL>

Compute the total mass of all galaxies in this plane within a ellipse of specified major-axis.

        See *galaxy.angular_mass_within_ellipse* and *mass_profiles.angular_mass_within_ellipse* for details \
        of how this is performed.

        Parameters
        ----------
        major_axis : float
            The major-axis radius of the ellipse.
        units_luminosity : str
            The units the luminosity is returned in (eps | counts).
        exposure_time : float
            The exposure time of the observation, which converts luminosity from electrons per second units to counts.


def __init__(self, plane_redshifts, cosmology):

self.plane_redshifts = plane_redshifts<EOL>self.cosmology = cosmology<EOL>

Abstract Ray tracer for lens systems with any number of planes.

        From the galaxies of the tracer's planes, their grid-stack(s) and the cosmology physically derived quantities \
        (e.g. surface density, angular diameter distances, critical surface densities) can be computed.

        Parameters
        ----------
        plane_redshifts : [pl.Plane] or [pl.PlaneStack]
            The list of the tracer's planes in ascending redshift order.
        cosmology : astropy.cosmology
            The cosmology of the ray-tracing calculation.


@wraps(func)<EOL>def wrapper(self):<EOL><INDENT>"""<STR_LIT>"""<EOL>if self.has_mass_profile is True:<EOL><INDENT>return func(self)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>return wrapper<EOL>

If none of the tracer's galaxies have a mass profile, it surface density, potential and deflections cannot \
    be computed. This wrapper makes these properties return *None*.

    Parameters
    ----------
    func : (self) -> Object
        A property function that requires galaxies to have a mass profile.


def __init__(self, galaxies, image_plane_grid_stack, border=None, cosmology=cosmo.Planck15):

plane_redshifts = lens_util.ordered_plane_redshifts_from_galaxies(galaxies=galaxies)<EOL>galaxies_in_planes =lens_util.galaxies_in_redshift_ordered_planes_from_galaxies(galaxies=galaxies,<EOL>plane_redshifts=plane_redshifts)<EOL>image_plane_grid_stack = pix.setup_image_plane_pixelization_grid_from_galaxies_and_grid_stack(<EOL>galaxies=galaxies, grid_stack=image_plane_grid_stack)<EOL>planes = []<EOL>for plane_index in range(<NUM_LIT:0>, len(plane_redshifts)):<EOL><INDENT>compute_deflections = lens_util.compute_deflections_at_next_plane(plane_index=plane_index,<EOL>total_planes=len(plane_redshifts))<EOL>new_grid_stack = image_plane_grid_stack<EOL>if plane_index > <NUM_LIT:0>:<EOL><INDENT>for previous_plane_index in range(plane_index):<EOL><INDENT>scaling_factor = cosmology_util.scaling_factor_between_redshifts_from_redshifts_and_cosmology(<EOL>redshift_0=plane_redshifts[previous_plane_index], redshift_1=plane_redshifts[plane_index],<EOL>redshift_final=plane_redshifts[-<NUM_LIT:1>], cosmology=cosmology)<EOL>scaled_deflection_stack = lens_util.scaled_deflection_stack_from_plane_and_scaling_factor(<EOL>plane=planes[previous_plane_index], scaling_factor=scaling_factor)<EOL>new_grid_stack =lens_util.grid_stack_from_deflection_stack(grid_stack=new_grid_stack,<EOL>deflection_stack=scaled_deflection_stack)<EOL><DEDENT><DEDENT>planes.append(pl.Plane(galaxies=galaxies_in_planes[plane_index], grid_stack=new_grid_stack,<EOL>border=border, compute_deflections=compute_deflections, cosmology=cosmology))<EOL><DEDENT>super(TracerMultiPlanes, self).__init__(planes=planes, cosmology=cosmology)<EOL>

Ray-tracer for a lens system with any number of planes.

        The redshift of these planes are specified by the redshits of the galaxies; there is a unique plane redshift \
        for every unique galaxy redshift (galaxies with identical redshifts are put in the same plane).

        To perform multi-plane ray-tracing, a cosmology must be supplied so that deflection-angles can be rescaled \
        according to the lens-geometry of the multi-plane system. All galaxies input to the tracer must therefore \
        have redshifts.

        This tracer has only one grid-stack (see grid_stack.GridStack) which is used for ray-tracing.

        Parameters
        ----------
        galaxies : [Galaxy]
            The list of galaxies in the ray-tracing calculation.
        image_plane_grid_stack : grid_stacks.GridStack
            The image-plane grid stack which is traced. (includes the regular-grid, sub-grid, blurring-grid, etc.).
        border : masks.RegularGridBorder
            The border of the regular-grid, which is used to relocate demagnified traced pixels to the \
            source-plane borders.
        cosmology : astropy.cosmology
            The cosmology of the ray-tracing calculation.


def __init__(self, lens_galaxies, image_plane_positions, cosmology=cosmo.Planck15):

image_plane = pl.PlanePositions(redshift=lens_galaxies[<NUM_LIT:0>].redshift, galaxies=lens_galaxies,<EOL>positions=image_plane_positions, compute_deflections=True, cosmology=cosmology)<EOL>source_plane_positions = image_plane.trace_to_next_plane()<EOL>source_plane = pl.PlanePositions(redshift=None, galaxies=None, positions=source_plane_positions,<EOL>compute_deflections=False, cosmology=cosmology)<EOL>super(TracerImageSourcePlanesPositions, self).__init__(planes=[image_plane, source_plane], cosmology=cosmology)<EOL>

Positional ray-tracer for a lens system with two planes, an image-plane and source-plane (source-plane \
        galaxies are not input for the positional ray-tracer, as it is only the proximity that image_plane_positions \
        trace to within one another that needs to be computed).

        By default, this has no associated cosmology, thus all calculations are performed in arc seconds and galaxies \
        do not need input redshifts. If a cosmology is supplied, the plane's angular diameter distances, \
        conversion factors, etc. are used to provide quantities in kpc.

        Parameters
        ----------
        lens_galaxies : [Galaxy]
            The list of lens galaxies in the image-plane.
        image_plane_positions : [[[]]]
            The (y,x) arc-second coordinates of image-plane pixels which (are expected to) mappers to the same \
            location(s) in the source-plane.
        cosmology : astropy.cosmology.Planck15
            The cosmology of the ray-tracing calculation.


def __init__(self, lens_galaxies, image_plane_grid_stack, border=None, cosmology=cosmo.Planck15,<EOL>units_distance='<STR_LIT>', units_luminosity='<STR_LIT>', units_mass='<STR_LIT>'):

if not lens_galaxies:<EOL><INDENT>raise exc.RayTracingException('<STR_LIT>')<EOL><DEDENT>image_plane = pl.Plane(galaxies=lens_galaxies, grid_stack=image_plane_grid_stack, border=border,<EOL>compute_deflections=True, cosmology=cosmology)<EOL>super(TracerImagePlane, self).__init__(planes=[image_plane], cosmology=cosmology)<EOL>

Ray tracer for a lens system with just an image-plane.

        As there is only 1 plane, there are no ray-tracing calculations. This class is therefore only used for fitting \
        image-plane galaxies with light profiles.

        This tracer has only one grid-stack (see grid_stack.GridStack) which is used for ray-tracing.

        Parameters
        ----------
        lens_galaxies : [Galaxy]
            The list of lens galaxies in the image-plane.
        image_plane_grid_stack : grid_stacks.GridStack
            The image-plane grid stack which is traced. (includes the regular-grid, sub-grid, blurring-grid, etc.).
        border : masks.RegularGridBorder
            The border of the regular-grid, which is used to relocate demagnified traced pixels to the \
            source-plane borders.
        cosmology : astropy.cosmology
            The cosmology of the ray-tracing calculation.