add_model#
- SpeciesByName.add_model(propname, model, regen_mode='', **kwargs)#
Adds a new model to the models dictionary.
- Parameters
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:
mode
meaning
’normal’
The model is run directly upon being assigned, and also run every time
regenerate_models
is called.’constant’
The model is run directly upon being assigned, but is not called again, thus making its 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
regenerate_models
is called.’explicit’
Is only run if the model name is explicitly passed to the
regenerate_models
method. This allows full control of when the model is run.