sunkit-spex icon indicating copy to clipboard operation
sunkit-spex copied to clipboard

Modular fitter attempt

Open settwi opened this issue 1 year ago • 2 comments

PR Description

A crack at an updated "modular" fitting interface. Notebook included demonstrating fitting a "line" of "X-ray" data. No real tests written yet but that's on the agenda, if we want to continue with any of this.

I am curious as to what folks think!


Here's a copy/paste from the "prelude" to that Jupyter notebook:

Modular modeling framework example

This notebook shows how a fitting framework could be made, in the context of issue #81 and issue #126.

sunkit-spex has (or will have?) a modular interface. First we define the data interface. For now it is only X-ray data but we can add more data types.

Then we define the fitting interface. A PhotonModel represents any kind of model which represents photons which get counted. In the future we can add different models, like IntegratedFluxModels if the need arises; there is not a need to tie us to a base class right now.

The first example tackled here is fitting data to a line. More complex models may be implemented however the user or developers see fit by modifying the perform_fit method in subsequent classes. The first class implemented is a Monte Carlo $\chi^2$ fitter.

A lot of ideas here are similar to pr #130. I think we should pick and choose what we like from both and move from there.

settwi avatar Mar 01 '24 02:03 settwi

Codecov Report

Attention: Patch coverage is 50.29586% with 84 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (main@2deabc0). Click here to learn what that means.

Files Patch % Lines
sunkit_spex/fitting/fitters.py 45.58% 37 Missing :warning:
sunkit_spex/fitting/fit_models.py 51.61% 30 Missing :warning:
sunkit_spex/fitting/fake_models.py 28.57% 15 Missing :warning:
sunkit_spex/fitting/spectra.py 88.88% 2 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #140   +/-   ##
=======================================
  Coverage        ?   55.51%           
=======================================
  Files           ?       24           
  Lines           ?     3334           
  Branches        ?        0           
=======================================
  Hits            ?     1851           
  Misses          ?     1483           
  Partials        ?        0           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Mar 01 '24 02:03 codecov-commenter

@samaloney @KriSun95 @DanRyanIrish @hayesla tear this apart plz

settwi avatar Mar 02 '24 14:03 settwi