Source code for pycif.utils.classes.obsvects
from types import MethodType
import pandas as pd
from ...utils.check.errclass import PluginError
from .baseclass import Plugin
[docs]class ObsVect(Plugin):
def __init__(self, **kwargs):
"""Create a Model Class"""
super(ObsVect, self).__init__(**kwargs)
# Attribute an empty datastore
self.datastore = {}
[docs] def initiate_template(self):
super(ObsVect, self).initiate_template(
plg_type="obsvect",
default_functions={
"init_y0": True, "init_invprod": True, "rinvprod": True,
"dump": True, "read": True}
)
[docs] def init_y0(self, *args, **kwargs):
"""Default empty init_y0 method"""
raise PluginError("This is the default empty init_y0 method")
[docs] def init_invprod(self, *args, **kwargs):
"""Default empty init_invprod method"""
raise PluginError("This is the default empty init_invprod method")
[docs] def rinvprod(self, *args, **kwargs):
"""Default empty rinvprod method"""
raise PluginError("This is the default empty rinvprod method")
[docs] def dump(self, *args, **kwargs):
"""Default empty dump method"""
raise PluginError("This is the default empty dump method")
[docs] def read(self, *args, **kwargs):
"""Default empty read method"""
raise PluginError("This is the default empty read method")
[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(ObsVect, cls).register_plugin(
name, version, module, plugin_type="obsvect", subtype=subtype
)