zblz / naima

Derivation of non-thermal particle distributions through MCMC spectral fitting
http://naima.readthedocs.io
BSD 3-Clause "New" or "Revised" License
45 stars 54 forks source link

Create an automatic sherpa model generator #61

Open zblz opened 9 years ago

zblz commented 9 years ago

From the radiative and functional models, create a sherpa model automagically, e.g.:

>>> from naima.models import create_sherpa_model, Synchrotron, PowerLaw
>>> SynPL = create_sherpa_model(model=Synchrotron, particle_distribution=PowerLaw)

All parameter fields, etc, should be populated programatically from the given models.

cdeil commented 9 years ago

@zblz – now that Sherpa is open, we'll start using it heavily in Gammapy.

@kingj90 will work on gammapy.spectrum ... we should try to find a way to avoid duplicating spectral model classes and functionality in gammapy and naima.

zblz commented 9 years ago

@cdeil - definitely, we should not duplicate this. I did a few enhancements on the sherpa models in naima so that they are easier to code (base classes for each particle distribution and then a subclass for emission process) but this is not meant to be exposed to the user. I was not planning on developing this further than the thin wrappers in place in the near future, so if you have a plan for a better sherpa model framework we could use that with the naima models as well.

cdeil commented 7 years ago

@joleroi, @adonath and I were discussing this briefly today. I think a factory function or some other Sherpa model generator would be nice. If it's more that 20 lines of code / significant effort, one should first look at https://saba.readthedocs.io/ That was a GSoC project and had input from both Astropy and Sherpa devs. I haven't looked in detail what they do or if it's suitable for our needs.