StokesSpectralCube¶
-
class
spectral_cube.
StokesSpectralCube
(stokes_data, mask=None, meta=None, fill_value=None)[source]¶ Bases:
object
A class to store a spectral cube with multiple Stokes parameters.
The individual Stokes cubes can share a common mask in addition to having component-specific masks.
Attributes Summary
components
mask
The underlying mask shape
wcs
Methods Summary
read
(filename[, format, hdu])Read a spectral cube from a file. with_mask
(mask[, inherit_mask])Return a new StokesSpectralCube instance that contains a composite mask of the current StokesSpectralCube and the new mask
.with_spectral_unit
(unit, **kwargs)write
(filename[, overwrite, format])Write the spectral cube to a file. Attributes Documentation
-
components
¶
-
mask
¶ The underlying mask
-
shape
¶
-
wcs
¶
Methods Documentation
-
classmethod
read
(filename, format=None, hdu=None, **kwargs)[source]¶ Read a spectral cube from a file.
If the file contains Stokes axes, they will be read in. If you are only interested in the unpolarized emission (I), you can use
read()
instead.Parameters: filename : str
The file to read the cube from
format : str
The format of the file to read. (Currently limited to ‘fits’ and ‘casa_image’)
hdu : int or str
For FITS files, the HDU to read in (can be the ID or name of an HDU).
Returns: cube :
SpectralCube
-
with_mask
(mask, inherit_mask=True)[source]¶ Return a new StokesSpectralCube instance that contains a composite mask of the current StokesSpectralCube and the new
mask
.Parameters: mask :
MaskBase
instance, or boolean numpy arrayThe mask to apply. If a boolean array is supplied, it will be converted into a mask, assuming that
True
values indicate included elements.inherit_mask : bool (optional, default=True)
If True, combines the provided mask with the mask currently attached to the cube
Returns: new_cube :
StokesSpectralCube
A cube with the new mask applied.
Notes
This operation returns a view into the data, and not a copy.
-