-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moment2 (FWHM) Images Do Not Agree With Spectral Line FWHM at Positions Near Sigma Clip Limits #45
Comments
the test we need to do is run the FWHM estimation (i.e., moment 2 calculation) on Gaussians cutting at higher and higher thresholds. In principle it should stay constant and close to the correct value until there are only a few pixels left. |
ok. Why is this necessary? Note that we are using the "old" sigma-clipping approach, so the masking that you developed previously, which looked to be producing reasonable results for moment0. Is there something special about the moment2 calculation, and I guess |
That's the question I want to answer |
ok. So is this specifically related to |
Is this issue associated with #9 ? |
I am afraid that I have never used a moment2 calculation to derive a FWHM for a biased or clipped measurement. It looks to me like no threshold (threshold = 0) badly overestimates the actual FWHM. Not sure I understand this behaviour. Looking at your fwhm function, I don't follow why you threshold both the x and y axes? For the moment calculations aren't we just thresholding on intensity (y-axis)? |
Would like to understand why noise and threshold affect FWHM via moment2, but do need to find a path forward for getting FWHM from spectral cubes. How can we possibly use a moment2-based FWHM when noise, let alone threshold, corrupts the result? Or can you just not threshold and get a reliable FWHM from a moment2 measurement of noisy data? |
there are some s/n tests to do, but my experience in general is that not masking is much worse in a moderate s/n regime. In high s/n, not masking should be fine. There are some alternatives to explore. I'm going to do some reading. I've used moment2 estimates of width for a long time, but I think all of my use cases have been as inputs to fitting a Gaussian. That's my only explanation for how I failed to realize this bias. There must be literature on this. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2464285/ is an example, but my first pass over that suggests that fitting might be involved - which we want to avoid, because any fitting approach is numerically unstable. |
Would it make any sense to instead calculate a FWZI by completely bypassing a moment2 calculation and doing this calculation on a pixel-by-pixel basis on the input image cube? One could then estimate an equivalent Gaussian FWHM from that FWZI if desired. |
I would expect FWZI to be much less well-behaved - "ZI" is poorly defined. But calculating the FWHM by stepping down from a peak, e.g. with https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.peak_widths.html, may work. |
I would think that ZI down to a threshold would be well-behaved, but a FWHM determined by stepping down from the peak would also give a usable linewidth. |
Not a problem I think, but |
we can come up with an alternative implementation, it's a pretty simple algorithm. |
https://ui.adsabs.harvard.edu/#abs/2005ApJ...623..826R/abstract appendix B gives the systematic correction for moment 2: |
Nice find! This looks like a correction that could be applied on a per-pixel basis. I guess the question now is whether to implement this correction or to implement the |
I would recommend going with the per-pixel correction approach, actually. Even though the line profiles may not be intrinsically Gaussian, it's probably a better extrapolation than any other profile. We can try the peak_widths approach, but I suspect it will have much worse behavior in the presence of noise. Of course, the Right Thing is to do a systematic comparison and calibrate on simulated data. |
ok. Your call. I should post a feature request to develop a simulated data set for testing like what you suggest. |
The Rosolowsky and Blitz reference was for 2-sigma clip, which I interpreted as the reason for the "1/2" factors in each of the It appears to me that the correction is not very good for most thresholds. Rosolowsky and Blitz did not say how good the correction makes the resultant FWHM, but implied that it should be perfect. |
the 1/2's in the exponents come from the definition of the Gaussian. But I also interpreted the The I agree, it doesn't look like this correction works, which I think hints that I've implemented it incorrectly. I therefore summon @low-sky to see if he can correct my error. (one could also use the empirical correction that is plotted above) |
As we do not seem to have a solution to this issue, it might be prudent to warn users that the moment2 derived using this library is not usable, or even to disable the moment2 calculation? |
While verifying moment2 (FWHM) image values by comparing spectra toward specific positions in an input spectral line cube with their corresponding FWHM values in the moment2 image, noted significant disagreement near the signal-to-noise clip limit (i.e. 3-sigma). Attached is an example where the FWHM of the line (HCN 1-0) appears to be about 75 km/s, but the FWHM value from the moment2 image is about 25 km/s. This difference is rather systematic along the boundaries of the FWHM image.

The text was updated successfully, but these errors were encountered: