def test_compute_with_volume_in_CV_units(self):
        time = UnitScalar(1., units="minute")
        volume = time_to_volume(time, self.flow_rate_vol, to_unit="liter")
        assert_unit_scalar_almost_equal(volume, UnitScalar(1., units="liter"))

        time = UnitScalar(3., units="minute")
        volume = time_to_volume(time, self.flow_rate_vol, to_unit="liter")
        assert_unit_scalar_almost_equal(volume, UnitScalar(3., units="liter"))
    def test_time_std_units_with_vol_flow(self):
        time = UnitScalar(1., units="minute")
        volume = time_to_volume(time, self.flow_rate_vol, self.column)
        assert_unit_scalar_almost_equal(volume, UnitScalar(1., units="CV"))

        time = UnitScalar(3., units="minute")
        volume = time_to_volume(time, self.flow_rate_vol, self.column)
        assert_unit_scalar_almost_equal(volume, UnitScalar(3., units="CV"))
    def test_time_std_units_with_lin_flow(self):
        time = UnitScalar(10., units="minute")
        volume = time_to_volume(time,
                                flow_rate=self.flow_rate_lin,
                                column=self.column)
        self.assertAlmostEqual(volume, UnitScalar(np.pi / 4., units="CV"))

        time = UnitScalar(30., units="minute")
        volume = time_to_volume(time, self.flow_rate_lin, column=self.column)
        assert_unit_scalar_almost_equal(volume,
                                        UnitScalar(3 * np.pi / 4., units="CV"))
def calculate_pool_volume(start_collect_time, stop_collect_time, flow_rate,
                          column):
    """ Calculates pool volume in CVs.
    """
    flow_time = stop_collect_time - start_collect_time
    pool_volume = time_to_volume(flow_time, flow_rate, column, to_unit="CV")
    return pool_volume
 def test_time_as_float(self):
     with self.assertRaises(ValueError):
         time_to_volume(3., self.flow_rate_vol)