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

testSpectrum Signal
/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/rsciio/utils/rgb_tools.py:62: VisibleDeprecationWarning: The module `rsciio.utils.rgb_tools` has been renamed to `rsciio.utils.rgb` and it will be removed in version 1.0.
  warnings.warn(

# 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()

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

Gallery generated by Sphinx-Gallery