hyperspy._signals.eds_sem module

class hyperspy._signals.eds_sem.EDSSEMParametersUI(signal)

Bases: BaseSetMetadataItems

gui(display=True, toolkit=None, **kwargs)

Display or return interactive GUI element if available.

Parameters:
  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

class hyperspy._signals.eds_sem.EDSSEMSpectrum(*args, **kwards)

Bases: EDSSpectrum

1D signal class for EDS spectra measured in an SEM.

Create a Signal from a numpy array.

Parameters:
  • data (numpy.ndarray) – The signal data. It can be an array of any dimensions.

  • axes ([dict/axes], optional) – List of either dictionaries or axes objects to define the axes (see the documentation of the AxesManager class for more details).

  • attributes (dict, optional) – A dictionary whose items are stored as attributes.

  • metadata (dict, optional) – A dictionary containing a set of parameters that will to stores in the metadata attribute. Some parameters might be mandatory in some cases.

  • original_metadata (dict, optional) – A dictionary containing a set of parameters that will to stores in the original_metadata attribute. It typically contains all the parameters that has been imported from the original data file.

  • ragged (bool or None, optional) – Define whether the signal is ragged or not. Overwrite the ragged value in the attributes dictionary. If None, it does nothing. Default is None.

_are_microscope_parameters_missing()

Check if the EDS parameters necessary for quantification are defined in metadata. If not, in interactive mode raises an UI item to fill the values

_load_from_TEM_param()

Transfer metadata.Acquisition_instrument.TEM to metadata.Acquisition_instrument.SEM

_set_default_param()

Set to value to default (defined in preferences)

create_model(auto_background=True, auto_add_lines=True, *args, **kwargs)

Create a model for the current SEM EDS data.

Parameters:
  • auto_background (boolean, default True) – If True, adds automatically a polynomial order 6 to the model, using the edsmodel.add_polynomial_background method.

  • auto_add_lines (boolean, default True) – If True, automatically add Gaussians for all X-rays generated in the energy range by an element using the edsmodel.add_family_lines method.

  • dictionary ({None, dict}, optional) – A dictionary to be used to recreate a model. Usually generated using hyperspy.model.as_dictionary()

Returns:

model

Return type:

EDSSEMModel instance.

get_calibration_from(ref, nb_pix=1)

Copy the calibration and all metadata of a reference.

Primary use: To add a calibration to ripple file from INCA software

Parameters:
  • ref (signal) – The reference contains the calibration in its metadata

  • nb_pix (int) – The live time (real time corrected from the “dead time”) is divided by the number of pixel (spectrums), giving an average live time.

Raises:

NotImplementedError – If the signal axis is a non-uniform axis.

Examples

>>> ref = hs.datasets.example_signals.EDS_SEM_Spectrum()
>>> s = hs.signals.EDSSEMSpectrum(
>>>     hs.datasets.example_signals.EDS_SEM_Spectrum().data)
>>> print(s.axes_manager[0].scale)
>>> s.get_calibration_from(ref)
>>> print(s.axes_manager[0].scale)
1.0
0.01
set_microscope_parameters(beam_energy=None, live_time=None, tilt_stage=None, azimuth_angle=None, elevation_angle=None, energy_resolution_MnKa=None, display=True, toolkit=None)

Set the microscope parameters.

If no arguments are given, raises an interactive mode to fill the values.

Parameters:
  • beam_energy (float) – The energy of the electron beam in keV

  • live_time (float) – In second

  • tilt_stage (float) – In degree

  • azimuth_angle (float) – In degree

  • elevation_angle (float) – In degree

  • energy_resolution_MnKa (float) – In eV

  • display (bool) – If True, display the user interface widgets. If False, return the widgets container in a dictionary, usually for customisation or testing.

  • toolkit (str, iterable of strings or None) – If None (default), all available widgets are displayed or returned. If string, only the widgets of the selected toolkit are displayed if available. If an interable of toolkit strings, the widgets of all listed toolkits are displayed or returned.

Examples

>>> s = hs.datasets.example_signals.EDS_SEM_Spectrum()
>>> print('Default value %s eV' %
>>>       s.metadata.Acquisition_instrument.
>>>       SEM.Detector.EDS.energy_resolution_MnKa)
>>> s.set_microscope_parameters(energy_resolution_MnKa=135.)
>>> print('Now set to %s eV' %
>>>       s.metadata.Acquisition_instrument.
>>>       SEM.Detector.EDS.energy_resolution_MnKa)
Default value 130.0 eV
Now set to 135.0 eV
class hyperspy._signals.eds_sem.LazyEDSSEMSpectrum(*args, **kwards)

Bases: EDSSEMSpectrum, LazyEDSSpectrum

Create a Signal from a numpy array.

Parameters:
  • data (numpy.ndarray) – The signal data. It can be an array of any dimensions.

  • axes ([dict/axes], optional) – List of either dictionaries or axes objects to define the axes (see the documentation of the AxesManager class for more details).

  • attributes (dict, optional) – A dictionary whose items are stored as attributes.

  • metadata (dict, optional) – A dictionary containing a set of parameters that will to stores in the metadata attribute. Some parameters might be mandatory in some cases.

  • original_metadata (dict, optional) – A dictionary containing a set of parameters that will to stores in the original_metadata attribute. It typically contains all the parameters that has been imported from the original data file.

  • ragged (bool or None, optional) – Define whether the signal is ragged or not. Overwrite the ragged value in the attributes dictionary. If None, it does nothing. Default is None.