.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/data_processing/remove_spikes.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_spikes.py: Remove Spikes ============= This example shows how to remove spikes (e.g. from cosmic rays impacting a CCD detector) from a dataset. .. GENERATED FROM PYTHON SOURCE LINES 9-10 Load the data .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. code-block:: Python import lumispy as lum cl1 = lum.data.asymmetric_peak_map() cl1 = cl1.remove_background(signal_range=(550.0, 620.0), background_type="Offset") cl1 = cl1.isig[:-3] .. GENERATED FROM PYTHON SOURCE LINES 17-18 Display the original data .. GENERATED FROM PYTHON SOURCE LINES 18-21 .. code-block:: Python cl1.inav[29, 0].plot() .. image-sg:: /auto_examples/data_processing/images/sphx_glr_remove_spikes_001.png :alt: 880_30K_map2a Signal :srcset: /auto_examples/data_processing/images/sphx_glr_remove_spikes_001.png, /auto_examples/data_processing/images/sphx_glr_remove_spikes_001_5_00x.png 5.00x :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 22-24 As seen there is a heavy spike, so lets remove it (in an interactive environment, the parameters for spike identification can be adapted and the proposed removal previewed and confirmed for each identified spike individually, see :py:meth:`hyperspy.api.signals.Signal1D.spikes_removal_tool`). .. GENERATED FROM PYTHON SOURCE LINES 24-27 .. code-block:: Python cl1.spikes_removal_tool(interactive=False) .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 28-29 Display cleaned data .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python cl1.inav[29, 0].plot() .. image-sg:: /auto_examples/data_processing/images/sphx_glr_remove_spikes_002.png :alt: 880_30K_map2a Signal :srcset: /auto_examples/data_processing/images/sphx_glr_remove_spikes_002.png, /auto_examples/data_processing/images/sphx_glr_remove_spikes_002_5_00x.png 5.00x :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.781 seconds) .. _sphx_glr_download_auto_examples_data_processing_remove_spikes.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: remove_spikes.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: remove_spikes.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: remove_spikes.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_