Source code for pycif.utils.classes.controlvects
from types import MethodType
from ...utils.check.errclass import PluginError
from .baseclass import Plugin
[docs]class ControlVect(Plugin):
def __init__(self, **kwargs):
"""Create a Model Class"""
super(ControlVect, self).__init__(**kwargs)
# Default attributes
self.datastore = {}
[docs] def initiate_template(self):
super(ControlVect, self).initiate_template(
plg_type="controlvect",
default_functions={
k: True for k in [
"state2inputs", "outputs2state", "control2native",
"native2control", "sqrtbprod", "sqrtbprod_ad", "dump", "load",
"init_structure", "init_xb", "init_bprod", "crop"]
}
)
[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(ControlVect, cls).register_plugin(
name, version, module, plugin_type="controlvect", subtype=subtype
)
[docs] def outputs2state(self, *args, **kwargs):
"""Default empty outputs2state method"""
raise PluginError("This is the default empty outputs2state method")
[docs] def control2native(self, *args, **kwargs):
"""Default empty control2native method"""
raise PluginError("This is the default empty control2native method")
[docs] def native2control(self, *args, **kwargs):
"""Default empty native2control method"""
raise PluginError("This is the default empty native2control method")
[docs] def sqrtbprod(self, *args, **kwargs):
"""Default empty sqrtbprod method"""
raise PluginError("This is the default empty sqrtbprod method")
[docs] def sqrtbprod_ad(self, *args, **kwargs):
"""Default empty sqrtbprod_ad method"""
raise PluginError("This is the default empty sqrtbprod_ad method")
[docs] def dump(self, *args, **kwargs):
"""Default empty dump method"""
raise PluginError("This is the default empty dump method")
[docs] def crop(self, *args, **kwargs):
"""Default crop dump method"""
raise PluginError("This is the default empty crop method")
[docs] def load(self, *args, **kwargs):
"""Default empty load method"""
raise PluginError("This is the default empty load method")