.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/io/export_single_spectrum.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_io_export_single_spectrum.py: Export single spectrum ====================== Creates a single spectrum image, saves it and plots it: 1. Create a single sprectrum using `Signal1D` signal. 2. Save signal as a msa file 3. Plot the signal using the `plot` method 4. Save the figure as a png file .. GENERATED FROM PYTHON SOURCE LINES 13-27 .. image-sg:: /auto_examples/io/images/sphx_glr_export_single_spectrum_001.png :alt: testSpectrum Signal :srcset: /auto_examples/io/images/sphx_glr_export_single_spectrum_001.png :class: sphx-glr-single-img .. code-block:: Python # Set the matplotlib backend of your choice, for example # %matploltib qt import hyperspy.api as hs import numpy as np s = hs.signals.Signal1D(np.random.rand(1024)) # Export as msa file, very similar to a csv file but containing standardised # metadata s.save('testSpectrum.msa', overwrite=True) # Plot it s.plot() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.473 seconds) .. _sphx_glr_download_auto_examples_io_export_single_spectrum.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: export_single_spectrum.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: export_single_spectrum.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_