def __init__(self): """ Get all needed values from the store""" store = get_store() # The length of the capillary (centimeter) self.total_length = LengthUnits.convert_unit(float(store.get('Capillary')["value"]), store.get('Capillary')["unit"], u"cm") # The window length (centimeter) self.to_window_length = LengthUnits.convert_unit(float(store.get('Towindow')["value"]), store.get('Towindow')["unit"], u"cm") # The capillary inside diameter (micrometer) #PROBLEM WITH UNICODE NON ASCII self.diameter = LengthUnits.convert_unit(float(store.get('Idiameter')["value"]), store.get('Idiameter')["unit"], u"µm") # The pressure drop across the capillary (mbar) self.pressure = PressureUnits.convert_unit(float(store.get('Pressure')["value"]), store.get('Pressure')["unit"], u"mbar") # The time the pressure is applied (second) self.duration = TimeUnits.convert_unit(float(store.get('Time')["value"]), store.get('Time')["unit"], u"s") # The buffer viscosity (cp) self.viscosity = float(store.get('Viscosity')["value"]) #molecular weight (g/mol) self.molweight = float(store.get("Molweight")["value"]) # Analyte concentration (g/L) if store.get('Concentration')["unit"] == u"mmol/L": tmpconcetration = MolConcentrationUnits.convert_unit(float(store.get('Concentration')["value"]), store.get('Concentration')["unit"], u"mol/L") self.concentration = self.molweight * tmpconcetration else: self.concentration = float(store.get('Concentration')["value"]) # The voltage applied to the capillary (volt) self.voltage = VoltUnits.convert_unit(float(store.get('Voltage')["value"]), store.get('Voltage')["unit"], u"V") # The current applied to the capillary (microampere) self.electric_current = float(store.get('Electriccurrent')["value"]) # The detection time (s) self.detection_time = TimeUnits.convert_unit(float(store.get('Detectiontime')["value"]), store.get('Detectiontime')["unit"], u"s") # The electro-osmosis time (s) self.electro_osmosis_time = TimeUnits.convert_unit(float(store.get('Electroosmosis')["value"]), store.get('Electroosmosis')["unit"], u"s")
def test_convert_mmolperl_to_molperl(self): value = MolConcentrationUnits.convert_unit(10, 'mmol/L', 'mol/L') self.assertEqual(value, 0.01)