INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Integrate the mass profiles s convergence profile to compute the total mass within a circle of \ specified radius. This is centred on the mass profile. | def mass_within_circle_in_units(self, radius: dim.Length, unit_mass='angular', kpc_per_arcsec=None,
critical_surface_density=None):
""" Integrate the mass profiles's convergence profile to compute the total mass within a circle of \
specified radius. This is centred o... |
Integrate the mass profiles s convergence profile to compute the total angular mass within an ellipse of \ specified major axis. This is centred on the mass profile. | def mass_within_ellipse_in_units(self, major_axis, unit_mass='angular', kpc_per_arcsec=None,
critical_surface_density=None):
""" Integrate the mass profiles's convergence profile to compute the total angular mass within an ellipse of \
specified major axis. This is c... |
Routine to integrate an elliptical light profiles - set axis ratio to 1 to compute the luminosity within a \ circle | def mass_integral(self, x, axis_ratio):
"""Routine to integrate an elliptical light profiles - set axis ratio to 1 to compute the luminosity within a \
circle"""
r = x * axis_ratio
return 2 * np.pi * r * self.convergence_func(x) |
Calculate the mass between two circular annuli and compute the density by dividing by the annuli surface area. | def density_between_circular_annuli_in_angular_units(self, inner_annuli_radius, outer_annuli_radius):
"""Calculate the mass between two circular annuli and compute the density by dividing by the annuli surface
area.
The value returned by the mass integral is dimensionless, therefore the density... |
The radius a critical curve forms for this mass profile e. g. where the mean convergence is equal to 1. 0. | def average_convergence_of_1_radius_in_units(self, unit_length='arcsec', kpc_per_arcsec=None):
"""The radius a critical curve forms for this mass profile, e.g. where the mean convergence is equal to 1.0.
In case of ellipitical mass profiles, the 'average' critical curve is used, whereby the convergenc... |
Rescale the einstein radius by slope and axis_ratio to reduce its degeneracy with other mass - profiles parameters | def einstein_radius_rescaled(self):
"""Rescale the einstein radius by slope and axis_ratio, to reduce its degeneracy with other mass-profiles
parameters"""
return ((3 - self.slope) / (1 + self.axis_ratio)) * self.einstein_radius ** (self.slope - 1) |
Calculate the projected convergence at a given set of arc - second gridded coordinates. | def convergence_from_grid(self, grid):
""" Calculate the projected convergence at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the surface density is computed on.
"""
s... |
Calculate the potential at a given set of arc - second gridded coordinates. | def potential_from_grid(self, grid):
"""
Calculate the potential at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
pote... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
For coordinates (0.0, 0.0) the analytic calculation of the deflection angle gives a NaN. Therefore, \
coordinates at (0.0, 0.0) are shifted slightly to (1.0e-8, 1... |
Calculate the potential at a given set of arc - second gridded coordinates. | def potential_from_grid(self, grid):
"""
Calculate the potential at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
eta =... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
Tabulate an integral over the surface density of deflection potential of a mass profile. This is used in \ the GeneralizedNFW profile classes to speed up the integration procedure. | def tabulate_integral(self, grid, tabulate_bins):
"""Tabulate an integral over the surface density of deflection potential of a mass profile. This is used in \
the GeneralizedNFW profile classes to speed up the integration procedure.
Parameters
-----------
grid : grids.RegularGr... |
Calculate the potential at a given set of arc - second gridded coordinates. | def potential_from_grid(self, grid, tabulate_bins=1000):
"""
Calculate the potential at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid, tabulate_bins=1000):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid, **kwargs):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid, **kwargs):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
... |
Calculate the potential at a given set of arc - second gridded coordinates. | def potential_from_grid(self, grid):
"""
Calculate the potential at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
poten... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
Calculate the potential at a given set of arc - second gridded coordinates. | def potential_from_grid(self, grid):
"""
Calculate the potential at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
eta =... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
Compute the intensity of the profile at a given radius. | def intensity_at_radius(self, radius):
""" Compute the intensity of the profile at a given radius.
Parameters
----------
radius : float
The distance from the centre of the profile.
"""
return self.intensity * np.exp(
-self.sersic_constant * (((rad... |
A parameter derived from Sersic index which ensures that effective radius contains 50% of the profile s total integrated light. | def sersic_constant(self):
""" A parameter derived from Sersic index which ensures that effective radius contains 50% of the profile's
total integrated light.
"""
return (2 * self.sersic_index) - (1. / 3.) + (4. / (405. * self.sersic_index)) + (
46. / (25515. * self.sersi... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
Calculate the deflection angles at a given set of arc - second gridded coordinates. | def deflections_from_grid(self, grid):
"""
Calculate the deflection angles at a given set of arc-second gridded coordinates.
Parameters
----------
grid : grids.RegularGrid
The grid of (y,x) arc-second coordinates the deflection angles are computed on.
"""
... |
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. | def intensities_from_grid(self, grid):
"""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 descript... |
Compute the total luminosity of the galaxy s light profiles within a circle of specified radius. | def luminosity_within_circle_in_units(self, radius : dim.Length, unit_luminosity='eps', kpc_per_arcsec=None, exposure_time=None):
"""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 ... |
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. | def luminosity_within_ellipse_in_units(self, major_axis : dim.Length, unit_luminosity='eps', kpc_per_arcsec=None, exposure_time=None):
"""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 i... |
Compute the summed convergence of the galaxy s mass profiles using a grid of Cartesian ( y x ) \ coordinates. | def convergence_from_grid(self, grid):
"""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 ... |
Compute the summed ( y x ) deflection angles of the galaxy s mass profiles using a grid of Cartesian ( y x ) \ coordinates. | def deflections_from_grid(self, grid):
"""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 t... |
Compute the total angular mass of the galaxy s mass profiles within a circle of specified radius. | def mass_within_circle_in_units(self, radius, unit_mass='angular', kpc_per_arcsec=None, critical_surface_density=None):
"""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 perform... |
Compute the total angular mass of the galaxy s mass profiles within an ellipse of specified major_axis. | def mass_within_ellipse_in_units(self, major_axis, unit_mass='angular', kpc_per_arcsec=None, critical_surface_density=None):
"""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... |
The Einstein Radius of this galaxy which is the sum of Einstein Radii of its mass profiles. | def einstein_radius_in_units(self, unit_length='arcsec', kpc_per_arcsec=None):
"""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 inac... |
The Einstein Mass of this galaxy which is the sum of Einstein Radii of its mass profiles. | def einstein_mass_in_units(self, unit_mass='angular', critical_surface_density=None):
"""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 i... |
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. | def contributions_from_model_image_and_galaxy_image(self, model_image, galaxy_image, minimum_value=0.0):
"""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.
... |
Compute a scaled galaxy hyper noise - map from a baseline noise - map. | def hyper_noise_from_contributions(self, noise_map, contributions):
"""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
... |
Compute the frame ( indexes of pixels light is blurred into ) and psf_frame ( psf kernel values of those \ pixels ) for a given coordinate in a masks and its PSF. | def frame_at_coordinates_jit(coordinates, mask, mask_index_array, psf):
""" Compute the frame (indexes of pixels light is blurred into) and psf_frame (psf kernel values of those \
pixels) for a given coordinate in a masks and its PSF.
Parameters
----------
coordinates: (int, int... |
For a given 1D regular array and blurring array convolve the two using this convolver. | def convolve_image(self, image_array, blurring_array):
"""For a given 1D regular array and blurring array, convolve the two using this convolver.
Parameters
-----------
image_array : ndarray
1D array of the regular values which are to be blurred with the convolver's PSF.
... |
Compute the intensities of a list of galaxies from an input grid by summing the individual intensities \ of each galaxy s light profile. | def intensities_of_galaxies_from_grid(grid, galaxies):
"""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 \
... |
Compute the convergence of a list of galaxies from an input grid by summing the individual convergence \ of each galaxy s mass profile. | def convergence_of_galaxies_from_grid(grid, galaxies):
"""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 \
... |
Compute the potential of a list of galaxies from an input grid by summing the individual potential \ of each galaxy s mass profile. | def potential_of_galaxies_from_grid(grid, galaxies):
"""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 \
o... |
Compute the deflections of a list of galaxies from an input grid by summing the individual deflections \ of each galaxy s mass profile. | def deflections_of_galaxies_from_grid(grid, galaxies):
"""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 \
o... |
Compute the deflections of a list of galaxies from an input sub - grid by summing the individual deflections \ of each galaxy s mass profile. | def deflections_of_galaxies_from_sub_grid(sub_grid, galaxies):
"""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 ... |
For a 1D masked image and 1D blurring image ( the regions outside the mask whose light blurs \ into the mask after PSF convolution ) use both to compute the blurred image within the mask via PSF convolution. | def blurred_image_1d_from_1d_unblurred_and_blurring_images(unblurred_image_1d, blurring_image_1d, convolver):
"""For a 1D masked image and 1D blurring image (the regions outside the mask whose light blurs \
into the mask after PSF convolution), use both to compute the blurred image within the mask via PSF convo... |
Compute the evidence of an inversion s fit to the datas where the evidence includes a number of \ terms which quantify the complexity of an inversion s reconstruction ( see the * inversion * module ): | def evidence_from_inversion_terms(chi_squared, regularization_term, log_curvature_regularization_term,
log_regularization_term, noise_normalization):
"""Compute the evidence of an inversion's fit to the datas, where the evidence includes a number of \
terms which quantify the c... |
For a tracer extract the image - plane image of every plane and blur it with the PSF. | def blurred_image_of_planes_from_1d_images_and_convolver(total_planes, image_plane_image_1d_of_planes,
image_plane_blurring_image_1d_of_planes, convolver,
map_to_scaled_array):
"""For a tracer, extract ... |
For lens data compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this \ this function iterates over all planes to extract their unmasked unblurred images. | def unmasked_blurred_image_of_planes_from_padded_grid_stack_and_psf(planes, padded_grid_stack, psf):
"""For lens data, compute the unmasked blurred image of every unmasked unblurred image of each plane. To do this, \
this function iterates over all planes to extract their unmasked unblurred images.
If a ga... |
For lens data compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \ plane. To do this this function iterates over all planes and then galaxies to extract their unmasked unblurred \ images. | def unmasked_blurred_image_of_planes_and_galaxies_from_padded_grid_stack_and_psf(planes, padded_grid_stack, psf):
"""For lens data, compute the unmasked blurred image of every unmasked unblurred image of every galaxy in each \
plane. To do this, this function iterates over all planes and then galaxies to extrac... |
For a fitting hyper_galaxy_image hyper_galaxy model image list of hyper galaxies images and model hyper galaxies compute their contribution maps which are used to compute a scaled - noise_map map. All quantities are masked 1D arrays. | def contribution_maps_1d_from_hyper_images_and_galaxies(hyper_model_image_1d, hyper_galaxy_images_1d, hyper_galaxies,
hyper_minimum_values):
"""For a fitting hyper_galaxy_image, hyper_galaxy model image, list of hyper galaxies images and model hyper galaxies, ... |
For a contribution map and noise - map use the model hyper galaxies to compute a scaled noise - map. | def scaled_noise_map_from_hyper_galaxies_and_contribution_maps(contribution_maps, hyper_galaxies, noise_map):
"""For a contribution map and noise-map, use the model hyper galaxies to compute a scaled noise-map.
Parameters
-----------
contribution_maps : ndarray
The image's list of 1D masked con... |
Compute the neighbors of every pixel as a list of the pixel index s each pixel shares a vertex with. | def rectangular_neighbors_from_shape(shape):
"""Compute the neighbors of every pixel as a list of the pixel index's each pixel shares a vertex with.
The uniformity of the rectangular grid's geometry is used to compute this.
"""
pixels = shape[0]*shape[1]
pixel_neighbors = -1 * np.ones(shape=(pix... |
Compute the neighbors of every pixel as a list of the pixel index s each pixel shares a vertex with. | def voronoi_neighbors_from_pixels_and_ridge_points(pixels, ridge_points):
"""Compute the neighbors of every pixel as a list of the pixel index's each pixel shares a vertex with.
The ridge points of the Voronoi grid are used to derive this.
Parameters
----------
ridge_points : scipy.spatial.Voronoi... |
Fit lens data with a model tracer automatically determining the type of fit based on the \ properties of the galaxies in the tracer. | def for_data_and_tracer(cls, lens_data, tracer, padded_tracer=None):
"""Fit lens data with a model tracer, automatically determining the type of fit based on the \
properties of the galaxies in the tracer.
Parameters
-----------
lens_data : lens_data.LensData or lens_data.LensDa... |
Wrap the function in a function that checks whether the coordinates have been transformed. If they have not \ been transformed then they are transformed. | def transform_grid(func):
"""Wrap the function in a function that checks whether the coordinates have been transformed. If they have not \
been transformed then they are transformed.
Parameters
----------
func : (profiles, *args, **kwargs) -> Object
A function that requires transformed coo... |
Caches results of a call to a grid function. If a grid that evaluates to the same byte value is passed into the same function of the same instance as previously then the cached result is returned. | def cache(func):
"""
Caches results of a call to a grid function. If a grid that evaluates to the same byte value is passed into the same
function of the same instance as previously then the cached result is returned.
Parameters
----------
func
Some instance method that takes a grid as ... |
Checks whether any coordinates in the grid are radially near ( 0. 0 0. 0 ) which can lead to numerical faults in \ the evaluation of a light or mass profiles. If any coordinates are radially within the the radial minimum \ threshold their ( y x ) coordinates are shifted to that value to ensure they are evaluated correc... | def move_grid_to_radial_minimum(func):
""" Checks whether any coordinates in the grid are radially near (0.0, 0.0), which can lead to numerical faults in \
the evaluation of a light or mass profiles. If any coordinates are radially within the the radial minimum \
threshold, their (y,x) coordinates are shift... |
Convert a grid of ( y x ) coordinates to a grid of their circular radii. | def grid_to_grid_radii(self, grid):
"""Convert a grid of (y, x) coordinates to a grid of their circular radii.
If the coordinates have not been transformed to the profile's centre, this is performed automatically.
Parameters
----------
grid : TransformedGrid(ndarray)
... |
Convert a grid of ( y x ) coordinates with their specified circular radii to their original ( y x ) Cartesian coordinates. | def grid_to_grid_cartesian(self, grid, radius):
"""
Convert a grid of (y,x) coordinates with their specified circular radii to their original (y,x) Cartesian
coordinates.
Parameters
----------
grid : TransformedGrid(ndarray)
The (y, x) coordinates in the ref... |
Transform a grid of ( y x ) coordinates to the reference frame of the profile including a translation to \ its centre. | def transform_grid_to_reference_frame(self, grid):
"""Transform a grid of (y,x) coordinates to the reference frame of the profile, including a translation to \
its centre.
Parameters
----------
grid : ndarray
The (y, x) coordinates in the original reference frame of ... |
Transform a grid of ( y x ) coordinates from the reference frame of the profile to the original observer \ reference frame including a translation from the profile s centre. | def transform_grid_from_reference_frame(self, grid):
"""Transform a grid of (y,x) coordinates from the reference frame of the profile to the original observer \
reference frame, including a translation from the profile's centre.
Parameters
----------
grid : TransformedGrid(ndarr... |
Determine the sin and cosine of the angle between the profile s ellipse and the positive x - axis \ counter - clockwise. | def cos_and_sin_from_x_axis(self):
""" Determine the sin and cosine of the angle between the profile's ellipse and the positive x-axis, \
counter-clockwise. """
phi_radians = np.radians(self.phi)
return np.cos(phi_radians), np.sin(phi_radians) |
The angle between each angle theta on the grid and the profile in radians. | def grid_angle_to_profile(self, grid_thetas):
"""The angle between each angle theta on the grid and the profile, in radians.
Parameters
-----------
grid_thetas : ndarray
The angle theta counter-clockwise from the positive x-axis to each coordinate in radians.
"""
... |
Rotate a grid of elliptical ( y x ) coordinates from the reference frame of the profile back to the \ unrotated coordinate grid reference frame ( coordinates are not shifted back to their original centre ). | def rotate_grid_from_profile(self, grid_elliptical):
""" Rotate a grid of elliptical (y,x) coordinates from the reference frame of the profile back to the \
unrotated coordinate grid reference frame (coordinates are not shifted back to their original centre).
This routine is used after computin... |
Convert a grid of ( y x ) coordinates to an elliptical radius. | def grid_to_elliptical_radii(self, grid):
""" Convert a grid of (y,x) coordinates to an elliptical radius.
If the coordinates have not been transformed to the profile's geometry, this is performed automatically.
Parameters
----------
grid : TransformedGrid(ndarray)
... |
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. | def grid_to_eccentric_radii(self, grid):
"""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,... |
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. | def transform_grid_to_reference_frame(self, grid):
"""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... |
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. | def transform_grid_from_reference_frame(self, grid):
"""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
----... |
Computes the mapping matrix by iterating over the known mappings between the sub - grid and pixelization. | def mapping_matrix_from_sub_to_pix(sub_to_pix, pixels, regular_pixels, sub_to_regular, sub_grid_fraction):
"""Computes the mapping matrix, by iterating over the known mappings between the sub-grid and pixelization.
Parameters
-----------
sub_to_pix : ndarray
The mappings between the observed re... |
Compute the mappings between a set of regular - grid pixels and pixelization pixels using information on \ how regular pixels map to their closest pixelization pixel on the image - plane pix - grid and the pixelization s \ pixel centres. | def voronoi_regular_to_pix_from_grids_and_geometry(regular_grid, regular_to_nearest_pix, pixel_centres,
pixel_neighbors, pixel_neighbors_size):
""" Compute the mappings between a set of regular-grid pixels and pixelization pixels, using information on \
how reg... |
Compute the mappings between a set of sub - grid pixels and pixelization pixels using information on \ how the regular pixels hosting each sub - pixel map to their closest pixelization pixel on the image - plane pix - grid \ and the pixelization s pixel centres. | def voronoi_sub_to_pix_from_grids_and_geometry(sub_grid, regular_to_nearest_pix, sub_to_regular, pixel_centres,
pixel_neighbors, pixel_neighbors_size):
""" Compute the mappings between a set of sub-grid pixels and pixelization pixels, using information on \
how the... |
Integrate the light profile to compute the total luminosity within a circle of specified radius. This is \ centred on the light profile s centre. | def luminosity_within_circle_in_units(self, radius: dim.Length, unit_luminosity='eps', kpc_per_arcsec=None,
exposure_time=None):
"""Integrate the light profile to compute the total luminosity within a circle of specified radius. This is \
centred on the light pr... |
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. | def luminosity_within_ellipse_in_units(self, major_axis, unit_luminosity='eps', kpc_per_arcsec=None,
exposure_time=None):
"""Integrate the light profiles to compute the total luminosity within an ellipse of specified major axis. \
This is centred on the light p... |
Routine to integrate the luminosity of an elliptical light profile. | def luminosity_integral(self, x, axis_ratio):
"""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"""
r = x * axis_ratio
return 2 * np.pi * r * self.intensities_from_grid_radii(x) |
Calculate the intensity of the Gaussian light profile on a grid of radial coordinates. | def intensities_from_grid_radii(self, grid_radii):
"""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.
... |
Calculate the intensity of the Sersic light profile on a grid of radial coordinates. | def intensities_from_grid_radii(self, grid_radii):
"""
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.
... |
Overall intensity normalisation in the rescaled Core - Sersic light profiles ( electrons per second ) | def intensity_prime(self):
"""Overall intensity normalisation in the rescaled Core-Sersic light profiles (electrons per second)"""
return self.intensity_break * (2.0 ** (-self.gamma / self.alpha)) * np.exp(
self.sersic_constant * (((2.0 ** (1.0 / self.alpha)) * self.radius_break) / self.effe... |
Calculate the intensity of the cored - Sersic light profile on a grid of radial coordinates. | def intensities_from_grid_radii(self, grid_radii):
"""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.
... |
Compute the total luminosity of all galaxies in this plane within a circle of specified radius. | def luminosities_of_galaxies_within_circles_in_units(self, radius : dim.Length, unit_luminosity='eps', exposure_time=None):
"""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 de... |
Compute the total luminosity of all galaxies in this plane within a ellipse of specified major - axis. | def luminosities_of_galaxies_within_ellipses_in_units(self, major_axis : dim.Length, unit_luminosity='eps',
exposure_time=None):
"""
Compute the total luminosity of all galaxies in this plane within a ellipse of specified major-axis.
The... |
Compute the total mass of all galaxies in this plane within a circle of specified radius. | def masses_of_galaxies_within_circles_in_units(self, radius : dim.Length, unit_mass='angular',
critical_surface_density=None):
"""Compute the total mass of all galaxies in this plane within a circle of specified radius.
See *galaxy.angular_mass_within_... |
Compute the total mass of all galaxies in this plane within a ellipse of specified major - axis. | def masses_of_galaxies_within_ellipses_in_units(self, major_axis : dim.Length, unit_mass='angular',
critical_surface_density=None):
"""Compute the total mass of all galaxies in this plane within a ellipse of specified major-axis.
See *galaxy.angular_m... |
Trace this plane s grid_stacks to the next plane using its deflection angles. | def trace_grid_stack_to_next_plane(self):
"""Trace this plane's grid_stacks to the next plane, using its deflection angles."""
def minus(grid, deflections):
return grid - deflections
return self.grid_stack.map_function(minus, self.deflection_stack) |
Compute the yticks labels of this grid_stack used for plotting the y - axis ticks when visualizing an image \ | def yticks(self):
"""Compute the yticks labels of this grid_stack, used for plotting the y-axis ticks when visualizing an image \
"""
return np.linspace(np.amin(self.grid_stack.regular[:, 0]), np.amax(self.grid_stack.regular[:, 0]), 4) |
Compute the xticks labels of this grid_stack used for plotting the x - axis ticks when visualizing an \ image | def xticks(self):
"""Compute the xticks labels of this grid_stack, used for plotting the x-axis ticks when visualizing an \
image"""
return np.linspace(np.amin(self.grid_stack.regular[:, 1]), np.amax(self.grid_stack.regular[:, 1]), 4) |
This is a utility function for the function above which performs the iteration over each plane s galaxies \ and computes each galaxy s unmasked blurred image. | def unmasked_blurred_image_of_galaxies_from_psf(self, padded_grid_stack, psf):
"""This is a utility function for the function above, which performs the iteration over each plane's galaxies \
and computes each galaxy's unmasked blurred image.
Parameters
----------
padded_grid_sta... |
Trace the positions to the next plane. | def trace_to_next_plane(self):
"""Trace the positions to the next plane."""
return list(map(lambda positions, deflections: np.subtract(positions, deflections),
self.positions, self.deflections)) |
Convert a grid of ( y x ) arc second coordinates to a grid of ( y x ) pixel values. Pixel coordinates are \ returned as floats such that they include the decimal offset from each pixel s top - left corner. | def grid_arcsec_to_grid_pixels(self, grid_arcsec):
"""Convert a grid of (y,x) arc second coordinates to a grid of (y,x) pixel values. Pixel coordinates are \
returned as floats such that they include the decimal offset from each pixel's top-left corner.
The pixel coordinate origin is at the top... |
Convert a grid of ( y x ) arc second coordinates to a grid of ( y x ) pixel values. Pixel coordinates are \ returned as integers such that they map directly to the pixel they are contained within. | def grid_arcsec_to_grid_pixel_centres(self, grid_arcsec):
"""Convert a grid of (y,x) arc second coordinates to a grid of (y,x) pixel values. Pixel coordinates are \
returned as integers such that they map directly to the pixel they are contained within.
The pixel coordinate origin is at the top... |
Convert a grid of ( y x ) arc second coordinates to a grid of ( y x ) pixel 1D indexes. Pixel coordinates are \ returned as integers such that they are the pixel from the top - left of the 2D grid going rights and then \ downwards. | def grid_arcsec_to_grid_pixel_indexes(self, grid_arcsec):
"""Convert a grid of (y,x) arc second coordinates to a grid of (y,x) pixel 1D indexes. Pixel coordinates are \
returned as integers such that they are the pixel from the top-left of the 2D grid going rights and then \
downwards.
... |
Convert a grid of ( y x ) pixel coordinates to a grid of ( y x ) arc second values. | def grid_pixels_to_grid_arcsec(self, grid_pixels):
"""Convert a grid of (y,x) pixel coordinates to a grid of (y,x) arc second values.
The pixel coordinate origin is at the top left corner of the grid, such that the pixel [0,0] corresponds to \
higher y arc-second coordinate value and lowest x a... |
The arc second - grid of ( y x ) coordinates of every pixel. | def grid_1d(self):
""" The arc second-grid of (y,x) coordinates of every pixel.
This is defined from the top-left corner, such that the first pixel at location [0, 0] will have a negative x \
value y value in arc seconds.
"""
return grid_util.regular_grid_1d_from_shape_pixel_sca... |
The arc second - grid of ( y x ) coordinates of every pixel. | def grid_2d(self):
""" The arc second-grid of (y,x) coordinates of every pixel.
This is defined from the top-left corner, such that the first pixel at location [0, 0] will have a negative x \
value y value in arc seconds.
"""
return grid_util.regular_grid_2d_from_shape_pixel_sca... |
Parameters ---------- array: ndarray An ndarray | def new_with_array(self, array):
"""
Parameters
----------
array: ndarray
An ndarray
Returns
-------
new_array: ScaledSquarePixelArray
A new instance of this class that shares all of this instances attributes with a new ndarray.
""... |
Loads the image from a. fits file. | def from_fits_with_pixel_scale(cls, file_path, hdu, pixel_scale, origin=(0.0, 0.0)):
"""
Loads the image from a .fits file.
Parameters
----------
file_path : str
The full path of the fits file.
hdu : int
The HDU number in the fits file containing ... |
Creates an instance of Array and fills it with a single value | def single_value(cls, value, shape, pixel_scale, origin=(0.0, 0.0)):
"""
Creates an instance of Array and fills it with a single value
Parameters
----------
value: float
The value with which the array should be filled
shape: (int, int)
The shape o... |
Returns ------- flat_scaled_array: ScaledSquarePixelArray A copy of this array flattened to 1D | def flatten(self, order='C'):
"""
Returns
-------
flat_scaled_array: ScaledSquarePixelArray
A copy of this array flattened to 1D
"""
return self.new_with_array(super(ScaledSquarePixelArray, self).flatten(order)) |
Extract the 2D region of an array corresponding to the rectangle encompassing all unmasked values. | def zoomed_scaled_array_around_mask(self, mask, buffer=1):
"""Extract the 2D region of an array corresponding to the rectangle encompassing all unmasked values.
This is used to extract and visualize only the region of an image that is used in an analysis.
Parameters
----------
... |
resized the array to a new shape and at a new origin. | def resized_scaled_array_from_array(self, new_shape, new_centre_pixels=None, new_centre_arcsec=None):
"""resized the array to a new shape and at a new origin.
Parameters
-----------
new_shape : (int, int)
The new two-dimensional shape of the array.
"""
if new... |
Loads the image from a. fits file. | def from_fits_with_pixel_scale(cls, file_path, hdu, pixel_scales, origin=(0.0, 0.0)):
"""
Loads the image from a .fits file.
Parameters
----------
file_path : str
The full path of the fits file.
hdu : int
The HDU number in the fits file containing... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.