Mask_and_Moments

class turbustat.data_reduction.Mask_and_Moments(cube, noise_type='constant', clip=3, scale=None, moment_method='slice')[source] [edit on github]

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_-ube.

Parameters:

cube : SpectralCube or str

Either a SpectralCube object, or the filename of a cube readable by spectral-cube.

noise_type : {‘constant’}, optional

NO CURRENT FUNCTION Once implemented, it will set parameters for deriving the noise level.

clip : float, optional

Sigma level to clip data at.

scale : Quantity, optional

The noise level in the cube. Overrides estimation using signal_id

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

intint
intint_err
linewidth
linewidth_err
moment0
moment0_err
moment1
moment1_err

Methods Summary

all_moment_errs()
all_moments()
find_noise([return_obj]) Returns noise estimate, or the whole Noise object.
from_fits(fits_name[, moments_prefix, ...]) Load pre-made moment arrays given a cube name.
get_prop_hdrs() Generate headers for the moments.
make_mask(mask) Apply a mask to the cube.
make_moment_errors([axis]) Calculate the errors in the moments.
make_moments([axis, units]) Calculate the moments.
to_dict() Returns a dictionary form containing the cube and the property arrays.
to_fits([save_name]) Save the property arrays as fits files.

Attributes Documentation

intint
intint_err
linewidth
linewidth_err
moment0
moment0_err
moment1
moment1_err

Methods Documentation

all_moment_errs()[source] [edit on github]
all_moments()[source] [edit on github]
find_noise(return_obj=False)[source] [edit on github]

Returns noise estimate, or the whole Noise object.

Parameters:

return_obj : bool, optional

If True, returns the Noise object. Otherwise returns the estimated noise level.

static from_fits(fits_name, moments_prefix=None, moments_path=None, mask_name=None, moment0=None, centroid=None, linewidth=None, intint=None, scale=None)[source] [edit on github]

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 solved test_moment0.fits). Otherwise, specify a path to one of the keyword arguments.

Parameters:

fits_name : str

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_prefix : str, optional

If a SpectralCube object is given in fits_name, the prefix for the saved files can be provided here.

moments_path : str, optional

Path to where the moments are saved.

mask_name : str, optional

Filename of a saved mask to be applied to the data.

moment0 : str, optional

Filename of the moment0 array. Use if naming scheme is not valid for automatic loading.

centroid : str, optional

Filename of the centroid array. Use if naming scheme is not valid for automatic loading.

linewidth : str, optional

Filename of the linewidth array. Use if naming scheme is not valid for automatic loading.

intint : str, optional

Filename of the integrated intensity 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

get_prop_hdrs()[source] [edit on github]

Generate headers for the moments.

make_mask(mask)[source] [edit on github]

Apply a mask to the cube.

Parameters:

mask : spectral-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.

make_moment_errors(axis=0)[source] [edit on github]

Calculate the errors in the moments.

Parameters:

axis : int, optional

The axis to calculate the moments along.

make_moments(axis=0, units=True)[source] [edit on github]

Calculate the moments.

Parameters:

axis : int, optional

The axis to calculate the moments along.

units : bool, optional

If enabled, the units of the arrays are kept.

to_dict()[source] [edit on github]

Returns a dictionary form containing the cube and the property arrays. This is the expected form for the wrapper scripts and methods in TurbuStat.

to_fits(save_name=None)[source] [edit on github]

Save the property arrays as fits files.

Parameters:

save_name : str, optional

Prefix to use when saving the moment arrays. If None is given, ‘default’ is used.