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_h5 and massphoto.write.save_h5.

Parameters:
  • filepath (PathLike) – Output file path.

  • movie (ndarray) – Movie array with shape (n_frames, height, width).

  • metadata (dict | None) – Optional metadata mapping to store as datasets/attributes.

  • **kwargs – Reserved for future compatibility.

Return type:

None

massphoto.write.save_mp(filepath, movie, binning_time=None, binning_pixel=None, metadata=None, mp_version=0)[source]#

Save a movie to the MassPhotometer .mp HDF5 container format.

Note

Available as both massphoto.save_mp and massphoto.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 metadata is not provided.

  • binning_pixel (int | None) – Optional acquisition binning values written to the expected HDF5 keys when metadata is 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 3 for the newer movie/frame layout, otherwise the legacy top-level frame dataset 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_tiff and massphoto.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_pixel and mp_version arguments are accepted for API compatibility with save_mp() but are not used.