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.
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).
Right now
Model
as I understand it creates and disposes ofFitter
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 toModel.fit
, perhapsreuse=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.