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.


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.


if self.__class__.__name__.startswith("<STR_LIT>"):<EOL><INDENT>return super().transform_grid_from_reference_frame(grid)<EOL><DEDENT>y = np.add(np.add(np.multiply(grid[:, <NUM_LIT:1>], self.sin_phi), np.multiply(grid[:, <NUM_LIT:0>], self.cos_phi)), self.centre[<NUM_LIT:0>])<EOL>x = np.add(np.add(np.multiply(grid[:, <NUM_LIT:1>], self.cos_phi), - np.multiply(grid[:, <NUM_LIT:0>], self.sin_phi)),<EOL>self.centre[<NUM_LIT:1>])<EOL>return np.vstack((y, x)).T<EOL>

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

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


raise NotImplementedError("<STR_LIT>")<EOL>

Abstract method for obtaining intensity at on a grid of radii.

Parameters
----------
grid_radii : float
    The radial distance from the centre of the profile. for each coordinate on the grid.


def intensities_from_grid(self, grid, grid_radial_minimum=None):

Abstract method for obtaining intensity at a grid of Cartesian (y,x) coordinates.

Parameters
----------
grid : ndarray
    The (y, x) coordinates in the original reference frame of the grid.
Returns
-------
intensity : ndarray
    The value of intensity at the given radius


@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(EllipticalLightProfile, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>

Abstract class for an elliptical 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
            Rotational angle of profiles ellipse counter-clockwise from positive x-axis


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


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>axis_ratio: float = <NUM_LIT:1.0>,<EOL>phi: float = <NUM_LIT:0.0>,<EOL>intensity: dim.Luminosity = <NUM_LIT:0.1>,<EOL>sigma: dim.Length = <NUM_LIT>):<DEDENT>

super(EllipticalGaussian, self).__init__(centre=centre, axis_ratio=axis_ratio, phi=phi)<EOL>self.intensity = intensity<EOL>self.sigma = sigma<EOL>

The elliptical Gaussian 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).
        sigma : float
            The full-width half-maximum of the Gaussian.


return np.multiply(np.divide(self.intensity, self.sigma * np.sqrt(<NUM_LIT> * np.pi)),<EOL>np.exp(-<NUM_LIT:0.5> * np.square(np.divide(grid_radii, self.sigma))))<EOL>

Calculate the intensity of the Gaussian light profile on a grid of radial coordinates.

        Parameters
        ----------
        grid_radii : float
            The radial distance from the centre of the profile. for each coordinate on the grid.


return self.intensities_from_grid_radii(self.grid_to_elliptical_radii(grid))<EOL>

Calculate the intensity of the light profile on a grid of Cartesian (y,x) coordinates.

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

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


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


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


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.


return (<NUM_LIT:2> * self.sersic_index) - (<NUM_LIT:1.> / <NUM_LIT>) + (<NUM_LIT> / (<NUM_LIT> * self.sersic_index)) + (<EOL><NUM_LIT> / (<NUM_LIT> * self.sersic_index ** <NUM_LIT:2>)) + (<NUM_LIT> / (<NUM_LIT> * self.sersic_index ** <NUM_LIT:3>)) - (<EOL><NUM_LIT> / (<NUM_LIT> * self.sersic_index ** <NUM_LIT:4>))<EOL>

A parameter derived from Sersic index which ensures that effective radius contains 50% of the profile's
        total integrated light.


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.


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


np.seterr(all='<STR_LIT:ignore>')<EOL>return np.multiply(self.intensity, np.exp(<EOL>np.multiply(-self.sersic_constant,<EOL>np.add(np.power(np.divide(grid_radii, self.effective_radius), <NUM_LIT:1.> / self.sersic_index), -<NUM_LIT:1>))))<EOL>

Calculate the intensity of the Sersic light profile on a grid of radial coordinates.

Parameters
----------
grid_radii : float
    The radial distance from the centre of the profile. for each coordinate on the grid.


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

Calculate the intensity of the light profile on a grid of Cartesian (y,x) coordinates.

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

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


@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>):<DEDENT>

super(SphericalSersic, 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>

The spherical 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 light profile.


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


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


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.


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


return self.intensity_break * (<NUM_LIT> ** (-self.gamma / self.alpha)) * np.exp(<EOL>self.sersic_constant * (((<NUM_LIT> ** (<NUM_LIT:1.0> / self.alpha)) * self.radius_break) / self.effective_radius) ** (<EOL><NUM_LIT:1.0> / self.sersic_index))<EOL>

Overall intensity normalisation in the rescaled Core-Sersic light profiles (electrons per second)


return np.multiply(np.multiply(self.intensity_prime, np.power(<EOL>np.add(<NUM_LIT:1>, np.power(np.divide(self.radius_break, grid_radii), self.alpha)), (self.gamma / self.alpha))),<EOL>np.exp(np.multiply(-self.sersic_constant,<EOL>(np.power(np.divide(np.add(np.power(grid_radii, self.alpha), (<EOL>self.radius_break ** self.alpha)),<EOL>(self.effective_radius ** self.alpha)), (<EOL><NUM_LIT:1.0> / (self.alpha * self.sersic_index)))))))<EOL>

Calculate the intensity of the cored-Sersic light profile on a grid of radial coordinates.

        Parameters
        ----------
        grid_radii : float
            The radial distance from the centre of the profile. for each coordinate on the grid.


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


def __init__(self, image, noise_map, pixel_scale):

self.image = image<EOL>self.noise_map = noise_map<EOL>self.pixel_scale = pixel_scale<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. convergence \
        , 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
        ----------
        image : scaled_array.ScaledSquarePixelArray
            An image of the quantity of the galaxy that is being fitted (e.g. its intensities, convergence, etc.).
        noise_map : scaled_array.ScaledSquarePixelArray
            The noise_map-map used for computing the likelihood of each fit. This can be chosen arbritarily.


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


def __init__(self, redshift=None, pixelization=None, regularization=None, hyper_galaxy=None, **kwargs):

self.redshift = redshift<EOL>for name, val in kwargs.items():<EOL><INDENT>setattr(self, name, val)<EOL><DEDENT>self.pixelization = pixelization<EOL>self.regularization = regularization<EOL>if self.has_pixelization and not self.has_regularization:<EOL><INDENT>raise exc.GalaxyException('<STR_LIT>')<EOL><DEDENT>if not self.has_pixelization and self.has_regularization:<EOL><INDENT>raise exc.GalaxyException('<STR_LIT>')<EOL><DEDENT>self.hyper_galaxy = hyper_galaxy<EOL>

Class representing a galaxy, which is composed of attributes used for fitting hyper (e.g. light profiles, \
        mass profiles, pixelizations, etc.).

        All *has_* methods retun *True* if galaxy has that attribute, *False* if not.

        Parameters
        ----------
        redshift: float
            The redshift of the galaxy.
        light_profiles: [lp.LightProfile]
            A list of the galaxy's light profiles.
        mass_profiles: [mp.MassProfile]
            A list of the galaxy's mass profiles.
        hyper_galaxy : HyperGalaxy
            The hyper-parameters of the hyper-galaxy, which is used for performing a hyper-analysis on the noise-map.

        Attributes
        ----------
        pixelization : inversion.Pixelization
            The pixelization of the galaxy used to reconstruct an observed image using an inversion.
        regularization : inversion.Regularization
            The regularization of the pixel-grid used to reconstruct an observed regular using an inversion.


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

Calculate the summed intensities of all of the galaxy's light profiles using a grid of Cartesian (y,x) \
        coordinates.

        If the galaxy has no light profiles, a grid of zeros is returned.

        See *profiles.light_profiles* for a description of how light profile intensities are computed.

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


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

if self.has_light_profile:<EOL><INDENT>return sum(map(lambda p: p.luminosity_within_circle_in_units(radius=radius, unit_luminosity=unit_luminosity,<EOL>kpc_per_arcsec=kpc_per_arcsec, exposure_time=exposure_time),<EOL>self.light_profiles))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Compute the total luminosity of the galaxy's light profiles within a circle of specified radius.

        See *light_profiles.luminosity_within_circle* for details of how this is performed.

        Parameters
        ----------
        radius : float
            The radius of the circle to compute the dimensionless mass within.
        unit_luminosity : 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 luminosity_within_ellipse_in_units(self, major_axis : dim.Length, unit_luminosity='<STR_LIT>', kpc_per_arcsec=None, exposure_time=None):

if self.has_light_profile:<EOL><INDENT>return sum(map(lambda p: p.luminosity_within_ellipse_in_units(major_axis=major_axis, unit_luminosity=unit_luminosity,<EOL>kpc_per_arcsec=kpc_per_arcsec, exposure_time=exposure_time),<EOL>self.light_profiles))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Compute the total luminosity of the galaxy's light profiles, within an ellipse of specified major axis. This
        is performed via integration of each light profile and is centred, oriented and aligned with each light
        model's individual geometry.

        See *light_profiles.luminosity_within_ellipse* for details of how this is performed.

        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
            The exposure time of the observation, which converts luminosity from electrons per second units to counts.


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.


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

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

        If the galaxy has no mass profiles, a grid of zeros is returned.

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

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


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 mass_within_circle_in_units(self, radius, unit_mass='<STR_LIT>', kpc_per_arcsec=None, critical_surface_density=None):

if self.has_mass_profile:<EOL><INDENT>return sum(map(lambda p: p.mass_within_circle_in_units(radius=radius, unit_mass=unit_mass,<EOL>kpc_per_arcsec=kpc_per_arcsec,<EOL>critical_surface_density=critical_surface_density),<EOL>self.mass_profiles))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Compute the total angular mass of the galaxy's mass profiles within a circle of specified radius.

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

        Parameters
        ----------
        radius : float
            The radius of the circle to compute the dimensionless mass within.
        unit_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).


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

if self.has_mass_profile:<EOL><INDENT>return sum(map(lambda p: p.mass_within_ellipse_in_units(major_axis=major_axis, unit_mass=unit_mass,<EOL>kpc_per_arcsec=kpc_per_arcsec,<EOL>critical_surface_density=critical_surface_density),<EOL>self.mass_profiles))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Compute the total angular mass of the galaxy's mass profiles within an ellipse of specified major_axis.

        See *profiles.mass_profiles.angualr_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 einstein_radius_in_units(self, unit_length='<STR_LIT>', kpc_per_arcsec=None):

if self.has_mass_profile:<EOL><INDENT>return sum(map(lambda p: p.einstein_radius_in_units(unit_length=unit_length, kpc_per_arcsec=kpc_per_arcsec),<EOL>self.mass_profiles))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

The Einstein Radius of this galaxy, which is the sum of Einstein Radii of its mass profiles.

        If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Radius \
        may be inaccurate. This is because the differently oriented ellipses of each mass profile


def einstein_mass_in_units(self, unit_mass='<STR_LIT>', critical_surface_density=None):

if self.has_mass_profile:<EOL><INDENT>return sum(<EOL>map(lambda p: p.einstein_mass_in_units(unit_mass=unit_mass,<EOL>critical_surface_density=critical_surface_density),<EOL>self.mass_profiles))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

The Einstein Mass of this galaxy, which is the sum of Einstein Radii of its mass profiles.

        If the galaxy is composed of multiple ellipitcal profiles with different axis-ratios, this Einstein Mass \
        may be inaccurate. This is because the differently oriented ellipses of each mass profile


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.


def contributions_from_model_image_and_galaxy_image(self, model_image, galaxy_image, minimum_value=<NUM_LIT:0.0>):

contributions = np.divide(galaxy_image, np.add(model_image, self.contribution_factor))<EOL>contributions = np.divide(contributions, np.max(contributions))<EOL>contributions[contributions < minimum_value] = <NUM_LIT:0.0><EOL>return contributions<EOL>

Compute the contribution map of a galaxy, which represents the fraction of flux in each pixel that the \
        galaxy is attributed to contain, scaled to the *contribution_factor* hyper-parameter.

        This is computed by dividing that galaxy's flux by the total flux in that pixel, and then scaling by the \
        maximum flux such that the contribution map ranges between 0 and 1.

        Parameters
        -----------
        model_image : ndarray
            The best-fit model image to the observed image from a previous analysis phase. This provides the \
            total light attributed to each image pixel by the model.
        galaxy_image : ndarray
            A model image of the galaxy (from light profiles or an inversion) from a previous analysis phase.
        minimum_value : float
            The minimum contribution value a pixel must contain to not be rounded to 0.


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 galaxies:<EOL><INDENT>return sum(map(lambda g: g.intensities_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 intensities of a list of galaxies from an input grid, by summing the individual intensities \
    of each galaxy's light profile.

    If the input grid is a *grids.SubGrid*, the intensites 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 \
        intensities are calculated on.
    galaxies : [galaxy.Galaxy]
        The galaxies whose light profiles are used to compute the surface densities.


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 g: g.potential_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 potential of a list of galaxies from an input grid, by summing the individual potential \
    of each galaxy's mass profile.

    If the input grid is a *grids.SubGrid*, the surface-density 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 \
        potential 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.


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.


def plot_intensities(<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>'):

intensities = galaxy.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 datas) 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 intensities are 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)


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_deflections_y(<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>'):

deflections = galaxy.deflections_from_grid(grid)<EOL>deflections_y = grid.scaled_array_2d_from_array_1d(deflections[:, <NUM_LIT:0>])<EOL>array_plotters.plot_array(<EOL>array=deflections_y, 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 y component of the deflection angles 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 y deflecton angles are 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_deflections_x(<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>'):

deflections = galaxy.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 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 x deflecton angles are 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 __init__(self, galaxy_data, model_galaxies):

self.galaxy_data = galaxy_data<EOL>self.model_galaxies = model_galaxies<EOL>model_data_1d = galaxy_data.profile_quantity_from_galaxy_and_sub_grid(galaxies=model_galaxies,<EOL>sub_grid=galaxy_data.grid_stack.sub)<EOL>super(GalaxyFit, self).__init__(data=galaxy_data.image, noise_map=galaxy_data.noise_map,<EOL>mask=galaxy_data.mask,<EOL>model_data=galaxy_data.map_to_scaled_array(array_1d=model_data_1d))<EOL>

Class which fits a set of galaxy-datas to a model galaxy, using either the galaxy's intensities, \
        surface-density or potential.

        Parameters
        ----------
        galaxy_data : GalaxyData
            The galaxy-datas object being fitted.
        model_galaxies : galaxy.Galaxy
            The model galaxy used to fit the galaxy-datas.


return inspect.isclass(cls) and issubclass(cls, light_profiles.LightProfile)<EOL>

Parameters
----------
cls
    Some object

Returns
-------
bool: is_light_profile_class
    True if cls is a class that inherits from light profile


return inspect.isclass(cls) and issubclass(cls, mass_profiles.MassProfile)<EOL>

Parameters
----------
cls
    Some object

Returns
-------
bool: is_mass_profile_class
    True if cls is a class that inherits from mass profile


return is_light_profile_class(cls) or is_mass_profile_class(cls)<EOL>

Parameters
----------
cls
    Some object

Returns
-------
bool: is_mass_profile_class
    True if cls is a class that inherits from light profile or mass profile


def __init__(self, align_centres=False, align_axis_ratios=False, align_orientations=False, redshift=None,<EOL>pixelization=None, regularization=None, hyper_galaxy=None, **kwargs):

super().__init__()<EOL>self.align_centres = align_centres<EOL>self.align_axis_ratios = align_axis_ratios<EOL>self.align_orientations = align_orientations<EOL>profile_models = []<EOL>for name, cls in kwargs.items():<EOL><INDENT>if is_mass_profile_class(cls) or is_light_profile_class(cls):<EOL><INDENT>model = pm.PriorModel(cls)<EOL>profile_models.append(model)<EOL>setattr(self, name, model)<EOL><DEDENT>else:<EOL><INDENT>setattr(self, name, cls)<EOL><DEDENT><DEDENT>if len(profile_models) > <NUM_LIT:0>:<EOL><INDENT>if self.align_centres:<EOL><INDENT>centre = profile_models[<NUM_LIT:0>].centre<EOL>for profile_model in profile_models:<EOL><INDENT>profile_model.centre = centre<EOL><DEDENT><DEDENT>if self.align_axis_ratios:<EOL><INDENT>axis_ratio = profile_models[<NUM_LIT:0>].axis_ratio<EOL>for profile_model in profile_models:<EOL><INDENT>profile_model.axis_ratio = axis_ratio<EOL><DEDENT><DEDENT>if self.align_orientations:<EOL><INDENT>phi = profile_models[<NUM_LIT:0>].phi<EOL>for profile_model in profile_models:<EOL><INDENT>profile_model.phi = phi<EOL><DEDENT><DEDENT><DEDENT>self.redshift = pm.PriorModel(redshift) if inspect.isclass(redshift) else redshift<EOL>if pixelization is not None and regularization is None:<EOL><INDENT>raise exc.PriorException('<STR_LIT>')<EOL><DEDENT>if pixelization is None and regularization is not None:<EOL><INDENT>raise exc.PriorException('<STR_LIT>')<EOL><DEDENT>self.pixelization = pm.PriorModel(pixelization) if inspect.isclass(<EOL>pixelization) else pixelization<EOL>self.regularization = pm.PriorModel(regularization) if inspect.isclass(<EOL>regularization) else regularization<EOL>self.hyper_galaxy = pm.PriorModel(hyper_galaxy) if inspect.isclass(hyper_galaxy) else hyper_galaxy<EOL>

Class to produce Galaxy instances from sets of profile classes and other model-fitting attributes (e.g. \
         pixelizations, regularization schemes, hyper-galaxyes) using the model mapper.

        Parameters
        ----------
        light_profile_classes: [LightProfile]
            The *LightProfile* classes for which model light profile instances are generated for this galaxy model.
        mass_profile_classes: [MassProfile]
            The *MassProfile* classes for which model mass profile instances are generated for this galaxy model.
        align_centres : bool
            If *True*, the same prior will be used for all the profiles centres, such that all light and / or mass \
            profiles always share the same origin.
        align_axis_ratios : bool
            If *True*, the same prior will be used for all the profiles axis-ratio, such that all light and / or mass \
            profiles always share the same axis-ratio.
        align_orientations : bool
            If *True*, the same prior will be used for all the profiles rotation angles phi, such that all light \
            and / or mass profiles always share the same orientation.
        redshift : float | Type[g.Redshift]
            The redshift of this model galaxy.
        variable_redshift : bool
            If *True*, the galaxy redshift will be treated as a free-parameter that is fitted for by the non-linear \
            search.
        pixelization : Pixelization
            The pixelization used to reconstruct the galaxy light and fit the observed regular if using an inversion.
        regularization : Regularization
            The regularization-scheme used to regularization reconstruct the galaxy light when fitting the observed \
            regular if using an inversion.
        hyper_galaxy : HyperGalaxy
            A model hyper-galaxy used for scaling the observed regular's noise_map.


return [value for value in self.__dict__.values() if galaxy.is_light_profile(value)]<EOL>

Returns
-------
light_profiles: [light_profiles.LightProfile]
    Light profiles with set variables


return [value for value in self.__dict__.values() if galaxy.is_mass_profile(value)]<EOL>

Returns
-------
mass_profiles: [mass_profiles.MassProfile]
    Mass profiles with set variables


return [value for _, value in<EOL>filter(lambda t: isinstance(t[<NUM_LIT:1>], pm.PriorModel), self.__dict__.items())]<EOL>

Returns
-------
prior_models: [model_mapper.PriorModel]
    A list of the prior models (e.g. variable profiles) attached to 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.


return {key: value for key, value in self.__dict__.items() if<EOL>galaxy.is_light_profile(value) or galaxy.is_mass_profile(value)}<EOL>

Returns
-------
constant_profile_dict: {str: geometry_profiles.GeometryProfile}
    A dictionary mapping_matrix instance variable names to profiles with set variables.


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 [constant for prior_model in self.prior_models for constant in prior_model.constant_tuples]<EOL>

Returns
-------
constant: [ConstantTuple]
    A list of constants associated with prior models in this galaxy prior.


return {prior: cls for prior_model in self.prior_models for prior, cls in<EOL>prior_model.prior_class_dict.items()}<EOL>

Returns
-------
prior_class_dict: {Prior: class}
    A dictionary mapping_matrix priors to the class associated with their prior model.


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


new_model = copy.deepcopy(self)<EOL>for key, value in filter(lambda t: isinstance(t[<NUM_LIT:1>], pm.PriorModel), self.__dict__.items()):<EOL><INDENT>setattr(new_model, key, value.gaussian_prior_model_for_arguments(arguments))<EOL><DEDENT>return new_model<EOL>

Create a new galaxy prior from a set of arguments, replacing the priors of some of this galaxy prior's prior
models with new arguments.

Parameters
----------
arguments: dict
    A dictionary mapping_matrix between old priors and their replacements.

Returns
-------
new_model: GalaxyModel
    A model with some or all priors replaced.


@classmethod<EOL><INDENT>def from_galaxy(cls, g, **kwargs):<DEDENT>

return GalaxyModel(**{**g.__dict__, **kwargs})<EOL>

Create a new galaxy prior with constants taken from a galaxy.

Parameters
----------
g: galaxy.Galaxy
    A galaxy
kwargs
    Key word arguments to override GalaxyModel constructor arguments.


def __init__(self, background_sky_scale=<NUM_LIT:0.0>, background_noise_scale=<NUM_LIT:0.0>):

self.background_sky_scale = background_sky_scale<EOL>self.background_noise_scale = background_noise_scale<EOL>

Class for scaling the background sky map and background noise_map-map of an regular.

        Parameters
        -----------
        background_sky_scale : float
            The value by which the background scale is increased or decreased (electrons per second).
        background_noise_scale : float
            The factor by which the background noise_maps is increased.


return image + self.background_sky_scale<EOL>

Compute a new regular with the background sky level scaled. This can simply multiple by a constant factor \
        (assuming a uniform background sky) because the regular is in units electrons per second.

        Parameters
        -----------
        image : ndarray
            The regular before scaling (electrons per second).


def hyper_noise_from_background_noise(self, noise, background_noise):

return noise + (self.background_noise_scale * background_noise)<EOL>

Compute a scaled noise_maps regular from the background noise_maps regular.

        Parameters
        -----------
        noise : ndarray
            The noise_maps before scaling (electrons per second).
        background_noise : ndarray
            The background noise_maps values (electrons per second).


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

Generate a positions threshold tag, to customize phase names based on the threshold that positions are required \
    to trace within one another.

    This changes the phase name 'phase_name' as follows:

    positions_threshold = 1 -> phase_name
    positions_threshold = 2 -> phase_name_positions_threshold_2
    positions_threshold = 2 -> phase_name_positions_threshold_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 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


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

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

    This changes the phase name 'phase_name' as follows:

    inversion_psf_shape = 1 -> phase_name
    inversion_psf_shape = 2 -> phase_name_inversion_psf_shape_2
    inversion_psf_shape = 2 -> phase_name_inversion_psf_shape_2


if bin_up_factor == <NUM_LIT:1> or bin_up_factor is None:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>' + str(bin_up_factor)<EOL><DEDENT>

Generate a bin up tag, to customize phase names based on the resolutioon the image is binned up by for faster \
    run times.

    This changes the phase name 'phase_name' as follows:

    bin_up_factor = 1 -> phase_name
    bin_up_factor = 2 -> phase_name_bin_up_factor_2
    bin_up_factor = 2 -> phase_name_bin_up_factor_2


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

Generate an interpolation pixel scale tag, to customize phase names based on the resolution of the interpolation \
    grid that deflection angles are computed on before interpolating to the regular and sub grids.

    This changes the phase name 'phase_name' as follows:

    interp_pixel_scale = 1 -> phase_name
    interp_pixel_scale = 2 -> phase_name_interp_pixel_scale_2
    interp_pixel_scale = 2 -> phase_name_interp_pixel_scale_2


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


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 not align_bulge_disk_axis_ratio:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif align_bulge_disk_axis_ratio:<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_axis_ratio = False -> phase_name
    bd_align_axis_ratio = True -> phase_name_bd_align_axis_ratio


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


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


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


return self.optimizer.variable<EOL>

Convenience method

Returns
-------
ModelInstance
    A model instance comprising all the constant objects in this lens


return self.optimizer.variable<EOL>

Convenience method

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


return []<EOL>

Returns
-------
phase_property_collections: [PhaseProperty]
    A list of phase property collections associated with this phase. This is used in automated prior passing and
    should be overridden for any phase that contains its own PhasePropertys.


pass<EOL>

Perform any prior or constant passing. This could involve setting model attributes equal to priors or constants
from a previous phase.

Parameters
----------
results: autofit.tools.pipeline.ResultsCollection
    The result of the previous phase


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 make_analysis(self, positions, pixel_scale, results=None):

self.pass_priors(results)<EOL>analysis = self.__class__.Analysis(positions=positions, pixel_scale=pixel_scale, cosmology=self.cosmology,<EOL>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
----------
pixel_scale
positions
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 __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)


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

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

Run this phase.

Parameters
----------
positions
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
data: scaled_array.ScaledSquarePixelArray
    An lens_data that has been masked

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


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 __init__(self, phase_name, tag_phases=True, phase_folders=None,<EOL>lens_galaxies=None, source_galaxies=None, 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>interp_pixel_scale=None, inner_mask_radii=None, cosmology=cosmo.Planck15,<EOL>auto_link_priors=False):

A phase with a simple source/lens model

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


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


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


pipeline_dict[module.pipeline_name] = PipelineTuple(module)<EOL>

Parameters
----------
module: {analysis_path, make}


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

self.ccd_data = ccd_data<EOL>self.image = ccd_data.image<EOL>self.noise_map = ccd_data.noise_map<EOL>self.pixel_scale = ccd_data.pixel_scale<EOL>self.psf = ccd_data.psf<EOL>self.mask = mask<EOL>self.image_1d = mask.map_2d_array_to_masked_1d_array(array_2d=ccd_data.image)<EOL>self.noise_map_1d = mask.map_2d_array_to_masked_1d_array(array_2d=ccd_data.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>if image_psf_shape is None:<EOL><INDENT>self.image_psf_shape = self.psf.shape<EOL><DEDENT>else:<EOL><INDENT>self.image_psf_shape = image_psf_shape<EOL><DEDENT>self.convolver_image = convolution.ConvolverImage(mask=self.mask,<EOL>blurring_mask=mask.blurring_mask_for_psf_shape(psf_shape=self.image_psf_shape),<EOL>psf=self.psf.resized_scaled_array_from_array(new_shape=self.image_psf_shape))<EOL>if inversion_psf_shape is None:<EOL><INDENT>self.inversion_psf_shape = self.psf.shape<EOL><DEDENT>else:<EOL><INDENT>self.inversion_psf_shape = inversion_psf_shape<EOL><DEDENT>self.convolver_mapping_matrix = inversion_convolution.ConvolverMappingMatrix(<EOL>self.mask, self.psf.resized_scaled_array_from_array(new_shape=self.inversion_psf_shape))<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, psf_shape=self.image_psf_shape)<EOL>self.padded_grid_stack = grids.GridStack.padded_grid_stack_from_mask_sub_grid_size_and_psf_shape(mask=mask,<EOL>sub_grid_size=sub_grid_size, psf_shape=self.image_psf_shape)<EOL>self.interp_pixel_scale = interp_pixel_scale<EOL>if interp_pixel_scale is not None:<EOL><INDENT>self.grid_stack = self.grid_stack.new_grid_stack_with_interpolator_added_to_each_grid(<EOL>interp_pixel_scale=interp_pixel_scale)<EOL>self.padded_grid_stack = self.padded_grid_stack.new_grid_stack_with_interpolator_added_to_each_grid(<EOL>interp_pixel_scale=interp_pixel_scale)<EOL><DEDENT>self.border = grids.RegularGridBorder.from_mask(mask=mask)<EOL>self.positions = positions<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.

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 __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 __init__(self, redshift, galaxies, cosmology=cosmo.Planck15):

self.redshift = redshift<EOL>self.galaxies = galaxies<EOL>self.cosmology = cosmology<EOL>

An abstract plane which represents a set of galaxies that are close to one another in redshift-space.

        From an abstract plane, cosmological quantities like angular diameter distances can be computed. If the  \
        redshift of the plane is input as *None*, quantities that depend on a redshift are returned as *None*.

        Parameters
        -----------
        redshift : float or None
            The redshift of the plane.
        galaxies : [Galaxy]
            The list of galaxies in this plane.
        cosmology : astropy.cosmology
            The cosmology associated with the plane, used to convert arc-second coordinates to physical values.


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

return list(map(lambda galaxy: galaxy.luminosity_within_circle_in_units(<EOL>radius=radius, unit_luminosity=unit_luminosity, kpc_per_arcsec=self.kpc_per_arcsec,<EOL>exposure_time=exposure_time),<EOL>self.galaxies))<EOL>

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

        See *galaxy.light_within_circle* and *light_profiles.light_within_circle* for details \
        of how this is performed.

        Parameters
        ----------
        radius : float
            The radius of the circle to compute the dimensionless mass within.
        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 luminosities_of_galaxies_within_ellipses_in_units(self, major_axis : dim.Length, unit_luminosity='<STR_LIT>',<EOL>exposure_time=None):

return list(map(lambda galaxy: galaxy.luminosity_within_ellipse_in_units(<EOL>major_axis=major_axis, unit_luminosity=unit_luminosity, kpc_per_arcsec=self.kpc_per_arcsec,<EOL>exposure_time=exposure_time),<EOL>self.galaxies))<EOL>

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

The value returned by this integral is dimensionless, and a conversion factor can be specified to convert it \
to a physical value (e.g. the photometric zeropoint).

See *galaxy.light_within_ellipse* and *light_profiles.light_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 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).


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.