vivarium.library.datum module

class vivarium.library.datum.Datum(config)[source]

Bases: dict

The Datum class enables functions to be defined on dicts of a certain schema. It provides two class level variables:

  • defaults: a dictionary of keys to default values this Datum will have if

    none is provided to __init__

  • schema: a dictionary of keys to constructors which invoke subdata.

Once these are defined, a Datum subclass can be constructed with a dict that provides any values beyond the defaults, and then all of the defined methods for that Datum subclass are available to operate on its values. Once the modifications are complete, it can be rendered back into a dict using the to_dict() method.

defaults = {}
fields()[source]
schema = {}
to_dict()[source]
vivarium.library.datum.first(l)[source]
vivarium.library.datum.first_value(d)[source]