Shape parameters in localize()
Opened this issue · 0 comments
When calling the localize() method with the default option fix_shape=False, it forces all shape parameters to be free, even those that the user has fixed from the start.
My example relocalizes source P88Y1600 between 1 GeV and 1 TeV. That source is fit with LogParabola in the DR4 catalog, but the curvature parameter (beta) is not well constrained in that reduced energy range so I fix it to the best-fit DR4 value (0.0731). However, localize() ignores that instruction, fits the curvature and finds the unphysical negative value -0.379. If I add follow-up commands, it will keep that incorrect value (but it remembers that it should be fixed).
I think the problematic instructions are near l 454 (in v 1.1.6) of sourcefind.py, inside "if update and o.fit_success and o.fit_inbounds:". After adding a new source at the new position, if fix_shape is False, nothing propagates the original free/fixed condition of the shape parameters, they are just all set to free.
The same problem may affect the extension() method, which has very similar instructions (l 318 of extension.py).
I put a test harness at this site. It will be there until May 19.
It creates a directory called P88Y1600. Inside, run fermipy_localize.py. Looking at the beta parameter of P88Y1600 at the beginning and end of the log, or comparing srcmdl_00.xml and LOCP88Y1600_00.xml, shows the bug.
I see this in all versions of fermipy I tested (eg 1.1.6).