The io visualization submodule

General empyre.io docu here!

The io_field module

IO functionality for Field objects.

load_field(filename, scale=None, vector=None, **kwargs)[source]

Load supported file into a Field instance.

The function loads the file according to the extension:

SCALAR??? - hdf5 for HDF5. # TODO: You can use comp_pos here!!! - EMD Electron Microscopy Dataset format (also HDF5). - npy or npz for numpy formats.

PHASEMAP - hdf5 for HDF5. - rpl for Ripple (useful to export to Digital Micrograph). - dm3 and dm4 for Digital Micrograph files. - unf for SEMPER unf binary format. - txt format. - npy or npz for numpy formats. - Many image formats such as png, tiff, jpeg…

VECTOR - hdf5 for HDF5. - EMD Electron Microscopy Dataset format (also HDF5). - llg format. - ovf format. - npy or npz for numpy formats.

Any extra keyword is passed to the corresponsing reader. For available options see their individual documentation.

Parameters
filename: str

The filename to be loaded.

scale: tuple of float, optional

Scaling along the dimensions of the underlying data. Default is 1.

vector: bool, optional

True if the field should be a vector field, False if it should be interpreted as a scalar field (default).

Returns
field: Field

A Field object containing the loaded data.

Notes

Falls back to HyperSpy routines for loading data, make sure it is installed if you need the full capabilities.

save_field(filename, field, **kwargs)[source]

Saves the Field in the specified format.

The function gets the format from the extension:
  • hdf5 for HDF5.

  • EMD Electron Microscopy Dataset format (also HDF5).

  • npy or npz for numpy formats.

If no extension is provided, ‘hdf5’ is used. Most formats are saved with the HyperSpy package (internally the field is first converted to a HyperSpy Signal. Each format accepts a different set of parameters. For details see the specific format documentation.

Parameters
filenamestr, optional

Name of the file which the Field is saved into. The extension determines the saving procedure.

The field_plugins module

Subpackage containing EMPyRe IO functionality for the Field class.