Closed bentps closed 4 years ago
Thanks for the patch. Can you remove the 'loop' stuff? It doesn't look like it's necessary for the TwoAreaBackgroundModel.
For TwoAreaBackground, you only need to implement one or the other of '_perform_fit' or '_perform_fits'. Generally, if there is an optimization when performing repeated fitting on a series of 1-D spectra (there is in this case), then only implement '_perform_fits'. Otherwise you would implement '_perform_fit' (i.e. for algorithms using curve fitting with no series optimization).
Also, you can submit the loop code as a separate patch if you think it's necessary, but I don't think it will be since '_perform_fits' default implementation seems to do the same thing. i.e. you would just override '_perform_fit' instead of both.
Merged 72afaa527fd3b154042c78c5dac588664f429706
Added new class "TwoAreaBackgroundModel", made following the example of PolynomialBackgroundModel. So far only the power law model is implemented using the two-area method. I also added a parameter "loop" that determines whether _perform_fit is used in a loop, if loop == True, or else _perform_fits is used. Something like this will be needed if we add back in fitting with scipy.optimize.curve_fit.