hyperspy.api module

All public packages, functions and classes are available in this module.

When starting HyperSpy using the hyperspy script (e.g. by executing hyperspy in a console, using the context menu entries or using the links in the Start Menu, the api package is imported in the user namespace as hs, i.e. by executing the following:

>>> import hyperspy.api as hs

(Note that code snippets are indicated by three greater-than signs)

We recommend to import the HyperSpy API as above also when doing it manually. The docstring examples assume that hyperspy has been imported as hs, numpy as np and matplotlib.pyplot as plt.

Functions:

create_model
Create a model for curve fitting.
get_configuration_directory_path
Return the configuration directory path.
load
Load data into BaseSignal instances from supported files.
preferences
Preferences class instance to configure the default value of different parameters. It has a CLI and a GUI that can be started by execting its gui method i.e. preferences.gui().
stack
Stack several signals.
interactive
Define operations that are automatically recomputed on event changes.
set_log_level
Convenience function to set HyperSpy’s the log level.

The api package contains the following submodules/packages:

signals
Signal classes which are the core of HyperSpy. Use this modules to create Signal instances manually from numpy arrays. Note that to load data from supported file formats is more convenient to use the load function.
model
Contains the components module with components that can be used to create a model for curve fitting.
eds
Functions for energy dispersive X-rays data analysis.
material
Useful functions for materials properties and elements database that includes physical properties and X-rays and EELS energies.
plot
Plotting functions that operate on multiple signals.
datasets
Example datasets.
roi
Region of interests (ROIs) that operate on BaseSignal instances and include widgets for interactive operation.
samfire
SAMFire utilities (strategies, Pool, fit convergence tests)

For more details see their doctrings.