amep.load.evaluation#
- amep.load.evaluation(path: str, key: None | str = None, database: bool = False, verbose: bool = False) BaseEvalData | BaseDatabase#
Loads evaluation data stored in an HDF5 file.
- Parameters:
path (str) – Path of the HDF5 file.
key (str or None, optional) – If database = False, the element key of the HDF5 file is returned. The default is None.
database (bool, optional) – If True, a BaseDatabase object is returned. If False, a BaseEvalData object is returned if the given HDF5 file only contains results of one evaluation (otherwise, an error is raised) or if a key is supplied. The default is False.
verbose (bool, optional) – If True, runtime information is printed. The default is False.
- Returns:
Object providing access to the HDF5 data file.
- Return type:
Examples
Calculate the MSD, save it, and load the saved data:
>>> import amep >>> traj = amep.load.traj("../examples/data/lammps.h5amep") >>> msd = amep.evaluate.MSD(traj) >>> msd.save('./eval/msd.h5') >>> data = amep.load.evaluation('./eval/msd.h5') >>> print(data.keys()) ['frames', 'indices', 'times', 'avg', 'name', 'ptype'] >>>
Calculate the VACF and save it together with the MSD in one HDF5 file. Then, load the results again:
>>> vacf = amep.evaluate.VACF(traj) >>> vacf.save('./eval/db.h5') >>> msd.save('./eval/db.h5', database=True) >>> db = amep.load.evaluation('./eval/db.h5', database=True) >>> print(db.keys()) ['msd', 'vacf'] >>>
Load only a specific observable from the HDF5 file (here: the MSD):
>>> msd = amep.load.evaluation('./eval/db.h5', key='msd') >>> print(msd.keys()) ['frames', 'indices', 'times', 'avg', 'name', 'ptype'] >>>