3
$\begingroup$

enter image description here

So I am using Astropy's basic models.Gaussian1D model and a fitter = fitting.LevMarLSQfitter() to fit 3 Gaussian pulses with some added random noise. The fit is good, but when I type

fitter.fit_info, according to documentation here, it should automatically calculate covariance matrix and add it to the fit_info, but it doesn't, fit_info['param_cov'] is simply None. What is going on?

$\endgroup$
2
  • 1
    $\begingroup$ Does this code shed any light? $\endgroup$
    – Mike G
    Jul 18, 2019 at 23:16
  • $\begingroup$ The documentations says: "Parameters calc_uncertainties bool If the covarience matrix should be computed and set in the fit_info. Default: False" docs.astropy.org/en/stable/api/… $\endgroup$
    – ProfRob
    Aug 10, 2022 at 13:09

1 Answer 1

3
$\begingroup$

You must explicitly request uncertainties.

fitter = fitting.LevMarLSQfitter(calc_uncertainties=True)

Read the docs: https://docs.astropy.org/en/stable/api/astropy.modeling.fitting.LevMarLSQFitter.html

$\endgroup$
1
  • 2
    $\begingroup$ It's a perfectly clear, concise answer. I added a link to the documentation, which is quite clear too. $\endgroup$
    – ProfRob
    Aug 10, 2022 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .