FunctionMask¶
-
class
spectral_cube.
FunctionMask
(function)[source]¶ Bases:
spectral_cube.MaskBase
A mask defined by a function that is evaluated at run-time using the data passed to the mask.
This function differs from
LazyMask
in the arguments which are passed to the function. FunctionMasks receive an array, wcs object, and view, whereas LazyMasks receive pre-sliced views into an array specified at mask-creation time.Parameters: function : callable
The function to evaluate the mask. The call signature should be
function(data, wcs, slice)
wheredata
andwcs
are the arguments that get passed to e.g.include
,exclude
,_filled
, and_flattened
. The function should return a boolean array, whereTrue
values indicate that which pixels are valid / unaffected by masking.Methods Summary
exclude
([data, wcs, view])Return a boolean array indicating which values should be excluded. include
([data, wcs, view])Return a boolean array indicating which values should be included. quicklook
(view[, wcs, filename, use_aplpy])View a 2D slice of the mask, specified by view. with_spectral_unit
(unit[, ...])Functional masks do not have WCS defined, so this simply returns a copy Methods Documentation
-
exclude
(data=None, wcs=None, view=(), **kwargs)¶ Return a boolean array indicating which values should be excluded.
If
view
is passed, only the sliced mask will be returned, which avoids having to load the whole mask in memory. Otherwise, the whole mask is returned in-memory.kwargs are passed to _validate_wcs
-
include
(data=None, wcs=None, view=(), **kwargs)¶ Return a boolean array indicating which values should be included.
If
view
is passed, only the sliced mask will be returned, which avoids having to load the whole mask in memory. Otherwise, the whole mask is returned in-memory.kwargs are passed to _validate_wcs
-
quicklook
(view, wcs=None, filename=None, use_aplpy=True)¶ View a 2D slice of the mask, specified by view.
Parameters: view : tuple
Slicing to apply to the mask. Must return a 2D slice.
wcs : astropy.wcs.WCS, optional
WCS object to use in plotting the mask slice.
filename : str, optional
Filename of the output image. Enables saving of the plot.
-