mease_elabftw.util.convert_weight

mease_elabftw.util.convert_weight(weight_str)

Takes a weight determines if its in g or kg and converts it into a kg float, so that the nwb_converter accepts it.

If a unit is given in the string it will be extracted and conversion will happen according to the unit. When no unit is given gram will be assumed.

Parameters

weight_str (str or int) – the weight as either a number or a string with or without unit.

Returns

unitless weight as a float

Return type

float