Moments¶
- class turbustat.moments.Moments(cube, scale=None, moment_method='slice')[source]¶
Bases:
object
A unified approach to deriving the noise level in a cube, applying a mask, and deriving moments along with their errors. All the heavy lifting is done with spectral_cube.
- Parameters:
- cubeSpectralCube or str
Either a SpectralCube object, or the filename of a cube readable by spectral-cube.
- scale
Quantity
, optional The noise level in the cube. Used to estimate uncertainties of the moment maps.
- moment_method{‘slice’, ‘cube’, ‘ray’}, optional
The method to use for creating the moments. See the spectral-cube docs for an explanation of the differences.
Attributes Summary
Methods Summary
apply_mask
(mask)Apply a mask to the cube.
from_fits
(fits_name[, moments_prefix, ...])Load pre-made moment arrays given a cube name.
Generate headers for the moments.
make_moment_errors
([axis, scale])Calculate the errors in the moments.
make_moments
([axis, units])Calculate the moments.
to_dict
()Returns a dictionary with the cube and the property arrays.
to_fits
([save_name])Save the property arrays as fits files.
Attributes Documentation
- linewidth¶
- linewidth_err¶
- moment0¶
- moment0_err¶
- moment1¶
- moment1_err¶
- scale¶
Methods Documentation
- apply_mask(mask)[source]¶
Apply a mask to the cube.
- Parameters:
- maskspectral-cube Mask or numpy.ndarray, optional
The mask to be applied to the data. If None is given, RadioMask is used with its default settings.
- static from_fits(fits_name, moments_prefix=None, moments_path=None, mask_name=None, moment0=None, centroid=None, linewidth=None, scale=None)[source]¶
Load pre-made moment arrays given a cube name. Saved moments must match the naming of the cube for the automatic loading to work (e.g. a cube called test.fits will have a moment 0 array with the name test_moment0.fits). Otherwise, specify a path to one of the keyword arguments.
- Parameters:
- fits_namestr
Filename of the cube or a SpectralCube object. If a filename is given, it is also used as the prefix to the saved moment files.
- moments_prefixstr, optional
If a SpectralCube object is given in
fits_name
, the prefix for the saved files can be provided here.- moments_pathstr, optional
Path to where the moments are saved.
- mask_namestr, optional
Filename of a saved mask to be applied to the data.
- moment0str, optional
Filename of the moment0 array. Use if naming scheme is not valid for automatic loading.
- centroidstr, optional
Filename of the centroid array. Use if naming scheme is not valid for automatic loading.
- linewidthstr, optional
Filename of the linewidth array. Use if naming scheme is not valid for automatic loading.
- scale
Quantity
, optional The noise level in the cube. Overrides estimation using signal_id
- make_moment_errors(axis=0, scale=None)[source]¶
Calculate the errors in the moments.
- Parameters:
- axisint, optional
The axis to calculate the moments along.