Astropy: Negative FWHM in Moffat1D

Created on 5 Jun 2019  ·  3Comments  ·  Source: astropy/astropy

I'm making an application to get the best focus for an instrument. I'm using a Moffat1D model to fit the profile and for some reason gamma is negative (which does not matter and I assume it is correct) but when I get the FWHM is negative as well, which as far as I know does not make sense in astronomical images (or any). It seems to me that there is a mistake regarding the formula, see this comment: https://github.com/astropy/astropy/pull/6027#issuecomment-300380649

from the second-last to the last line
CodeCogsEqn
and thus (should be)
CodeCogsEqn_fwhm

and using the notation in astropy's documentation the FWHM should be:

CodeCogsEqn_astropy_fwhm

Hopefully someone has a better insight in this, I will workaround this making gamma absolute value always.

I can make a PR if this is really something worth doing.

reference plot and model

moffat_fitted

The model

Model: Moffat1D
Inputs: ('x',)
Outputs: ('y',)
Model set size: 1
Parameters:
      amplitude       x_0          gamma         alpha    
    ------------- ------------ -------------- ------------
    248.392233095 2065.9401953 -90.3411844413 1161.3273732
Bug modeling

All 3 comments

@ysBach, what do you think?

@pllim Sorry for not being respondent for few days.
I think @simontorres is absolutely right.

Due to the squaring, the sign of the "core" parameter (gamma of astropy = alpha of IRAF = R of Moffat's original work) does not matter in Moffat profile calculation, but it does for the current FWHM calculation...

@simontorres , pull request is welcome. Please refer to http://docs.astropy.org/en/stable/development/workflow/development_workflow.html . Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

embray picture embray  ·  3Comments

JWDobken picture JWDobken  ·  3Comments

sergiopasra picture sergiopasra  ·  3Comments

DanRyanIrish picture DanRyanIrish  ·  3Comments

nstarman picture nstarman  ·  3Comments