.. note::
    :class: sphx-glr-download-link-note

    Click :ref:`here <sphx_glr_download_examples_documentation_model_loadmodelresult.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_documentation_model_loadmodelresult.py:


doc_model_loadmodelresult.py
============================



.. image:: /examples/documentation/images/sphx_glr_model_loadmodelresult_001.png
    :class: sphx-glr-single-img


.. rst-class:: sphx-glr-script-out

 Out:

 .. code-block:: none

    [[Model]]
        Model(gaussian)
    [[Fit Statistics]]
        # fitting method   = leastsq
        # function evals   = 29.0000000
        # data points      = 101.000000
        # variables        = 3.00000000
        chi-square         = 3.40883599
        reduced chi-square = 0.03478404
        Akaike info crit   = -336.263713
        Bayesian info crit = -328.418352
    [[Variables]]
        amplitude:  8.88022277 +/- 0.11359552 (1.28%) (init = 5)
        center:     5.65866081 +/- 0.01030506 (0.18%) (init = 5)
        sigma:      0.69765538 +/- 0.01030503 (1.48%) (init = 1)
        fwhm:       1.64285285 +/- 0.02426649 (1.48%) == '2.3548200*sigma'
        height:     5.07800352 +/- 0.06495781 (1.28%) == '0.3989423*amplitude/max(2.220446049250313e-16, sigma)'
    [[Correlations]] (unreported correlations are < 0.100)
        C(amplitude, sigma) =  0.577





|


.. code-block:: default

    ##
    import warnings
    warnings.filterwarnings("ignore")
    ##
    # <examples/doc_model_loadmodelresult.py>
    import matplotlib.pyplot as plt
    import numpy as np

    from lmfit.model import load_modelresult

    data = np.loadtxt('model1d_gauss.dat')
    x = data[:, 0]
    y = data[:, 1]

    result = load_modelresult('gauss_modelresult.sav')
    print(result.fit_report())

    plt.plot(x, y, 'bo')
    plt.plot(x, result.best_fit, 'r-')
    plt.show()
    # <end examples/doc_model_loadmodelresult.py>


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.231 seconds)


.. _sphx_glr_download_examples_documentation_model_loadmodelresult.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download

     :download:`Download Python source code: model_loadmodelresult.py <model_loadmodelresult.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: model_loadmodelresult.ipynb <model_loadmodelresult.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
