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
The underlying mask
Read and parse a dataset and return as a StokesSpectralCube
The underlying data
Defines the type of stokes that has been setup.
stokes_type
can be sky, linear, circular, generic, or other.Write this StokesSpectralCube object out in the specified format.
Methods Summary
transform_basis
([stokes_basis])The goal of this function is to transform the stokes basis of the cube to the one specified if possible.
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)Attributes Documentation
- components¶
- mask¶
The underlying mask
- read¶
Read and parse a dataset and return as a StokesSpectralCube
This allows easily reading a dataset in several supported data formats using syntax such as:
>>> from spectral_cube import StokesSpectralCube >>> cube1 = StokesSpectralCube.read('cube.fits', format='fits') >>> cube2 = StokesSpectralCube.read('cube.image', format='casa')
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.Get help on the available readers for StokesSpectralCube using the``help()`` method:
>>> StokesSpectralCube.read.help() # Get help reading StokesSpectralCube and list supported formats >>> StokesSpectralCube.read.help('fits') # Get detailed help on StokesSpectralCube FITS reader >>> StokesSpectralCube.read.list_formats() # Print list of available formats
See also: http://docs.astropy.org/en/stable/io/unified.html
- Parameters:
- *argstuple, optional
Positional arguments passed through to data reader. If supplied the first argument is typically the input filename.
- formatstr
File format specifier.
- **kwargsdict, optional
Keyword arguments passed through to data reader.
- Returns:
- cube
StokesSpectralCube
StokesSpectralCube corresponding to dataset
- cube
- shape¶
- stokes_data¶
The underlying data
- stokes_type¶
- Defines the type of stokes that has been setup.
stokes_type
can be sky, linear, circular, generic, or other. Sky
refers to stokes in sky basis, I,Q,U,VLinear
refers to the stokes in linear feed basis, XX, XY, YX, YYCircular
refers to stokes in circular feed basis, RR, RL, LR, LLGeneric
refers to the general four orthogonal components, PP, PQ, QP, QQ
- Defines the type of stokes that has been setup.
- wcs¶
- write¶
Write this StokesSpectralCube object out in the specified format.
This allows easily writing a dataset in many supported data formats using syntax such as:
>>> data.write('data.fits', format='fits')
Get help on the available writers for StokesSpectralCube using the``help()`` method:
>>> StokesSpectralCube.write.help() # Get help writing StokesSpectralCube and list supported formats >>> StokesSpectralCube.write.help('fits') # Get detailed help on StokesSpectralCube FITS writer >>> StokesSpectralCube.write.list_formats() # Print list of available formats
See also: http://docs.astropy.org/en/stable/io/unified.html
- Parameters:
- *argstuple, optional
Positional arguments passed through to data writer. If supplied the first argument is the output filename.
- formatstr
File format specifier.
- **kwargsdict, optional
Keyword arguments passed through to data writer.
Methods Documentation
- transform_basis(stokes_basis='')[source]¶
The goal of this function is to transform the stokes basis of the cube to the one specified if possible. In principle one needs at least two related stokes of a given basis for the transformation to be possible. At this moment we are limiting it to the cases where all four stokes parameters in a given basis be available within the cube. The transformations are as follows Linear to Sky I = (XX + YY) / 2 Q = (XX - YY) / 2 U = (XY + YX) / 2 V = 1j(XY - YX) / 2
Circular to Sky I = (RR + LL) / 2 Q = (RL + LR) / 2 U = 1j*(RL - LR) / 2 V = (RR - LL) / 2
- 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 array The mask to apply. If a boolean array is supplied, it will be converted into a mask, assuming that
True
values indicate included elements.- inherit_maskbool (optional, default=True)
If True, combines the provided mask with the mask currently attached to the cube
- mask
- Returns:
- new_cube
StokesSpectralCube
A cube with the new mask applied.
- new_cube
Notes
This operation returns a view into the data, and not a copy.