_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q257800
bin_up_mask_2d
validation
def bin_up_mask_2d(mask_2d, bin_up_factor): """Bin up an array to coarser resolution, by binning up groups of pixels and using their sum value to determine \ the value of the new pixel. If an array of shape (8,8) is input and the bin up size is 2, this would return a new array of size (4,4) where \ ev...
python
{ "resource": "" }
q257801
setup_figure
validation
def setup_figure(figsize, as_subplot): """Setup a figure for plotting an image. Parameters ----------- figsize : (int, int) The size of the figure in (rows, columns). as_subplot : bool If the figure is a subplot, the setup_figure function is omitted to ensure that each subplot does ...
python
{ "resource": "" }
q257802
output_figure
validation
def output_figure(array, as_subplot, output_path, output_filename, output_format): """Output the figure, either as an image on the screen or to the hard-disk as a .png or .fits file. Parameters ----------- array : ndarray The 2D array of image to be output, required for outputting the image as ...
python
{ "resource": "" }
q257803
output_subplot_array
validation
def output_subplot_array(output_path, output_filename, output_format): """Output a figure which consists of a set of subplot,, either as an image on the screen or to the hard-disk as a \ .png file. Parameters ----------- output_path : str The path on the hard-disk where the figure is output...
python
{ "resource": "" }
q257804
image_psf_shape_tag_from_image_psf_shape
validation
def image_psf_shape_tag_from_image_psf_shape(image_psf_shape): """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 ...
python
{ "resource": "" }
q257805
inversion_psf_shape_tag_from_inversion_psf_shape
validation
def inversion_psf_shape_tag_from_inversion_psf_shape(inversion_psf_shape): """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_...
python
{ "resource": "" }
q257806
bulge_disk_tag_from_align_bulge_disks
validation
def bulge_disk_tag_from_align_bulge_disks(align_bulge_disk_centre, align_bulge_disk_axis_ratio, align_bulge_disk_phi): """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 ta...
python
{ "resource": "" }
q257807
compute_deflections_at_next_plane
validation
def compute_deflections_at_next_plane(plane_index, total_planes): """This function determines whether the tracer should compute the deflections at the next plane. This is True if there is another plane after this plane, else it is False.. Parameters ----------- plane_index : int The index ...
python
{ "resource": "" }
q257808
scaled_deflection_stack_from_plane_and_scaling_factor
validation
def scaled_deflection_stack_from_plane_and_scaling_factor(plane, scaling_factor): """Given a plane and scaling factor, compute a set of scaled deflections. Parameters ----------- plane : plane.Plane The plane whose deflection stack is scaled. scaling_factor : float The factor the de...
python
{ "resource": "" }
q257809
grid_stack_from_deflection_stack
validation
def grid_stack_from_deflection_stack(grid_stack, deflection_stack): """For a deflection stack, comput a new grid stack but subtracting the deflections""" if deflection_stack is not None: def minus(grid, deflections): return grid - deflections return grid_stack.map_function(minus, d...
python
{ "resource": "" }
q257810
constant_regularization_matrix_from_pixel_neighbors
validation
def constant_regularization_matrix_from_pixel_neighbors(coefficients, pixel_neighbors, pixel_neighbors_size): """From the pixel-neighbors, setup the regularization matrix using the constant regularization scheme. Parameters ---------- coefficients : tuple The regularization coefficients which c...
python
{ "resource": "" }
q257811
weighted_regularization_matrix_from_pixel_neighbors
validation
def weighted_regularization_matrix_from_pixel_neighbors(regularization_weights, pixel_neighbors, pixel_neighbors_size): """From the pixel-neighbors, setup the regularization matrix using the weighted regularization scheme. Parameters ---------- re...
python
{ "resource": "" }
q257812
plot_figure
validation
def plot_figure(array, as_subplot, units, kpc_per_arcsec, figsize, aspect, cmap, norm, norm_min, norm_max, linthresh, linscale, xticks_manual, yticks_manual): """Open a matplotlib figure and plot the array of data on it. Parameters ----------- array : data.array.scaled_array.ScaledArray...
python
{ "resource": "" }
q257813
get_normalization_min_max
validation
def get_normalization_min_max(array, norm_min, norm_max): """Get the minimum and maximum of the normalization of the array, which sets the lower and upper limits of the \ colormap. If norm_min / norm_max are not supplied, the minimum / maximum values of the array of data are used. Parameters -----...
python
{ "resource": "" }
q257814
set_colorbar
validation
def set_colorbar(cb_ticksize, cb_fraction, cb_pad, cb_tick_values, cb_tick_labels): """Setup the colorbar of the figure, specifically its ticksize and the size is appears relative to the figure. Parameters ----------- cb_ticksize : int The size of the tick labels on the colorbar. cb_fractio...
python
{ "resource": "" }
q257815
plot_mask
validation
def plot_mask(mask, units, kpc_per_arcsec, pointsize, zoom_offset_pixels): """Plot the mask of the array on the figure. Parameters ----------- mask : ndarray of data.array.mask.Mask The mask applied to the array, the edge of which is plotted as a set of points over the plotted array. units ...
python
{ "resource": "" }
q257816
plot_border
validation
def plot_border(mask, should_plot_border, units, kpc_per_arcsec, pointsize, zoom_offset_pixels): """Plot the borders of the mask or the array on the figure. Parameters -----------t. mask : ndarray of data.array.mask.Mask The mask applied to the array, the edge of which is plotted as a set of po...
python
{ "resource": "" }
q257817
plot_points
validation
def plot_points(points_arcsec, array, units, kpc_per_arcsec, pointsize, zoom_offset_arcsec): """Plot a set of points over the array of data on the figure. Parameters ----------- positions : [[]] Lists of (y,x) coordinates on the image which are plotted as colored dots, to highlight specific pix...
python
{ "resource": "" }
q257818
plot_grid
validation
def plot_grid(grid_arcsec, array, units, kpc_per_arcsec, pointsize, zoom_offset_arcsec): """Plot a grid of points over the array of data on the figure. Parameters -----------. grid_arcsec : ndarray or data.array.grids.RegularGrid A grid of (y,x) coordinates in arc-seconds which may be plott...
python
{ "resource": "" }
q257819
Mapper.mapping_matrix
validation
def mapping_matrix(self): """The mapping matrix is a matrix representing the mapping between every unmasked pixel of a grid and \ the pixels of a pixelization. Non-zero entries signify a mapping, whereas zeros signify no mapping. For example, if the regular grid has 5 pixels and the pixelizatio...
python
{ "resource": "" }
q257820
Mapper.pix_to_regular
validation
def pix_to_regular(self): """Compute the mappings between a pixelization's pixels and the unmasked regular-grid pixels. These mappings \ are determined after the regular-grid is used to determine the pixelization. The pixelization's pixels map to different number of regular-grid pixels, thus a ...
python
{ "resource": "" }
q257821
Mapper.pix_to_sub
validation
def pix_to_sub(self): """Compute the mappings between a pixelization's pixels and the unmasked sub-grid pixels. These mappings \ are determined after the regular-grid is used to determine the pixelization. The pixelization's pixels map to different number of sub-grid pixels, thus a list of list...
python
{ "resource": "" }
q257822
VoronoiMapper.regular_to_pix
validation
def regular_to_pix(self): """The 1D index mappings between the regular pixels and Voronoi pixelization pixels.""" return mapper_util.voronoi_regular_to_pix_from_grids_and_geometry(regular_grid=self.grid_stack.regular, regular_to_nearest_pix=self.grid_stack.pix.regular_to_nearest_pix, ...
python
{ "resource": "" }
q257823
VoronoiMapper.sub_to_pix
validation
def sub_to_pix(self): """ The 1D index mappings between the sub pixels and Voronoi pixelization pixels. """ return mapper_util.voronoi_sub_to_pix_from_grids_and_geometry(sub_grid=self.grid_stack.sub, regular_to_nearest_pix=self.grid_stack.pix.regular_to_nearest_pix, sub_to...
python
{ "resource": "" }
q257824
setup_random_seed
validation
def setup_random_seed(seed): """Setup the random seed. If the input seed is -1, the code will use a random seed for every run. If it is \ positive, that seed is used for all runs, thereby giving reproducible results. Parameters ---------- seed : int The seed of the random number generator. ...
python
{ "resource": "" }
q257825
generate_poisson_noise
validation
def generate_poisson_noise(image, exposure_time_map, seed=-1): """ Generate a two-dimensional poisson noise_maps-mappers from an image. Values are computed from a Poisson distribution using the image's input values in units of counts. Parameters ---------- image : ndarray The 2D image,...
python
{ "resource": "" }
q257826
load_ccd_data_from_fits
validation
def load_ccd_data_from_fits(image_path, pixel_scale, image_hdu=0, resized_ccd_shape=None, resized_ccd_origin_pixels=None, resized_ccd_origin_arcsec=None, psf_path=None, psf_hdu=0, resized_psf_shape=None, renormalize_psf=True, ...
python
{ "resource": "" }
q257827
load_image
validation
def load_image(image_path, image_hdu, pixel_scale): """Factory for loading the image from a .fits file Parameters ---------- image_path : str The path to the image .fits file containing the image (e.g. '/path/to/image.fits') image_hdu : int The hdu the image is contained in the .fit...
python
{ "resource": "" }
q257828
load_noise_map
validation
def load_noise_map(noise_map_path, noise_map_hdu, pixel_scale, image, background_noise_map, exposure_time_map, convert_noise_map_from_weight_map, convert_noise_map_from_inverse_noise_map, noise_map_from_image_and_background_noise_map, convert_from_electrons, gain, convert_from_adus...
python
{ "resource": "" }
q257829
load_background_noise_map
validation
def load_background_noise_map(background_noise_map_path, background_noise_map_hdu, pixel_scale, convert_background_noise_map_from_weight_map, convert_background_noise_map_from_inverse_noise_map): """Factory for loading the background noise-map from a .fits...
python
{ "resource": "" }
q257830
load_poisson_noise_map
validation
def load_poisson_noise_map(poisson_noise_map_path, poisson_noise_map_hdu, pixel_scale, convert_poisson_noise_map_from_weight_map, convert_poisson_noise_map_from_inverse_noise_map, poisson_noise_map_from_image, im...
python
{ "resource": "" }
q257831
load_psf
validation
def load_psf(psf_path, psf_hdu, pixel_scale, renormalize=False): """Factory for loading the psf from a .fits file. Parameters ---------- psf_path : str The path to the psf .fits file containing the psf (e.g. '/path/to/psf.fits') psf_hdu : int The hdu the psf is contained in the .fit...
python
{ "resource": "" }
q257832
load_exposure_time_map
validation
def load_exposure_time_map(exposure_time_map_path, exposure_time_map_hdu, pixel_scale, shape, exposure_time, exposure_time_map_from_inverse_noise_map, inverse_noise_map): """Factory for loading the exposure time map from a .fits file. This factory also includes a number of routines f...
python
{ "resource": "" }
q257833
load_background_sky_map
validation
def load_background_sky_map(background_sky_map_path, background_sky_map_hdu, pixel_scale): """Factory for loading the background sky from a .fits file. Parameters ---------- background_sky_map_path : str The path to the background_sky_map .fits file containing the background sky map \ (...
python
{ "resource": "" }
q257834
load_positions
validation
def load_positions(positions_path): """Load the positions of an image. Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \ multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \ one...
python
{ "resource": "" }
q257835
output_positions
validation
def output_positions(positions, positions_path): """Output the positions of an image to a positions.dat file. Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \ multiply-imaged region of the source-plane. Mass models which do not trace the pixel...
python
{ "resource": "" }
q257836
CCDData.signal_to_noise_map
validation
def signal_to_noise_map(self): """The estimated signal-to-noise_maps mappers of the image.""" signal_to_noise_map = np.divide(self.image, self.noise_map) signal_to_noise_map[signal_to_noise_map < 0] = 0 return signal_to_noise_map
python
{ "resource": "" }
q257837
CCDData.absolute_signal_to_noise_map
validation
def absolute_signal_to_noise_map(self): """The estimated absolute_signal-to-noise_maps mappers of the image.""" return np.divide(np.abs(self.image), self.noise_map)
python
{ "resource": "" }
q257838
NoiseMap.from_weight_map
validation
def from_weight_map(cls, pixel_scale, weight_map): """Setup the noise-map from a weight map, which is a form of noise-map that comes via HST image-reduction and \ the software package MultiDrizzle. The variance in each pixel is computed as: Variance = 1.0 / sqrt(weight_map). T...
python
{ "resource": "" }
q257839
NoiseMap.from_inverse_noise_map
validation
def from_inverse_noise_map(cls, pixel_scale, inverse_noise_map): """Setup the noise-map from an root-mean square standard deviation map, which is a form of noise-map that \ comes via HST image-reduction and the software package MultiDrizzle. The variance in each pixel is computed as: V...
python
{ "resource": "" }
q257840
PSF.simulate_as_gaussian
validation
def simulate_as_gaussian(cls, shape, pixel_scale, sigma, centre=(0.0, 0.0), axis_ratio=1.0, phi=0.0): """Simulate the PSF as an elliptical Gaussian profile.""" from autolens.model.profiles.light_profiles import EllipticalGaussian gaussian = EllipticalGaussian(centre=centre, axis_ratio=axis_ratio...
python
{ "resource": "" }
q257841
PSF.from_fits_renormalized
validation
def from_fits_renormalized(cls, file_path, hdu, pixel_scale): """Loads a PSF from fits and renormalizes it Parameters ---------- pixel_scale file_path: String The path to the file containing the PSF hdu : int The HDU the PSF is stored in the .fits...
python
{ "resource": "" }
q257842
PSF.from_fits_with_scale
validation
def from_fits_with_scale(cls, file_path, hdu, pixel_scale): """ Loads the PSF from a .fits file. Parameters ---------- pixel_scale file_path: String The path to the file containing the PSF hdu : int The HDU the PSF is stored in the .fits f...
python
{ "resource": "" }
q257843
PSF.new_psf_with_renormalized_array
validation
def new_psf_with_renormalized_array(self): """Renormalize the PSF such that its data_vector values sum to unity.""" return PSF(array=self, pixel_scale=self.pixel_scale, renormalize=True)
python
{ "resource": "" }
q257844
PSF.convolve
validation
def convolve(self, array): """ Convolve an array with this PSF Parameters ---------- image : ndarray An array representing the image the PSF is convolved with. Returns ------- convolved_image : ndarray An array representing the im...
python
{ "resource": "" }
q257845
Rectangular.geometry_from_grid
validation
def geometry_from_grid(self, grid, buffer=1e-8): """Determine the geometry of the rectangular grid, by overlaying it over a grid of coordinates such that its \ outer-most pixels align with the grid's outer most coordinates plus a small buffer. Parameters ----------- grid : ndar...
python
{ "resource": "" }
q257846
Voronoi.geometry_from_grid
validation
def geometry_from_grid(self, grid, pixel_centres, pixel_neighbors, pixel_neighbors_size, buffer=1e-8): """Determine the geometry of the Voronoi pixelization, by alligning it with the outer-most coordinates on a \ grid plus a small buffer. Parameters ----------- grid : ndarray ...
python
{ "resource": "" }
q257847
Voronoi.voronoi_from_pixel_centers
validation
def voronoi_from_pixel_centers(pixel_centers): """Compute the Voronoi grid of the pixelization, using the pixel centers. Parameters ---------- pixel_centers : ndarray The (y,x) centre of every Voronoi pixel. """ return scipy.spatial.Voronoi(np.asarray([pixel_...
python
{ "resource": "" }
q257848
Voronoi.neighbors_from_pixelization
validation
def neighbors_from_pixelization(self, pixels, ridge_points): """Compute the neighbors of every Voronoi pixel as an ndarray 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_p...
python
{ "resource": "" }
q257849
set_xy_labels
validation
def set_xy_labels(units, kpc_per_arcsec, xlabelsize, ylabelsize, xyticksize): """Set the x and y labels of the figure, and set the fontsize of those labels. The x and y labels are always the distance scales, thus the labels are either arc-seconds or kpc and depend on the \ units the figure is plotted in. ...
python
{ "resource": "" }
q257850
grid_interpolate
validation
def grid_interpolate(func): """ Decorate a profile method that accepts a coordinate grid and returns a data grid. If an interpolator attribute is associated with the input grid then that interpolator is used to down sample the coordinate grid prior to calling the function and up sample the result of th...
python
{ "resource": "" }
q257851
GridStack.unmasked_blurred_image_from_psf_and_unmasked_image
validation
def unmasked_blurred_image_from_psf_and_unmasked_image(self, psf, unmasked_image_1d): """For a padded grid-stack and psf, compute an unmasked blurred image from an unmasked unblurred image. This relies on using the lens data's padded-grid, which is a grid of (y,x) coordinates which extends over the \ ...
python
{ "resource": "" }
q257852
GridStack.grid_stack_from_mask_sub_grid_size_and_psf_shape
validation
def grid_stack_from_mask_sub_grid_size_and_psf_shape(cls, mask, sub_grid_size, psf_shape): """Setup a grid-stack of grid_stack from a mask, sub-grid size and psf-shape. Parameters ----------- mask : Mask The mask whose unmasked pixels (*False*) are used to generate the grid-...
python
{ "resource": "" }
q257853
GridStack.from_shape_pixel_scale_and_sub_grid_size
validation
def from_shape_pixel_scale_and_sub_grid_size(cls, shape, pixel_scale, sub_grid_size=2): """Setup a grid-stack of grid_stack from a 2D array shape, a pixel scale and a sub-grid size. This grid corresponds to a fully unmasked 2D array. Parameters ----------- shape : (int,...
python
{ "resource": "" }
q257854
GridStack.padded_grid_stack_from_mask_sub_grid_size_and_psf_shape
validation
def padded_grid_stack_from_mask_sub_grid_size_and_psf_shape(cls, mask, sub_grid_size, psf_shape): """Setup a grid-stack of masked grid_stack from a mask, sub-grid size and psf-shape. Parameters ----------- mask : Mask The mask whose masked pixels the grid-stack are setup us...
python
{ "resource": "" }
q257855
GridStack.map_function
validation
def map_function(self, func, *arg_lists): """Map a function to all grid_stack in a grid-stack""" return GridStack(*[func(*args) for args in zip(self, *arg_lists)])
python
{ "resource": "" }
q257856
RegularGrid.array_2d_from_array_1d
validation
def array_2d_from_array_1d(self, array_1d): """ Map a 1D array the same dimension as the grid to its original masked 2D array. Parameters ----------- array_1d : ndarray The 1D array which is mapped to its masked 2D array. """ return mapping_util.map_masked_1d...
python
{ "resource": "" }
q257857
RegularGrid.scaled_array_2d_from_array_1d
validation
def scaled_array_2d_from_array_1d(self, array_1d): """ Map a 1D array the same dimension as the grid to its original masked 2D array and return it as a scaled \ array. Parameters ----------- array_1d : ndarray The 1D array of which is mapped to a 2D scaled array. ...
python
{ "resource": "" }
q257858
RegularGrid.yticks
validation
def yticks(self): """Compute the yticks labels of this grid, used for plotting the y-axis ticks when visualizing a regular""" return np.linspace(np.min(self[:, 0]), np.max(self[:, 0]), 4)
python
{ "resource": "" }
q257859
RegularGrid.xticks
validation
def xticks(self): """Compute the xticks labels of this grid, used for plotting the x-axis ticks when visualizing a regular""" return np.linspace(np.min(self[:, 1]), np.max(self[:, 1]), 4)
python
{ "resource": "" }
q257860
SubGrid.regular_data_1d_from_sub_data_1d
validation
def regular_data_1d_from_sub_data_1d(self, sub_array_1d): """For an input sub-gridded array, map its hyper-values from the sub-gridded values to a 1D regular grid of \ values by summing each set of each set of sub-pixels values and dividing by the total number of sub-pixels. Parameters ...
python
{ "resource": "" }
q257861
SparseToRegularGrid.unmasked_sparse_to_sparse
validation
def unmasked_sparse_to_sparse(self): """The 1D index mappings between the unmasked sparse-grid and masked sparse grid.""" return mapping_util.unmasked_sparse_to_sparse_from_mask_and_pixel_centres( mask=self.regular_grid.mask, unmasked_sparse_grid_pixel_centres=self.unmasked_spar...
python
{ "resource": "" }
q257862
SparseToRegularGrid.sparse_to_unmasked_sparse
validation
def sparse_to_unmasked_sparse(self): """The 1D index mappings between the masked sparse-grid and unmasked sparse grid.""" return mapping_util.sparse_to_unmasked_sparse_from_mask_and_pixel_centres( total_sparse_pixels=self.total_sparse_pixels, mask=self.regular_grid.mask, unmasked...
python
{ "resource": "" }
q257863
SparseToRegularGrid.regular_to_sparse
validation
def regular_to_sparse(self): """The 1D index mappings between the regular-grid and masked sparse-grid.""" return mapping_util.regular_to_sparse_from_sparse_mappings( regular_to_unmasked_sparse=self.regular_to_unmasked_sparse, unmasked_sparse_to_sparse=self.unmasked_sparse_to_spa...
python
{ "resource": "" }
q257864
PaddedRegularGrid.padded_grid_from_shape_psf_shape_and_pixel_scale
validation
def padded_grid_from_shape_psf_shape_and_pixel_scale(cls, shape, psf_shape, pixel_scale): """Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale. The center of every pixel is used to setup the grid's (y,x) arc-second coordinates, including padded pixels \ which are beyo...
python
{ "resource": "" }
q257865
PaddedRegularGrid.padded_blurred_image_2d_from_padded_image_1d_and_psf
validation
def padded_blurred_image_2d_from_padded_image_1d_and_psf(self, padded_image_1d, psf): """Compute a 2D padded blurred image from a 1D padded image. Parameters ---------- padded_image_1d : ndarray A 1D unmasked image which is blurred with the PSF. psf : ndarray ...
python
{ "resource": "" }
q257866
PaddedRegularGrid.array_2d_from_array_1d
validation
def array_2d_from_array_1d(self, padded_array_1d): """ Map a padded 1D array of values to its original 2D array, trimming all edge values. Parameters ----------- padded_array_1d : ndarray A 1D array of values which were computed using the *PaddedRegularGrid*. """ ...
python
{ "resource": "" }
q257867
PaddedRegularGrid.map_to_2d_keep_padded
validation
def map_to_2d_keep_padded(self, padded_array_1d): """ Map a padded 1D array of values to its padded 2D array. Parameters ----------- padded_array_1d : ndarray A 1D array of values which were computed using the *PaddedRegularGrid*. """ return mapping_util.map_...
python
{ "resource": "" }
q257868
RegularGridBorder.relocated_grid_stack_from_grid_stack
validation
def relocated_grid_stack_from_grid_stack(self, grid_stack): """Determine a set of relocated grid_stack from an input set of grid_stack, by relocating their pixels based on the \ borders. The blurring-grid does not have its coordinates relocated, as it is only used for computing analytic \ ...
python
{ "resource": "" }
q257869
set_defaults
validation
def set_defaults(key): """ 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 ...
python
{ "resource": "" }
q257870
HyperGalaxyPhase.run
validation
def run(self, data, results=None, mask=None, positions=None): """ Run a fit for each galaxy from the previous phase. Parameters ---------- data: LensData results: ResultsCollection Results from all previous phases mask: Mask The mask ...
python
{ "resource": "" }
q257871
map_2d_array_to_masked_1d_array_from_array_2d_and_mask
validation
def map_2d_array_to_masked_1d_array_from_array_2d_and_mask(mask, array_2d): """For a 2D array and mask, map the values of all unmasked pixels to a 1D array. The pixel coordinate origin is at the top left corner of the 2D array and goes right-wards and downwards, such that for an array of shape (3,3) where ...
python
{ "resource": "" }
q257872
sparse_to_unmasked_sparse_from_mask_and_pixel_centres
validation
def sparse_to_unmasked_sparse_from_mask_and_pixel_centres(total_sparse_pixels, mask, unmasked_sparse_grid_pixel_centres): """Determine the mapping between every masked pixelization-grid pixel and pixelization-grid pixel. This is performed by checking whe...
python
{ "resource": "" }
q257873
unmasked_sparse_to_sparse_from_mask_and_pixel_centres
validation
def unmasked_sparse_to_sparse_from_mask_and_pixel_centres(mask, unmasked_sparse_grid_pixel_centres, total_sparse_pixels): """Determine the mapping between every pixelization-grid pixel and masked pixelization-grid pixel. This is performed by checking whe...
python
{ "resource": "" }
q257874
regular_to_sparse_from_sparse_mappings
validation
def regular_to_sparse_from_sparse_mappings(regular_to_unmasked_sparse, unmasked_sparse_to_sparse): """Using the mapping between the regular-grid and unmasked pixelization grid, compute the mapping between each regular pixel and the masked pixelization grid. Parameters ----------- regular_to_unmaske...
python
{ "resource": "" }
q257875
sparse_grid_from_unmasked_sparse_grid
validation
def sparse_grid_from_unmasked_sparse_grid(unmasked_sparse_grid, sparse_to_unmasked_sparse): """Use the central arc-second coordinate of every unmasked pixelization grid's pixels and mapping between each pixelization pixel and unmasked pixelization pixel to compute the central arc-second coordinate of every mask...
python
{ "resource": "" }
q257876
extracted_array_2d_from_array_2d_and_coordinates
validation
def extracted_array_2d_from_array_2d_and_coordinates(array_2d, y0, y1, x0, x1): """Resize an array to a new size by extracting a sub-set of the array. The extracted input coordinates use NumPy convention, such that the upper values should be specified as +1 the \ dimensions of the extracted array. In ...
python
{ "resource": "" }
q257877
resized_array_2d_from_array_2d_and_resized_shape
validation
def resized_array_2d_from_array_2d_and_resized_shape(array_2d, resized_shape, origin=(-1, -1), pad_value=0.0): """Resize an array to a new size around a central pixel. If the origin (e.g. the central pixel) of the resized array is not specified, the central pixel of the array is \ calculated automatically....
python
{ "resource": "" }
q257878
bin_up_array_2d_using_mean
validation
def bin_up_array_2d_using_mean(array_2d, bin_up_factor): """Bin up an array to coarser resolution, by binning up groups of pixels and using their mean value to determine \ the value of the new pixel. If an array of shape (8,8) is input and the bin up size is 2, this would return a new array of size (4,4) ...
python
{ "resource": "" }
q257879
numpy_array_2d_to_fits
validation
def numpy_array_2d_to_fits(array_2d, file_path, overwrite=False): """Write a 2D NumPy array to a .fits file. Before outputting a NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \ appear the same orientation as .fits files loaded in DS9. Parameters --------...
python
{ "resource": "" }
q257880
numpy_array_2d_from_fits
validation
def numpy_array_2d_from_fits(file_path, hdu): """Read a 2D NumPy array to a .fits file. After loading the NumPy array, the array is flipped upside-down using np.flipud. This is so that the arrays \ appear the same orientation as .fits files loaded in DS9. Parameters ---------- file_path : str ...
python
{ "resource": "" }
q257881
ConvolverMappingMatrix.convolve_mapping_matrix
validation
def convolve_mapping_matrix(self, mapping_matrix): """For a given inversion mapping matrix, convolve every pixel's mapped regular with the PSF kernel. A mapping matrix provides non-zero entries in all elements which map two pixels to one another (see *inversions.mappers*). For example,...
python
{ "resource": "" }
q257882
EllipticalMassProfile.mass_within_circle_in_units
validation
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...
python
{ "resource": "" }
q257883
EllipticalMassProfile.mass_within_ellipse_in_units
validation
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...
python
{ "resource": "" }
q257884
EllipticalMassProfile.mass_integral
validation
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)
python
{ "resource": "" }
q257885
EllipticalMassProfile.density_between_circular_annuli_in_angular_units
validation
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...
python
{ "resource": "" }
q257886
EllipticalCoredPowerLaw.einstein_radius_rescaled
validation
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)
python
{ "resource": "" }
q257887
EllipticalCoredPowerLaw.convergence_from_grid
validation
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...
python
{ "resource": "" }
q257888
AbstractEllipticalGeneralizedNFW.tabulate_integral
validation
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...
python
{ "resource": "" }
q257889
AbstractEllipticalSersic.intensity_at_radius
validation
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...
python
{ "resource": "" }
q257890
AbstractEllipticalSersic.sersic_constant
validation
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...
python
{ "resource": "" }
q257891
Galaxy.luminosity_within_circle_in_units
validation
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 ...
python
{ "resource": "" }
q257892
Galaxy.luminosity_within_ellipse_in_units
validation
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...
python
{ "resource": "" }
q257893
Galaxy.mass_within_circle_in_units
validation
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...
python
{ "resource": "" }
q257894
Galaxy.mass_within_ellipse_in_units
validation
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...
python
{ "resource": "" }
q257895
Galaxy.einstein_radius_in_units
validation
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...
python
{ "resource": "" }
q257896
Galaxy.einstein_mass_in_units
validation
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...
python
{ "resource": "" }
q257897
HyperGalaxy.hyper_noise_from_contributions
validation
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 ...
python
{ "resource": "" }
q257898
ConvolverImage.convolve_image
validation
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. ...
python
{ "resource": "" }
q257899
intensities_of_galaxies_from_grid
validation
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 \ ...
python
{ "resource": "" }