-1

am trying to print variable values from lmfit minimization algorithm.am using lmfit.printfuncs.report_fit(res.params) am getting

[[Variables]]
    a:   123 (init= 123)
    b:   456 (init= 456)
    c:   789 (init= 789)
    d:   012 (init= 012)
[[Correlations]] (unreported correlations are <  0.100)

Can i print just the outcome values like

123
456
789
012
ch.Joshi elijah
  • 103
  • 2
  • 11

3 Answers3

1

result.params is an ordered dictionary of Parameter objects, each of which has the best value stored in the value attribute, and several other attributes. Basically, fit_report does something like:

for param in result.params.values():
    print("%s:  %f +/- %f (init = %f)" % (param.name, param.value, param.stderr, param.init_value)

You can modify that any way you'd like.

M Newville
  • 7,486
  • 2
  • 16
  • 29
  • your answers works very well for me,and thank you so much for lmfit.its a great work all together am an active user of lmfit. :) – ch.Joshi elijah May 18 '18 at 16:34
0

am able to get variable values using print(result.values) if anyone can get the exact output,please share it.

ch.Joshi elijah
  • 103
  • 2
  • 11
0

Specific values can be accessed by using

result.params.get('variable_name').value

For example:

result.params.get('fwhm').value
stiebrs
  • 379
  • 3
  • 13