hyperspy.api.data
#
The hyperspy.api.data
module includes synthetic data signal.
- hyperspy.api.data.atomic_resolution_image()#
Get an artificial atomic resolution image.
- Returns:
Examples
>>> s = hs.data.atomic_resolution_image() >>> s.plot()
- hyperspy.api.data.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
int
The navigation dimension(s) of the signal. 0 = single spectrum, 1 = linescan, 2 = spectral map etc…
- uniformbool
return uniform (wavelength) or non-uniform (energy) spectrum
- add_baselinebool
If true, adds a constant baseline to the spectrum. Conversion to energy representation will turn the constant baseline into inverse powerlaw.
- add_noisebool
If True, add noise to the signal. See note to seed the noise to generate reproducible noise.
- random_state
None
,int
ornumpy.random.Generator
, defaultNone
Random seed used to generate the data.
- navigation_dimension
- Returns:
See also
Examples
>>> import hyperspy.api as hs >>> s = hs.data.luminescence_signal() >>> s.plot()
With constant baseline
>>> s = hs.data.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 = hs.data.luminescence_signal(random_state=10) >>> s2 = hs.data.luminescence_signal(random_state=10) >>> print((s1.data == s2.data).all()) True
2D map
>>> s = hs.data.luminescence_signal(navigation_dimension=2) >>> s.plot()
- hyperspy.api.data.two_gaussians(add_noise=True, return_model=False)#
Create synthetic data consisting of two Gaussian functions with random centers and area
- Parameters:
- Returns:
BaseSignal
ortuple
Returns tuple when
return_model=True
.
- hyperspy.api.data.wave_image(angle=45, wavelength=10, shape=(256, 256), add_noise=True, random_state=None)#
Returns a wave image generated using the sinus function.
- Parameters:
- angle
float
, optional The angle in degree.
- wavelength
float
, optional The wavelength the wave in pixel. The default is 10
- shape
tuple
offloat
, optional The shape of the data. The default is (256, 256).
- add_noisebool
If True, add noise to the signal. See note to seed the noise to generate reproducible noise.
- random_state
None
,int
ornumpy.random.Generator
, defaultNone
Random seed used to generate the data.
- angle
- Returns: