hyperspy.io_plugins.zspy module

class hyperspy.io_plugins.zspy.ZspyReader(file)

Bases: hyperspy.io_plugins._hierarchical.HierarchicalReader

Initializes a general reader for hierarchical signals.


file (str) – A file to be read.

class hyperspy.io_plugins.zspy.ZspyWriter(file, signal, expg, **kwargs)

Bases: hyperspy.io_plugins._hierarchical.HierarchicalWriter

Initialize a generic file writer for hierachical data storage types.

  • file (str) – The file where the signal is to be saved

  • signal (BaseSignal) – A BaseSignal to be saved

  • group (Group) – A group to where the experimental data will be saved.

  • kwds – Any additional keywords used for saving the data.

static _get_object_dset(group, data, key, chunks, **kwds)

Creates a Zarr Array object for saving ragged data

static _store_data(data, dset, group, key, chunks)

Write data to zarr format.

hyperspy.io_plugins.zspy.file_reader(filename, lazy=False, **kwds)

Read data from zspy files saved with the hyperspy zspy format specification.

  • filename (str) –

  • lazy (bool) – Load image lazily using dask

  • **kwds

  • optional

hyperspy.io_plugins.zspy.file_writer(filename, signal, close_file=True, **kwds)

Writes data to hyperspy’s zarr format.

  • filename (str) – The name of the file used to save the signal.

  • signal (a BaseSignal instance) – The signal to save.

  • chunks (tuple of integer or None, default: None) – Define the chunking used for saving the dataset. If None, calculates chunks for the signal, with preferably at least one chunk per signal space.

  • compressor (numcodecs compression) – The default is to use a Blosc compressor.

  • close_file (bool, default: True) – Close the file after writing.

  • write_dataset (bool, default: True) – If True, write the data, otherwise, don’t write it. Useful to save attributes without having to write the whole dataset.

  • **kwds – The keyword argument are passed to the zarr.hierarchy.Group.require_dataset() function.