lifecycles.LifeCycle.set_attributes¶
- LifeCycle.set_attributes(attributes: dict, attr_name: str) None¶
set the temporal attributes of the elements in the LifeCycle
The temporal attributes must be provided as a dictionary keyed by the element id and valued by a dictionary keyed by the temporal id and valued by the attribute value.
- Parameters:
attr_name – the name of the attribute
attributes – a dictionary of temporal attributes
- Returns:
None
- Example:
>>> lc = LifeCycle() >>> lc.add_partition([[1,2], [3,4,5]]) >>> lc.add_partition([[1,2,3], [4,5]]) >>> attributes = { >>> 1: c{0: 'red', 1: 'blue'}, # element 1 is red at time 0 and blue at time 1 >>> 2: {0: 'green', 1: 'magenta'} # element 2 is green at time 0 and magenta at time 1 >>> } >>> lc.set_attributes(attributes, attr_name="color")