Source code for pycif.utils.classes.measurements
from types import MethodType
from ...utils.check.errclass import PluginError
from ...utils.datastores.empty import init_empty
from .baseclass import Plugin
[docs]class Measurement(Plugin):
[docs] def initiate_template(self):
super(Measurement, self).initiate_template(
plg_type="measurements",
default_functions={"parse_tracers": True}
)
[docs] @classmethod
def register_plugin(cls, name, version, module, subtype="", **kwargs):
"""Register a module for a plugin and version with possibly options
Args:
name (str): name of the plugin
version (str): version of the plugin
module (types.ModuleType): module defining the interface
between pyCIF and the plugin
plugin_type (str): type of plugin
**kwargs (dictionary): default options for module
"""
super(Measurement, cls).register_plugin(
name, version, module, plugin_type="measurements", subtype=subtype
)
[docs] def ini_data(self, **kwargs):
"""Initializes the measurement plugin. This is pased on iterating over
multiple species and providers
Args:
plugin (MeasurementPlugin): Measurement definition
Returns:
Updates on the fly the measurements
"""
datei = self.datei
datef = self.datef
# If the measurement definition is empty in the Yaml,
# return an empty datastore
self.datastore = self.parse_tracers(datei, datef, **kwargs)
[docs] def parse_tracers(self, *args, **kwargs):
"""Default empty minimize function
"""
raise PluginError("The function parse_tracers was not defined")