Deriving Cube Moments

The Moments class returns moment arrays as well as their errors for use with 2D statistics in the package. Moments are derived using spectral-cube. Definitions for the moments are also available in the spectral-cube documentation.

Basic Use

Moments are easily returned in the expected form for the statistics with Moments. This class takes a FITS file of a spectral-line cube as input and creates moment arrays (zeroth, first, and line width) with their respective uncertainties.:

>>> from turbustat.moments import Moments  
>>> # Load in the cube "test.fits"
>>> mm = Moments("test.fits")  
>>> mm.make_moments()  
>>> mm.make_moment_errors()  
>>> output_dict = mm.to_dict()  

output_dict is a dictionary that contains keys for the cube and moments. The moment keys contain a list of the moment and its error map.

The moments can also be saved to FITS files. The to_fits function saves FITS files of each moment. The input to the function is the prefix to use in the filenames:

>>> mm.to_fits("test")  

This will produce three FITS files: test_moment0.fits, test_centroid.fits, test_linewidth.fits for the zeroth, first, and square-root of the second moments, respectively. These FITS files will contain two extensions, the first with the moment map and the second with the uncertainty map for that moment.

Source Code

Classes

Moments(cube[, scale, moment_method]) A unified approach to deriving the noise level in a cube, applying a mask, and deriving moments along with their errors.