-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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:
vivarium-core/vivarium/library/dict_utils.py
Lines 264 to 268 in 6836411
if isinstance(value, Quantity): | |
unit_key = (key, str(value.units)) | |
if unit_key not in timeseries: | |
timeseries[unit_key] = [] | |
timeseries[unit_key].append(value.magnitude) |
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.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request