app.model.lib.conversion#
Attributes#
A conversion table for the ratios between pairs of units |
|
Units that measure number of cells per volume |
|
Units that measure number of CFUs per volume |
|
Units for metabolites, both molar and mass concentration |
Functions#
|
Converts the "value" and "std" columns of a dataframe from the source units |
|
Convert an individual value (or a numpy array) from the given source unit |
|
Converts the given time value from the source units to the target units by |
Module Contents#
- app.model.lib.conversion.MEASUREMENT_RATIOS[source]#
A conversion table for the ratios between pairs of units
- app.model.lib.conversion.CELL_COUNT_UNITS = ('Cells/mL', 'Cells/μL')[source]#
Units that measure number of cells per volume
- app.model.lib.conversion.CFU_COUNT_UNITS = ('CFUs/mL', 'CFUs/μL')[source]#
Units that measure number of CFUs per volume
- app.model.lib.conversion.METABOLITE_UNITS = ('mM', 'μM', 'nM', 'pM', 'g/L', 'mg/L')[source]#
Units for metabolites, both molar and mass concentration
- app.model.lib.conversion.convert_df_units(df, source_units, target_units, metabolite_mass=None)[source]#
Converts the “value” and “std” columns of a dataframe from the source units to the target units, if possible.
Returns the target units on success, or the source units if the requested target units are incompatible (e.g. Cells/mL and CFUs/mL).
- app.model.lib.conversion.convert_measurement_units(value, source_units, target_units, mass=None)[source]#
Convert an individual value (or a numpy array) from the given source unit to the given target unit. Returns None if the units are incompatible (e.g. Cells/mL and CFUs/mL).
There is special handling for molar concentrations and mass concentrations for metabolites, where the function expects the mass of the metabolite to perform the conversion. If the mass is not given in this case, the function returns None.