.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/model_fitting/simple_arctan_fit.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_model_fitting_simple_arctan_fit.py: Simple arctan fit ================= Fit an arctan function. .. GENERATED FROM PYTHON SOURCE LINES 8-38 .. image-sg:: /auto_examples/model_fitting/images/sphx_glr_simple_arctan_fit_001.png :alt: Simple arctan fit Signal :srcset: /auto_examples/model_fitting/images/sphx_glr_simple_arctan_fit_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Model1D: Simple arctan fit CurrentComponentValues: Arctan Active: True Parameter Name | Free | Value | Std | Min | Max | Linear ============== | ======= | ========== | ========== | ========== | ========== | ====== A | True | 0.99891499 | 0.00199462 | None | None | True k | True | 1.07618403 | 0.08859847 | None | None | False x0 | True | -0.1375172 | 0.07183467 | None | None | False | .. code-block:: Python import numpy as np import hyperspy.api as hs # Generate the data and make the spectrum data = np.arctan(np.arange(-500, 500)) s = hs.signals.Signal1D(data) s.axes_manager[0].offset = -500 s.axes_manager[0].units = "" s.axes_manager[0].name = "x" s.metadata.General.title = "Simple arctan fit" s.set_signal_origin("simulation") s.add_gaussian_noise(0.1) # Make the arctan component for use in the model arctan_component = hs.model.components1D.Arctan() # Create the model and add the arctan component m = s.create_model() m.append(arctan_component) # Fit the arctan component to the spectrum m.fit() # Print the result of the fit m.print_current_values() # Plot the spectrum and the model fitting m.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.609 seconds) .. _sphx_glr_download_auto_examples_model_fitting_simple_arctan_fit.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: simple_arctan_fit.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: simple_arctan_fit.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: simple_arctan_fit.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_