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.

Returns

Return type

Signal2D

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.

Returns

Return type

EELSSpectrum

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.

Returns

Return type

EELSModel

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

Returns

Return type

EELSSpectrum

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
  • 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.

Returns

Return type

EELSSpectrum

Example

>>> s = hs.datasets.artificial_data.get_low_loss_eels_signal()
>>> s.plot()

See also

artificial_low_loss_line_scan_signal

EELSSpectrum

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
  • 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.

Returns

Return type

EELSSpectrum

Returns

artificial_low_loss_signal

Return type

EELSSpectrum

Example

>>> s = hs.datasets.artificial_data.get_low_loss_eels_signal()
>>> s.plot()