threeML / hawc_hal

HAWC Accelerated Likelihood - python-only framework for HAWC data analysis
BSD 3-Clause "New" or "Revised" License
11 stars 21 forks source link

unable to fit templates #63

Closed Amidn closed 3 years ago

Amidn commented 3 years ago

macOS catalina conda: 4.9.2 Xcode: 12.0.1

(The same problem happens on UMD)

pytest --pyargs threeML: 148 passed, 18 skipped, 2 xfailed, 4 xpassed, 2096 warnings in 986.32s (0:16:26) pytest --pyargs astromodels: 104 passed, 1 skipped, 107 warnings in 40.51s test HAL: 1 passed, 363 warnings in 708.12s (0:11:48)

Problem: While the code workes properly to fit PS and Extended sources, it is unable to fit a template using "SpatialTemplate_2D()", It is not able nor to fit nor subtracting a previously fitted template. (I tried ROOT and minunit)

Amid temp_fit.txt

henrikef commented 3 years ago

Hi Amid, the information you provided is not enough to reproduce the issue.

Please provide your user scripp + relevant files such as the fits files you are loading etc.

Amidn commented 3 years ago

Hi Henrike, you can find the additional information here : "/data/disk01/home/amid/HAL_test" Regards

henrikef commented 3 years ago

Hi Amid!

This is not a HAL issue.

The main problem is that your template isn't normalized as expected. It should be normalized so that the sum of the template values times the pixel area (in steradians) comes out to 1. Future versions of astromodels will emit a warning in this case, see https://github.com/threeML/astromodels/pull/148 . Please let me know if you need any help in normalizing the template.

Additionally, there was a bug in astromodels that cut off the non-integer part of the template. This too will be fixed in upcoming versions, see https://github.com/threeML/astromodels/pull/148

Last, please do not touch the hash parameter of the 2D template. It is set when the template is read in. If you reset it, you will run into issues if you ever read in multiple templates in the same script.

henrikef commented 3 years ago

@Amidn were you able to resolve this?

Amidn commented 3 years ago

I am testing and collecting the issues (If I cannot fix them by my self), and I will come back to you, Thank you

On Wed, 7 Apr 2021 at 22:40, Henrike F @.***> wrote:

@Amidn https://github.com/Amidn were you able to resolve this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threeML/hawc_hal/issues/63#issuecomment-815247632, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALSYIWVNXGGVQBXKX277FCLTHS7MVANCNFSM4Z7KK5DA .