smif.data_layer.model_loader module¶
ModelLoader reads python modules as specified at runtime, loading and instantiating objects.
Reference¶
-
class
smif.data_layer.model_loader.
ModelLoader
[source]¶ Bases:
object
Load Model from config
Examples
Call
ModelLoader.load()
to create, load and return aModel
object.>>> loader = ModelLoader() >>> sector_model = loader.load(sector_model_config) >>> conversion_model = loader.load(conversion_model_config)
-
load
(config)[source]¶ Loads the model class specified by the config, returns an instance of that class using the Model.from_dict method.
Parameters: config (dict) – - The model configuration data. Must include:
- name (name for smif internal use)
- path (absolute path to python module file)
- classname (name of Model implementation class)
- anything required by the Model.from_dict classmethod
Returns: Return type: Model
-