- Mercury.add_model(propname, model, regen_mode='', **kwargs)¶
Adds a new model to the models dictionary.
propname (str) – The name of the property to be calculated by the model.
model (function) – A reference (handle) to the function to be used.
regen_mode (str) –
Controls how/when the model is run (See Notes for more details). Options are:
’normal’ - (default) The model is run directly upon being assiged, and also run every time
’constant’ - The model is run directly upon being assigned, but is not called again, thus making it’s data act like a constant. If, however, the data is deleted from the object it will be regenerated again.
’deferred’ - Is not run upon being assigned, but is run the first time that
’explicit’ - Is only run if the model name is explicitly passed to the
regenerate_modelsmethod. This allows full control of when the model is run.