hyperspy.api.data
#
The hyperspy.api.data
module includes synthetic data signal.
- hyperspy.api.data.atomic_resolution_image(size=512, spacing=0.2, column_radius=0.05, rotation_angle=0, pixel_size=0.015, add_noise=False, random_state=None)#
Make an artificial atomic resolution image. The atomic columns are modelled with Gaussian functions.
- Parameters:
- size
int
ortuple
ofint
, default=512 The number of pixels of the image in horizontal and vertical directions. If int, the size is the same in both directions.
- spacing
float
ortuple
offloat
, default=14 The spacing between the atomic columns in horizontal and vertical directions in nanometer.
- column_radius
float
, default=0.05 The radius of the atomic column, i. e. the width of the Gaussian in nanometer.
- rotation_angle
int
orfloat
, default=0 The rotation of the lattice in degree.
- pixel_size
float
, default=0.015 The pixel size in nanometer.
- add_noisebool
If True, add noise to the signal. Use
random_state
to seed the noise to generate reproducible noise.- random_state
None
,int
ornumpy.random.Generator
, defaultNone
Random seed used to generate the data.
- size
- Returns:
Examples
>>> import hyperspy.api as hs >>> 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. Use
random_state
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. Use
random_state
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: