autocti.Mask1D#
- class autocti.Mask1D(mask: Union[ndarray, List], pixel_scales: Union[Tuple[float], Tuple[float, float], float], sub_size: int = 1, origin: Tuple[float] = (0.0,), invert: bool = False)[source]#
Bases:
Mask1DA 1D mask, representing 1D data on a uniform line of pixels with equal spacing.
When applied to 1D data it extracts or masks the unmasked image pixels corresponding to mask entries that are False or 0).
The mask also defines the geometry of the 1D data structure it is paired to, for example how every pixel coordinate on the 1D line of data converts to physical units via the pixel_scales and origin parameters and a sub-grid which is used for performing calculations via super-sampling.
- Parameters:
mask – The ndarray of shape [total_pixels] containing the bool’s representing the mask, where False signifies an entry is unmasked and used in calculations.
pixel_scales – The scaled units to pixel units conversion factor of each pixel.
origin – The x origin of the mask’s coordinate system in scaled units.
Methods
allall_falseSetup a 1D mask where all pixels are unmasked.
astypecopyflip_hdu_for_ds9from_fitsLoads the 1D mask from a .fits file.
from_primary_hduReturns an
Mask1Dby from a PrimaryHDU object which has been loaded via astropy.fitsinstance_flattenFlatten an instance of an autoarray class into a tuple of its attributes (i.e.
instance_unflattenUnflatten a tuple of attributes (i.e.
invertmask_new_sub_size_fromReturns the mask on the same scaled coordinate system but with a sub-grid of an inputsub_size.
masked_eper_from_layoutmasked_fpr_and_eper_frommasked_fpr_from_layoutmaxminoutput_to_fitsWrite the 1D mask to a .fits file.
reshapesqrtsumwith_new_arrayCopy this object but give it a new array.
Attributes
arrayderive_gridderive_maskdimensionsdtypegeometryReturn the 1D geometry of the mask, representing its uniform rectangular grid of (x) coordinates defined by its
shape_native.hdu_for_outputThe mask as a HDU object, which can be output to a .fits file.
imagis_all_falseReturns False if all pixels in a mask are False, else returns True.
is_all_trueReturns True if all pixels in a mask are True, else returns False.
masknativeReturns the data structure in its native format which contains all unmaksed values to the native dimensions.
ndimpixel_scaleFor a mask with dimensions two or above check that are pixel scales are the same, and if so return this single value as a float.
pixel_scale_headerReturns the pixel scale of the mask as a header dictionary, which can be written to a .fits file.
pixel_scalespixels_in_maskThe total number of unmasked pixels (values are False) in the mask.
realshapeshape_nativeshape_slimThe 1D shape of the mask, which is equivalent to the total number of unmasked pixels in the mask.
sizesub_fractionThe fraction of the area of a pixel every sub-pixel contains.
sub_lengthThe total number of sub-pixels in a give pixel,
sub_pixels_in_maskThe total number of unmasked sub-pixels (values are False) in the mask.
sub_shape_nativesub_shape_slimThe 1D shape of the mask's sub-grid, which is equivalent to the total number of unmasked pixels in the mask.