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
allReturns True if all elements evaluate to True.
all_falseSetup a 1D mask where all pixels are unmasked.
anyReturns True if any of the elements of a evaluate to True.
argmaxReturn indices of the maximum values along the given axis.
argminReturn indices of the minimum values along the given axis.
argpartitionReturns the indices that would partition this array.
argsortReturns the indices that would sort this array.
astypeCopy of the array, cast to a specified type.
byteswapSwap the bytes of the array elements
chooseUse an index array to construct a new array from a set of choices.
clipReturn an array whose values are limited to
[min, max].compressReturn selected slices of this array along given axis.
conjComplex-conjugate all elements.
conjugateReturn the complex conjugate, element-wise.
copyReturn a copy of the array.
cumprodReturn the cumulative product of the elements along the given axis.
cumsumReturn the cumulative sum of the elements along the given axis.
diagonalReturn specified diagonals.
dotdumpDump a pickle of the array to the specified file.
dumpsReturns the pickle of the array as a string.
fillFill the array with a scalar value.
flattenReturn a copy of the array collapsed into one dimension.
from_fitsLoads the 1D mask from a .fits file.
getfieldReturns a field of the given array as a certain type.
itemCopy an element of an array to a standard Python scalar and return it.
itemsetInsert scalar into an array (scalar is cast to array's dtype, if possible)
mask_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_layoutmaxReturn the maximum along a given axis.
meanReturns the average of the array elements along given axis.
minReturn the minimum along a given axis.
newbyteorderReturn the array with the same data viewed with a different byte order.
nonzeroReturn the indices of the elements that are non-zero.
output_to_fitsWrite the 1D mask to a .fits file.
partitionRearranges the elements in the array in such a way that the value of the element in kth position is in the position it would be in a sorted array.
prodReturn the product of the array elements over the given axis
ptpPeak to peak (maximum - minimum) value along a given axis.
putSet
a.flat[n] = values[n]for all n in indices.ravelReturn a flattened array.
repeatRepeat elements of an array.
reshapeReturns an array containing the same data with a new shape.
resizeChange shape and size of array in-place.
roundReturn a with each element rounded to the given number of decimals.
searchsortedFind indices where elements of v should be inserted in a to maintain order.
setfieldPut a value into a specified place in a field defined by a data-type.
setflagsSet array flags WRITEABLE, ALIGNED, WRITEBACKIFCOPY, respectively.
sortSort an array in-place.
squeezeRemove axes of length one from a.
stdReturns the standard deviation of the array elements along given axis.
sumReturn the sum of the array elements over the given axis.
swapaxesReturn a view of the array with axis1 and axis2 interchanged.
takeReturn an array formed from the elements of a at the given indices.
tobytesConstruct Python bytes containing the raw data bytes in the array.
tofileWrite array to a file as text or binary (default).
tolistReturn the array as an
a.ndim-levels deep nested list of Python scalars.tostringA compatibility alias for tobytes, with exactly the same behavior.
traceReturn the sum along diagonals of the array.
transposeReturns a view of the array with axes transposed.
varReturns the variance of the array elements, along given axis.
viewNew view of array with the same data.
Attributes
TThe transposed array.
baseBase object if memory is from some other object.
ctypesAn object to simplify the interaction of the array with the ctypes module.
dataPython buffer object pointing to the start of the array's data.
derive_gridderive_maskdimensionsdtypeData-type of the array's elements.
flagsInformation about the memory layout of the array.
flatA 1-D iterator over the array.
geometryReturn the 1D geometry of the mask, representing its uniform rectangular grid of (x) coordinates defined by its
shape_native.imagThe imaginary part of the array.
is_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.
itemsizeLength of one array element in bytes.
nativeReturns the data structure in its native format which contains all unmaksed values to the native dimensions.
nbytesTotal bytes consumed by the elements of the array.
ndimNumber of array dimensions.
pixel_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_scalespixels_in_maskThe total number of unmasked pixels (values are False) in the mask.
realThe real part of the array.
shapeTuple of array dimensions.
shape_nativeshape_slimThe 1D shape of the mask, which is equivalent to the total number of unmasked pixels in the mask.
sizeNumber of elements in the array.
stridesTuple of bytes to step in each dimension when traversing an array.
sub_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.