keflavich / cube-line-extractor

4 stars 1 forks source link

CubeLineMoment.py:

Script to derive Moment0, Moment1, and Moment2 from a set of input-defined spectral lines in an image cube. Currently simply calculates moments over a defined HWZI for each line in band.

To run in ipython use:

run CubeLineMoment.py yaml_scripts/CubeLineMomentInput.yaml

YAML File Input Parameters:

Masking Used in CubeLineMoment:

Warning Messages

Note that several of these warning messages are due to the use of NaN values as blanking values in spectral cubes. All of these warnings are for information only and can safely be ignored.

WARNING: StokesWarning: Cube is a Stokes cube, returning spectral cube for I component [spectral_cube.io.core]

Explanation: Cube contains a fourth Stokes axis. Information only. No action required.

WARNING: PossiblySlowWarning: This function (<function BaseSpectralCube.std at 0x19e9053a0>) requires loading the entire cube into memory and may therefore be slow. [spectral_cube.utils]

Explanation: CubeLineMoment does some calculation on entire cubes. Information only. No action required.

/Users/jmangum/anaconda3/envs/python39/lib/python3.9/site-packages/numpy/lib/nanfunctions.py:1878: RuntimeWarning: Degrees of freedom <= 0 for slice.
  var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,

Explanation: There is at least one spectrum that consists of only 1 pixel, so the standard deviation can't be computed. i.e., noisemask.with_mask(mask[:,None,None]).include().sum(axis=0) will have at least one pixel with value 1. Information only. No action required.

/Users/jmangum/anaconda3/envs/python39/lib/python3.9/site-packages/spectral_cube/spectral_cube.py:441: RuntimeWarning: All-NaN slice encountered

Explanation: This warning often results from the calculation of the maximum value along the spectral axis toward each pixel in cutoutcube. Since cutoutcube can have blanked (NaN) values, there is often at least one position where all spectral values are blanked (NaN). Information only. No action required.

/Users/jmangum/Python/mangum_galaxies-master/CubeLineMoment.py:435: RuntimeWarning: divide by zero encountered in divide

Explanation: This warning results from the fact that the denominator in a divide uses a cube with NaN values. Since it is common for a cube to use NaN as a blanking value, this warning is common. Information only. No action required.

GaussfitGalaxies.py:

An implementation of gaussfit_catalog (see https://github.com/radio-astro-tools/gaussfit_catalog) using astropy models to do gaussian fits to a list of input FITS files using a list of input positions from a DS9 regions file.

If you have input regions which are off the image, the script will squawk but not crash.

The input regions are the initial guesses, but they should be very close to the peak. Note that gaussfit_catalog is catered to situations where the background was a significant confusing factor once you got more than 1-2 beam FWHM from the peak, so it is quite restrictive in how far it will wander beyond the initial position guess.

The four panels in the output png files are showing:

The .ipac files are in the "ascii.ipac” format from astropy. In those files, the non-obvious columns are:

Two examples of a similar implementation of gaussfit_catalog are: https://github.com/keflavich/W51_ALMA_2013.1.00308.S/blob/0789ccbb2fd3bfe801cfb63818ad2696825d076f/analysis/longbaseline/gaussfit_sources.py https://github.com/keflavich/SgrB2_ALMA_3mm_Mosaic/blob/93fe253f6de499cc91779bdae4f0e22ab806c161/analysis/gaussfit_sources.py