Writing Movies#
Functions to write movies to h5, mp, and tiff files.
- massphoto.write.save_h5(filepath, movie, metadata=None, **kwargs)[source]#
Save a movie to an HDF5 file.
Note
Available as both
massphoto.save_h5andmassphoto.write.save_h5.
- massphoto.write.save_mp(filepath, movie, binning_time=None, binning_pixel=None, metadata=None, mp_version=0)[source]#
Save a movie to the MassPhotometer
.mpHDF5 container format.Note
Available as both
massphoto.save_mpandmassphoto.write.save_mp.- Parameters:
filepath (PathLike) – Output file path (usually
.mp).movie (ndarray) – Movie array with shape
(n_frames, height, width).binning_time (int | None) – Optional acquisition binning values written to the expected HDF5 keys when
metadatais not provided.binning_pixel (int | None) – Optional acquisition binning values written to the expected HDF5 keys when
metadatais not provided.metadata (dict) – Optional metadata mapping written into the HDF5 file. When provided, it takes precedence over
binning_time/binning_pixel.mp_version (int) – MP file layout version. Use
3for the newermovie/framelayout, otherwise the legacy top-levelframedataset layout is used.
- Return type:
None
- massphoto.write.save_tiff(filepath, movie, binning_time=None, binning_pixel=None, metadata=None, mp_version=0, dtype='uint16')[source]#
Save a movie as a multi-page TIFF file.
Note
Available as both
massphoto.save_tiffandmassphoto.write.save_tiff.- Parameters:
filepath (PathLike) – Output file path (usually
.tif/.tiff).movie (ndarray) – Movie array with shape
(n_frames, height, width).metadata (dict) – Optional scalar metadata to embed into the TIFF (non-scalar entries are ignored).
dtype (str | dtype) – Data type used for saving. Default is
uint16.binning_time (int | None)
binning_pixel (int | None)
mp_version (int)
- Return type:
None
Notes
The
binning_time,binning_pixelandmp_versionarguments are accepted for API compatibility withsave_mp()but are not used.