def mask_new_sub_size_from_mask(self, mask, sub_size=1): return msk.Mask( mask_2d=mask, sub_size=sub_size, pixel_scales=self.mask.pixel_scales, origin=self.mask.origin, )
def mask_sub_1(self): return msk.Mask( mask_2d=self.mask, sub_size=1, pixel_scales=self.mask.pixel_scales, origin=self.mask.origin, )
def edge_buffed_mask(self): edge_buffed_mask = mask_util.buffed_mask_2d_from_mask_2d( mask_2d=self.mask).astype("bool") return msk.Mask( mask_2d=edge_buffed_mask, pixel_scales=self.mask.pixel_scales, sub_size=self.mask.sub_size, origin=self.mask.origin, )
def rescaled_mask_from_rescale_factor(self, rescale_factor): rescaled_mask = mask_util.rescaled_mask_2d_from_mask_2d_and_rescale_factor( mask_2d=self.mask, rescale_factor=rescale_factor) return msk.Mask( mask_2d=rescaled_mask, pixel_scales=self.mask.pixel_scales, sub_size=self.mask.sub_size, origin=self.mask.origin, )
def binned_mask_from_bin_up_factor(self, bin_up_factor): binned_up_mask = binning_util.bin_mask_2d(mask_2d=self.mask, bin_up_factor=bin_up_factor) return msk.Mask( mask_2d=binned_up_mask, pixel_scales=self.binned_pixel_scales_from_bin_up_factor( bin_up_factor=bin_up_factor), sub_size=self.mask.sub_size, origin=self.mask.origin, )
def edge_mask(self): """The indicies of the mask's border pixels, where a border pixel is any unmasked pixel on an exterior edge (e.g. next to at least one pixel with a *True* value but not central pixels like those within \ an annulus mask). """ mask = np.full(fill_value=True, shape=self.mask.shape) mask[self._edge_2d_indexes[:, 0], self._edge_2d_indexes[:, 1]] = False return msk.Mask( mask_2d=mask, sub_size=self.mask.sub_size, pixel_scales=self.mask.pixel_scales, origin=self.mask.origin, )
def resized_mask_from_new_shape(self, new_shape): """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. """ resized_mask_2d = array_util.resized_array_2d_from_array_2d( array_2d=self.mask, resized_shape=new_shape).astype("bool") return msk.Mask( mask_2d=resized_mask_2d, pixel_scales=self.mask.pixel_scales, sub_size=self.mask.sub_size, origin=self.mask.origin, )
def blurring_mask_from_kernel_shape(self, kernel_shape_2d): """Compute a blurring mask, which represents all masked pixels whose light will be blurred into unmasked \ pixels via PSF convolution (see grid.Grid.blurring_grid_from_mask_and_psf_shape). Parameters ---------- kernel_shape_2d : (int, int) The shape of the psf which defines the blurring region (e.g. the shape of the PSF) """ if kernel_shape_2d[0] % 2 == 0 or kernel_shape_2d[1] % 2 == 0: raise exc.MaskException("psf_size of exterior region must be odd") blurring_mask = mask_util.blurring_mask_2d_from_mask_2d_and_kernel_shape_2d( mask_2d=self.mask, kernel_shape_2d=kernel_shape_2d) return msk.Mask( mask_2d=blurring_mask, sub_size=1, pixel_scales=self.mask.pixel_scales, origin=self.mask.origin, )