radio-astro-tools / spectral-cube

Library for reading and analyzing astrophysical spectral data cubes
http://spectral-cube.rtfd.org
BSD 3-Clause "New" or "Revised" License
98 stars 65 forks source link

moment 2 map #849

Closed gvdsteene closed 11 months ago

gvdsteene commented 2 years ago

A moment 2 map is a variance map. How come that I obtain negative values ?

keflavich commented 2 years ago

You generally shouldn't, but it is likely to occur when using velocities. The equation for moment-2 is: $\frac{\Sigma (y - )^2 x dx}{\Sigma{y dx}}$ If there are X-values that are negative (negative velocities) that get more weight than the positive values, the moment will be negative. This should not occur if the S/N is high.

e-koch commented 2 years ago

To add to this, a mixture of negative and positive intensities (i.e., noise) can also give you a negative variance because it's an intensity-weighted variance. When this occurs it's a strong indication that you should mask out the noise before calculating the moment maps (and the moment 1 centroid is also likely to be very noisy).

There's an example of this issue in one of our spectral-cube tutorials here: https://mybinder.org/v2/gh/radio-astro-tools/tutorials/master?filepath=casa_to_spectralcube_guide%2Fcasa_to_spectralcube_guide.ipynb