LazyComparisonMask¶
-
class
spectral_cube.LazyComparisonMask(function, comparison_value, cube=None, data=None, wcs=None)[source]¶ Bases:
spectral_cube.LazyMaskA boolean mask defined by the evaluation of a comparison function between a fixed dataset and some other value.
This is conceptually similar to the
LazyMaskbut it will ensure that the comparison value can be compared to the dataParameters: function : callable
The function to apply to
data. This method should accept a numpy array, which will be the data array passed to __init__, and a second argument also passed to __init__. It should return a boolean array, whereTruevalues indicate that which pixels are valid/unaffected by masking.comparison_value : float or array
The comparison value for the array
data : array-like
The array to evaluate
functionon. This should support Numpy-like slicing syntax.wcs :
WCSThe WCS of the input data, which is used to define the coordinates for which the boolean mask is defined.
Methods Summary
any()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[, ...])Get a LazyComparisonMask copy with a WCS in the modified unit Methods Documentation
-
any()¶
-
exclude(data=None, wcs=None, view=(), **kwargs)¶ Return a boolean array indicating which values should be excluded.
If
viewis 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
viewis 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, aplpy_kwargs={})¶ 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.
use_aplpy : bool, optional
Try plotting with the aplpy package
aplpy_kwargs : dict, optional
kwargs passed to
FITSFigure.
-