threeML / astromodels

Spatial and spectral models for astrophysics
BSD 3-Clause "New" or "Revised" License
43 stars 44 forks source link

Log transform in Powerlaw functions #186

Closed henrikef closed 2 years ago

henrikef commented 2 years ago

Some of the PL functions have log10 transforms on the normalization (and cutoff energy if applicable) but some don't.

E.g. Super_cutoff_powerlaw doesn't have it, Cutoff_powerlaw does. Is there any reason for this? I feel like either all normalizations should have the transform or none of them.

Any thoughts? It's an easy fix if we agree to add the transforms.

henrikef commented 2 years ago

(the reason that I bring this up is that some fermipyLike tests are failing offline after switching to the minuit minimizer, and I realized it is because the fit without the log transform is less stable)

grburgess commented 2 years ago

@henrikef I think this was added with the idea that these help MLE find a solution quicker. I personally don't like the idea because MLE solution for the transform is not the same as the MLE solution without. But we should likely have them everywhere.

In the astromodels config, you can turn them off:

logging:
  developer: off
  startup_warnings: off
  warn_style: "blink medium_orchid"

modeling:
  use_parameter_transforms: false
  ignore_parameter_bounds: true

There is also a context manger:

with turn_off_parameter_transforms():

There is also a slight speed up with them off.

henrikef commented 2 years ago

Ok, I'll add them to the rest of the functions.

henrikef commented 2 years ago

@grburgess is the configuration for astromodels documented somewhere? Like it is for threeML?

grburgess commented 2 years ago

Nope... haven't gotten around to that