xsimlab.process

xsimlab.process(maybe_cls=None, autodoc=True, apply_attrs=True)Type[Process]

A class decorator that adds everything needed to use the class as a process.

A process represents a logical unit in a computational model.

A process class usually implements:

  • An interface as a set of variables defined as class attributes (see, e.g., variable(), foreign(), on_demand(), group(), etc.). When the class is used within a Model object, this decorator automatically adds properties to get/set values for these variables.

  • One or more methods among initialize(), run_step(), finalize_step() and finalize(), which are called at different stages of a simulation and perform some computation based on the variables defined in the process interface.

  • Decorated methods to compute, validate or set a default value for one or more variables.

Parameters
  • maybe_cls (class, optional) – Allows to apply this decorator to a class either as @process or @process(*args).

  • autodoc (bool, optional) – If True (default), automatically adds an attributes section to the docstring of the class to which the decorator is applied, using the metadata of each variable declared in the class.

  • apply_attrs (bool, optional) – If True (default), applies the attr.s() decorator to the class. Set it to False if the class is already decorated by attr.s.