save_dtrj

mdtools.file_handler.save_dtrj(fname, dtrj)[source]

Save a discrete trajectory to file.

Save a discrete trajectory as numpy.ndarray to a compressed NumPy .npz archive.

Warning

Creating a gzip-compressed .npz archive does not work. However bzip2-, xz- and lzma-compressed archives can be created. Note that the created .npz archive is already compressed by numpy.savez_compressed(). Therefore, further compression is usually not reasonable.

Parameters
  • fname (str or bytes or os.PathLike) – Name of the file to write to.

  • dtrj (array_like) – The discrete trajectory to save. Must meet the requirements given in mdtools.check.dtrj(). Note that the shape of dtrj is expanded to (1, f) if it is only of shape (f,).

See also

numpy.savez_compressed()

Save one or multiple arrays in a compressed .npz archive

mdtools.file_handler.load_dtrj()

Load a discrete trajectory from file

Notes

This function simply checks whether dtrj is a suitable discrete trajectory and then saves it to file using numpy.savez_compressed(). Insise the created .npz archive, the discrete trajectory is stored in the file dtrj.npy.