vivarium-core
vivarium-core copied to clipboard
Stop adding units to emitted data keys
Currently, when we emit data that has a unit in the state hierarchy and format it as a timeseries, we put the unit into the key and strip the units from the value. For example, we might get:
{
'external': {
('antibiotic', 'millimolar'): [1, 2, 3],
}
}
This is not ideal. Instead, our plotting functions should know how to handle Quantity
objects.
Here's where we do the unit conversion:
https://github.com/vivarium-collective/vivarium-core/blob/6836411396877e948b6866ba3f6507d0fd0cb43a/vivarium/library/dict_utils.py#L264-L268
And here's a trace of the calls in emitter.py
that lead to the code above:
-
vivarium.library.dict_utils.value_in_embedded_dict()
-
vivarium.core.emitter.timeseries_from_data()
-
vivarium.core.emitter.Emitter.get_timeseries()
Note that addressing this will probably be a breaking API change since doing so will change our output format.