energy

A module containing the Energy class.

Summary

Classes:

Energy

A class to store the data of an energy file.

Reference

class Energy(
data: Np1DNumberArray | Np2DNumberArray,
info: dict | None = None,
units: dict | None = None,
)[source]

Bases: object

A class to store the data of an energy file.

The data array is stored in a way that each column corresponds to a physical quantity. The order of the columns is the same as in the info file. The info and units of the info file are stored in the Energy object, if an info file was found.

Parameters:
  • data (Np1DNumberArray | Np2DNumberArray) – The data of the energy file as a np.array with shape (n, m), where n is the number of data entries and m is the number of physical properties. If the data is a 1D array, it is converted to a 2D array with shape (1, n).

  • info (dict, optional) – the info dictionary, by default None

  • units (dict, optional) – the units dictionary, by default None

Notes

If no info dictionary is given, a default dictionary is created, where the keys are the indices of the data array and the values are the indices of the data array. Furthermore a units dictionary can be given, where the keys have to match the keys of the info dictionary and the values are the units of the physical properties. If no units dictionary is given, the units are set to None.

The attributes of any Energy object are created for each physical property found in the info file. The attribute names can be found in the __data_attributes__ dictionary. The attribute names are the keys of the dictionary and the values are the names of the physical properties found in the info file. The attributes are created as follows:

  • The attribute name is the key of the __data_attributes__ dictionary.

  • The attribute value is the corresponding data entry (column in energy file).

  • The attribute name + “_unit” is the corresponding unit.

  • The attribute name + “_with_unit” is a tuple of the corresponding data entry and the corresponding unit.

For example, the attribute “simulation_time” is created for the physical property “SIMULATION-TIME” found in the info file. The attribute “simulation_time” is the corresponding data entry (column in energy file). The attribute “simulation_time_unit” is the corresponding unit. The attribute “simulation_time_with_unit” is a tuple of the corresponding data entry and the corresponding unit.

logger = <CustomLogger PQAnalysis.Energy (INFO)>