PAHFIT / pahfit

Model Decomposition for Near- to Mid-Infrared Spectroscopy of Astronomical Sources
https://pahfit.readthedocs.io/
18 stars 26 forks source link

Allow `Fitter` reuse in `Model` #287

Open jdtsmith opened 4 months ago

jdtsmith commented 4 months ago

Right now Model as I understand it creates and disposes of Fitter objects frequently.

One of the key conceived speed improvements for the SPFitter is model re-use. I.e. the setup work done to build internal state for the fitter can be reused, if the next spectrum to be fitted differs only in flux (quite common for a cube). We need an opt-in flag to Model.fit, perhaps reuse=False which is the user saying the fitter can re-use things. This might also involve "pre-conditioning" the fit, e.g. by scaling powers/amplitudes up or down by the relative mean fluxes.

jdtsmith commented 4 months ago

One possible simplification: if no reuse, create a new Fitter. If re-use, certify you have the same wavelengths/instrument/redshift/etc., and let Model use its old Fitter (informing it of the reuse).