calc_uncertainty_scale¶
- msaexp.spectrum.calc_uncertainty_scale(file=None, data=None, order=0, initial_mask=(0.2, 5), sys_err=0.02, fit_sys_err=False, method='bfgs', student_df=10, update=True, verbose=True, **kwargs)[source]¶
Compute a polynomial scaling of the spectrum uncertainties. The procedure is to fit for coefficients of a polynomial multiplied to the
errarray of the spectrum such that(flux - model)/(err*scl)residuals areN(0,1)- Parameters
- filestr
Spectrum filename
- datatuple
Precomputed outputs from
plot_spectrum- orderint
Degree of the correction polynomial
- initial_mask(float, float)
Masking for the fit initialization. First parameter is zeroth-order uncertainty scaling and the second parameter is the mask threshold of the residuals
- sys_errfloat
Systematic component of the uncertainties
- fit_sys_errbool
Fit for adjusted
sys_errparameter- methodstr
Optimization method for
scipy.optimize.minimize- student_dfint, None
If specified, calculate log likelihood of a
scipy.stats.t Student-t distribution with ``df=student_df`. Otherwise, calculate log-likelihood of thescipy.stats.normaldistribution.- updatebool
Update the global
msaexp.spectrum.SCALE_UNCERTAINTYarray with the fit result- verbosebool
Print status messages. If
verbose > 1will also print status at each step of the optimization.- kwargsdict
Keyword arguments for
plot_spectrumifdatanot specified
- Returns
- spec
Table The spectrum as fit
- escalearray
The wavelength-dependent scaling of the uncertainties
- sys_errfloat
The systematic uncertainty used, fixed or adjusted depending on
fit_sys_err- resobject
Output from
scipy.optimize.minimize
- spec