hyperspy.io_plugins.emd module¶
-
class
hyperspy.io_plugins.emd.
EMD
(signals=None, user=None, microscope=None, sample=None, comments=None)¶ Bases:
object
Class for storing electron microscopy datasets.
The
EMD
class can hold an arbitrary amount of datasets in the signals dictionary. These are saved as HyperSpySignal
instances. Global metadata are saved in four dictionaries (user, microscope, sample, comments). To print relevant information about the EMD instance use thelog_info()
function. EMD instances can be loaded from and saved to emd-files, an hdf5 standard developed at Lawrence Berkeley National Lab (https://emdatasets.com/).-
signals
¶ dictionary – Dictionary which contains all datasets as
Signal
instances.
-
user
¶ dictionary – Dictionary which contains user related metadata.
-
microscope
¶ dictionary – Dictionary which contains microscope related metadata.
-
sample
¶ dictionary – Dictionary which contains sample related metadata.
-
comments
¶ dictionary – Dictionary which contains additional commentary metadata.
-
add_signal
(signal, name=None, metadata=None)¶ Add a HyperSpy signal to the EMD instance and make sure all metadata is present.
Parameters: - signal (
Signal
) – HyperSpy signal which should be added to the EMD instance. - name (string, optional) – Name of the (used as a key for the signals dictionary). If not specified, signal.metadata.General.title will be used. If this is an empty string, both name and signal title are set to ‘dataset’ per default. If specified, name overwrites the signal title.
- metadata (dictionary) – Dictionary which holds signal specific metadata which will be added to the signal.
Returns: Return type: None
Notes
This is the preferred way to add signals to the EMD instance. Directly adding to the signals dictionary is possible but does not make sure all metadata are correct. This method is also called in the standard constructor on all entries in the signals dictionary!
- signal (
-
classmethod
load_from_emd
(filename, lazy=False)¶ Construct
EMD
object from an emd-file.Parameters: - filename (string) – The name of the emd-file from which to load the signals. Standard format is ‘*.emd’.
- False (bool, optional) – If False (default) loads data to memory. If True, enables loading only if requested.
Returns: emd – A
EMD
object containing the loaded signals.Return type:
-
log_info
()¶ Print all relevant information about the EMD instance.
-
-
hyperspy.io_plugins.emd.
file_reader
(filename, log_info=False, lazy=False, **kwds)¶
-
hyperspy.io_plugins.emd.
file_writer
(filename, signal, signal_metadata=None, user=None, microscope=None, sample=None, comments=None, **kwds)¶