.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/data_processing/remove_background.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_data_processing_remove_background.py: Remove Background ================= This example removes a constant background from a dataset. .. GENERATED FROM PYTHON SOURCE LINES 9-10 Load the data .. GENERATED FROM PYTHON SOURCE LINES 10-15 .. code-block:: Python import lumispy as lum import matplotlib.pyplot as plt cl1 = lum.data.asymmetric_peak_map() .. GENERATED FROM PYTHON SOURCE LINES 16-17 Display the original data .. GENERATED FROM PYTHON SOURCE LINES 17-21 .. code-block:: Python cl1.plot() plt.close(1) .. image-sg:: /auto_examples/data_processing/images/sphx_glr_remove_background_001.png :alt: 880_30K_map2a Signal :srcset: /auto_examples/data_processing/images/sphx_glr_remove_background_001.png, /auto_examples/data_processing/images/sphx_glr_remove_background_001_5_00x.png 5.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 22-25 Now we remove the background and display the data If the parameter ``signal_range`` is not given, it can be selected interactively, see :py:meth:`hyperspy.api.signals.Signal1D.remove_background`. .. GENERATED FROM PYTHON SOURCE LINES 25-32 .. code-block:: Python cl2 = cl1.remove_background(signal_range=(550.0, 620.0), background_type="Offset") cl2.plot() plt.close(1) .. image-sg:: /auto_examples/data_processing/images/sphx_glr_remove_background_002.png :alt: 880_30K_map2a Signal :srcset: /auto_examples/data_processing/images/sphx_glr_remove_background_002.png, /auto_examples/data_processing/images/sphx_glr_remove_background_002_5_00x.png 5.00x :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.040 seconds) .. _sphx_glr_download_auto_examples_data_processing_remove_background.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: remove_background.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: remove_background.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: remove_background.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_