BooleanArrayMask

class spectral_cube.BooleanArrayMask(mask, wcs, shape=None, include=True)[source]

Bases: spectral_cube.MaskBase

A mask defined as an array on a spectral cube WCS

Parameters:

mask: `numpy.ndarray`

A boolean numpy ndarray

wcs: `astropy.wcs.WCS`

The WCS object

shape: tuple

The shape of the region the array is masking. This is required if mask.ndim != data.ndim to provide rules for how to broadcast the mask

Attributes Summary

shape

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[, ...]) Get a BooleanArrayMask copy with a WCS in the modified unit

Attributes Documentation

shape

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.

with_spectral_unit(unit, velocity_convention=None, rest_value=None)[source]

Get a BooleanArrayMask copy with a WCS in the modified unit

Parameters:

unit : u.Unit

Any valid spectral unit: velocity, (wave)length, or frequency. Only vacuum units are supported.

velocity_convention : u.doppler_relativistic, u.doppler_radio, or u.doppler_optical

The velocity convention to use for the output velocity axis. Required if the output type is velocity.

rest_value : u.Quantity

A rest wavelength or frequency with appropriate units. Required if output type is velocity. The cube’s WCS should include this already if the input type is velocity, but the WCS’s rest wavelength/frequency can be overridden with this parameter.