xsimlab.Model¶
-
class
xsimlab.
Model
(processes)¶ An immutable collection of process units that together form a computational model.
This collection is ordered such that the computational flow is consistent with process inter-dependencies.
Ordering doesn’t need to be explicitly provided ; it is dynamically computed using the processes interfaces.
Processes interfaces are also used for automatically retrieving the model inputs, i.e., all the variables that require setting a value before running the model.
-
__init__
(processes)¶
Methods
__init__
(processes)- param processes
Dictionnary with process names as keys and classes (decorated with
clone
()Clone the Model.
drop_processes
(keys)Drop processe(s) from this model.
execute
(stage, runtime_context[, hooks, …])Run one stage of a simulation.
get
(k[,d])items
()keys
()update_cache
(var_key)Update the model’s cache for a given model variable.
update_processes
(processes)Add or replace processe(s) in this model.
update_state
(input_vars[, validate, …])Update the model’s state (only input variables) with new values.
validate
([p_names])Run the variable validators of all or some of the processes in the model.
values
()visualize
([show_only_variable, show_inputs, …])Render the model as a graph using dot (require graphviz).
Attributes
active
Returns all variables in the model as a list of
(process_name, var_name)
tuples (or an empty list).Returns all variables in the model as a dictionary of lists of variable names grouped by process.
Returns a mapping of model variables and some of their (meta)data cached for fastpath access.
Returns a dictionary where keys are process names and values are lists of the names of dependent processes.
Returns all index variables in the model as a list of
(process_name, var_name)
tuples (or an empty list).Returns all index variables in the model as a dictionary of lists of variable names grouped by process.
Returns all variables that require setting a value before running the model.
Returns all variables that require setting a value before running the model.
Returns a mapping of model variables and their current value.
-