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:
Mask1D
A 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
all
all_false
Setup a 1D mask where all pixels are unmasked.
astype
copy
flip_hdu_for_ds9
from_fits
Loads the 1D mask from a .fits file.
from_primary_hdu
Returns an
Mask1D
by from a PrimaryHDU object which has been loaded via astropy.fitsinstance_flatten
Flatten an instance of an autoarray class into a tuple of its attributes (i.e.
instance_unflatten
Unflatten a tuple of attributes (i.e.
invert
mask_new_sub_size_from
Returns the mask on the same scaled coordinate system but with a sub-grid of an inputsub_size.
masked_eper_from_layout
masked_fpr_and_eper_from
masked_fpr_from_layout
max
min
output_to_fits
Write the 1D mask to a .fits file.
reshape
sqrt
sum
with_new_array
Copy this object but give it a new array.
Attributes
array
derive_grid
derive_mask
dimensions
dtype
geometry
Return the 1D geometry of the mask, representing its uniform rectangular grid of (x) coordinates defined by its
shape_native
.hdu_for_output
The mask as a HDU object, which can be output to a .fits file.
imag
is_all_false
Returns False if all pixels in a mask are False, else returns True.
is_all_true
Returns True if all pixels in a mask are True, else returns False.
mask
native
Returns the data structure in its native format which contains all unmaksed values to the native dimensions.
ndim
pixel_scale
For 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_header
Returns the pixel scale of the mask as a header dictionary, which can be written to a .fits file.
pixel_scales
pixels_in_mask
The total number of unmasked pixels (values are False) in the mask.
real
shape
shape_native
shape_slim
The 1D shape of the mask, which is equivalent to the total number of unmasked pixels in the mask.
size
sub_fraction
The fraction of the area of a pixel every sub-pixel contains.
sub_length
The total number of sub-pixels in a give pixel,
sub_pixels_in_mask
The total number of unmasked sub-pixels (values are False) in the mask.
sub_shape_native
sub_shape_slim
The 1D shape of the mask's sub-grid, which is equivalent to the total number of unmasked pixels in the mask.