hyperspy.datasets.artificial_data module
Functions for generating artificial data.
For use in things like docstrings or to test HyperSpy functionalities.
- hyperspy.datasets.artificial_data.get_atomic_resolution_tem_signal2d()
Get an artificial atomic resolution TEM Signal2D.
- Return type:
Example
>>> s = hs.datasets.artificial_data.get_atomic_resolution_tem_signal2d() >>> s.plot()
- hyperspy.datasets.artificial_data.get_core_loss_eels_line_scan_signal(add_powerlaw=False, add_noise=True, random_state=None)
Get an artificial core loss electron energy loss line scan spectrum.
Similar to a Mn-L32 and Fe-L32 edge from a perovskite oxide.
- Parameters:
add_powerlaw (bool) – If True, adds a powerlaw background to the spectrum. Default is False.
add_noise (bool) – If True, add noise to the signal. See note to seed the noise to generate reproducible noise.
random_state (None or int or RandomState instance, default None) – Random seed used to generate the data.
- Return type:
Example
>>> s = hs.datasets.artificial_data.get_core_loss_eels_line_scan_signal() >>> s.plot()
- hyperspy.datasets.artificial_data.get_core_loss_eels_model(add_powerlaw=False, add_noise=True, random_state=None)
Get an artificial core loss electron energy loss model.
Similar to a Mn-L32 edge from a perovskite oxide.
- Parameters:
add_powerlaw (bool) – If True, adds a powerlaw background to the spectrum. Default is False.
add_noise (bool) – If True, add noise to the signal. See note to seed the noise to generate reproducible noise.
random_state (None or int or RandomState instance, default None) – Random seed used to generate the data.
- Return type:
Example
>>> import hs.datasets.artifical_data as ad >>> s = ad.get_core_loss_eels_model() >>> s.plot()
With the powerlaw background
>>> s = ad.get_core_loss_eels_model(add_powerlaw=True) >>> s.plot()
See also
- hyperspy.datasets.artificial_data.get_core_loss_eels_signal(add_powerlaw=False, add_noise=True, random_state=None)
Get an artificial core loss electron energy loss spectrum.
Similar to a Mn-L32 edge from a perovskite oxide.
Some random noise is also added to the spectrum, to simulate experimental noise.
- Parameters:
add_powerlaw (bool) – If True, adds a powerlaw background to the spectrum. Default is False.
add_noise (bool) – If True, add noise to the signal. See note to seed the noise to generate reproducible noise.
random_state (None or int or RandomState instance, default None) – Random seed used to generate the data.
- Return type:
Example
>>> import hs.datasets.artifical_data as ad >>> s = ad.get_core_loss_eels_signal() >>> s.plot()
With the powerlaw background
>>> s = ad.get_core_loss_eels_signal(add_powerlaw=True) >>> s.plot()
To make the noise the same for multiple spectra, which can be useful for testing fitting routines
>>> s1 = ad.get_core_loss_eels_signal(random_state=10) >>> s2 = ad.get_core_loss_eels_signal(random_state=10) >>> (s1.data == s2.data).all() True
- hyperspy.datasets.artificial_data.get_low_loss_eels_line_scan_signal(add_noise=True, random_state=None)
Get an artificial low loss electron energy loss line scan spectrum.
The zero loss peak is offset by 4.1 eV.
- Parameters:
- Return type:
Example
>>> s = hs.datasets.artificial_data.get_low_loss_eels_signal() >>> s.plot()
See also
artificial_low_loss_line_scan_signal
- hyperspy.datasets.artificial_data.get_low_loss_eels_signal(add_noise=True, random_state=None)
Get an artificial low loss electron energy loss spectrum.
The zero loss peak is offset by 4.1 eV.
- Parameters:
- Return type:
Example
>>> s = hs.datasets.artificial_data.get_low_loss_eels_signal() >>> s.plot()
- hyperspy.datasets.artificial_data.get_luminescence_signal(navigation_dimension=0, uniform=False, add_baseline=False, add_noise=True, random_state=None)
Get an artificial luminescence signal in wavelength scale (nm, uniform) or energy scale (eV, non-uniform), simulating luminescence data recorded with a diffracting spectrometer. Some random noise is also added to the spectrum, to simulate experimental noise.
- Parameters:
navigation_dimension (positive int.) – The navigation dimension(s) of the signal. 0 = single spectrum, 1 = linescan, 2 = spectral map etc…
uniform (bool.) – return uniform (wavelength) or non-uniform (energy) spectrum
add_baseline (bool) – If true, adds a constant baseline to the spectrum. Conversion to energy representation will turn the constant baseline into inverse powerlaw.
add_noise (bool) – If True, add noise to the signal. See note to seed the noise to generate reproducible noise.
random_state (None or int or RandomState instance, default None) – Random seed used to generate the data.
Example
>>> import hyperspy.datasets.artificial_data as ad >>> s = ad.get_luminescence_signal() >>> s.plot()
With constant baseline
>>> s = ad.get_luminescence_signal(uniform=True, add_baseline=True) >>> s.plot()
To make the noise the same for multiple spectra, which can be useful for testing fitting routines
>>> s1 = ad.get_luminescence_signal(random_state=10) >>> s2 = ad.get_luminescence_signal(random_state=10) >>> (s1.data == s2.data).all() True
2D map
>>> s = ad.get_luminescence_signal(navigation_dimension=2) >>> s.plot()