hexrd.imageseries.save module

Write imageseries to various formats

class hexrd.imageseries.save.WriteFrameCache(ims, fname, **kwargs)[source]

Bases: Writer

write frame cache imageseries

The default write option is to save image data and metadata all in a single npz file. The original option was to have a YAML file as the primary file and a specified cache file for the images; this method is deprecated.

Parameters

ims: Imageseries instance

the imageseries to write

fname: str or Path

name of file to write;

threshold: float

threshold value for image, at or below which values are zeroed

cache_file: str or Path, optional

name of the npz file to save the image data, if not given in the fname argument; for YAML format (deprecated), this is required

max_workers: int, optional

The max number of worker threads for multithreading. Defaults to the number of CPUs.

property cache
fmt = 'frame-cache'
write(output_yaml=False)[source]

writes frame cache for imageseries

presumes sparse forms are small enough to contain all frames

class hexrd.imageseries.save.WriteH5(ims, fname, **kwargs)[source]

Bases: Writer

Write imageseries in HDF5 file

Parameters

ims: Imageseries

the imageseries to write

fname: str

the name of the HDF5 file to write

path: str, required

the path in HDF5 file

gzip: int 0-9

0 turns off compression, default=1

chunk_rows: int

number of rows per chunk; default is all

shuffle: bool

shuffle HDF5 data

dflt_chrows = 0
dflt_gzip = 1
dflt_shuffle = True
fmt = 'hdf5'
property h5opts
write()[source]

Write imageseries to HDF5 file

class hexrd.imageseries.save.Writer(ims, fname, **kwargs)[source]

Bases: object

Base class for writers

Parameters

ims: Imageseries

the imageseries to write

fname: str

the name of the HDF5 file to write

kwargs: dict

options specific to format

fmt = None
property fname
property fname_dir
property opts
hexrd.imageseries.save.write(ims, fname, fmt, **kwargs)[source]

write imageseries to file with options

Parameters

ims: Imageseries

the imageseries to write

fname: str

the name of the HDF5 file to write

fmt: str

format name of the imageseries

kwargs: dict

options specific to format