amep.base.BaseDatabase#
- class amep.base.BaseDatabase(path: str)#
Bases:
object
Evaluation database base class for storing and loading multiple evaluation results stored in a single HDF5 file.
- __init__(path: str) None #
Loads/creates a database HDF5 file for storing data of multiple evaluate objects in a single file.
- Parameters:
path (str) – Path of the HDF5 file. Raises an error if the path does not contain a filename with file extension ‘.h5’.
- Return type:
None.
Examples
>>> import amep >>> traj = amep.load.traj("../examples/data/lammps.h5amep") >>> msd = amep.evaluate.MSD(traj) >>> sf2d = amep.evaluate.SF2d(traj, nav=2) >>> db = amep.base.BaseDatabase('./eval/database.h5') >>> db.add('msd', msd) >>> db.add('sf2d', sf2d) >>> print(db.keys()) ['msd', 'sf2d'] >>> print(db.msd) <amep.base.BaseEvalData object at 0x0000025B7CB439A0> >>> db.delete('msd') >>> print(db.keys()) ['sf2d'] >>> print(db.items()) [('sf2d', <amep.base.BaseEvalData object at 0x0000025B7A0A6E30>)] >>>
Methods
__init__
(path)Loads/creates a database HDF5 file for storing data of multiple evaluate objects in a single file.
add
(name, evaluation)Adds the data of an evaluate object as a new group to the database HDF5 file.
delete
(name)Deletes a group/data from the database HDF5 file.
items
()keys
()values
()- add(name: str, evaluation: BaseEvaluation) None #
Adds the data of an evaluate object as a new group to the database HDF5 file.
- Parameters:
name (str) – Name of the group/data.
evaluation (BaseEvaluation) – Evaluate object of which the data should be stored in the database HDF5 file.
- Return type:
None.
- delete(name: str) None #
Deletes a group/data from the database HDF5 file.
- Parameters:
name (str) – Name of the group that should be deleted.
- Return type:
None.