Example #1
0
    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")
Example #2
0
 def injection_pressure(self):
     """ return the injection pressure /s : psi/s """
     psi = PressureUnits.convert_unit(self.pressure, u"mbar", u"psi")
     injection_pressure = psi/self.duration
     return injection_pressure
 def injection_pressure(self):
     '''Return the injection pressure in psi per second
     '''
     inj_pressure = self.capillary.injection_pressure()
     return inj_pressure * PressureUnits.convert_unit(1, u"mbar", u"psi")
 def test_convert_bar_to_psi(self):
     value = PressureUnits.convert_unit(0.1, 'bar', 'psi')
     self.assertAlmostEqual(value, 1.45036839357, places=11)
 def test_convert_mbar_to_bar(self):
     value = PressureUnits.convert_unit(10, 'mbar', 'bar')
     self.assertEqual(value, 0.01)
 def test_convert_bar_to_pascal(self):
     value = PressureUnits.convert_unit(0.1, 'bar', 'pa')
     self.assertEqual(value, 10000)
 def test_convert_pascal_to_pascal(self):
     value = PressureUnits.convert_unit(10, 'pa', 'pa')
     self.assertEqual(value, 10)