def test_iast_model(self, load_iast_models): """Test on pre-calculated data.""" gas_fraction = [0.5, 0.5] adsorbed_fractions = [0.2833, 0.7167] loadings = pygaps.iast(load_iast_models, gas_fraction, 1) assert numpy.isclose(adsorbed_fractions[0], loadings[0], 0.001)
def test_iast(self, load_iast): """Test on pre-calculated data.""" gas_fraction = [0.5, 0.5] adsorbed_fractions = [0.23064, 0.76936] loadings = pygaps.iast(load_iast, gas_fraction, 1) assert numpy.isclose(adsorbed_fractions[0], loadings[0], 0.001)
def test_iast(self, load_iast): ch4, c2h6 = load_iast adsorbed_fractions = [0.23064, 0.76936] partial_pressures = [0.5, 0.5] loadings = pygaps.iast([ch4, c2h6], partial_pressures, verbose=True) assert numpy.isclose(adsorbed_fractions[0], loadings[0], 0.001)
def test_iast_checks(self, load_iast): ch4, c2h6 = load_iast # IAST CHECKS # Raises error components with pytest.raises(ParameterError): pygaps.iast([ch4], [0.1]) # Raises error different dimensions with pytest.raises(ParameterError): pygaps.iast([ch4, c2h6], [0.1]) # REVERSE IAST CHECKS # Raises error components with pytest.raises(ParameterError): pygaps.reverse_iast([ch4], [0.1], 2) # Raises error different dimensions with pytest.raises(ParameterError): pygaps.reverse_iast([ch4, c2h6], [0.1], 2) # Raises error sum not adds to one with pytest.raises(ParameterError): pygaps.reverse_iast([ch4, c2h6], [0.1, 0.4], 2) # VLE CHECKS # Raises error components with pytest.raises(ParameterError): pygaps.iast_binary_vle([ch4], 1) # SVP CHECKS # Raises error components with pytest.raises(ParameterError): pygaps.iast_binary_svp([ch4], [0.1], [1, 2]) # Raises error not adds to one with pytest.raises(ParameterError): pygaps.iast_binary_svp([ch4, c2h6], [0.1, 0.4], [1, 2])
def test_iast_checks(self, load_iast, load_iast_models): """Checks for built-in safeguards.""" ch4, c2h6 = load_iast # Raises "not enough components error" with pytest.raises(pygaps.ParameterError): pygaps.iast([ch4], [0.1], 1) # Raises "different dimensions of arrays" with pytest.raises(pygaps.ParameterError): pygaps.iast([ch4, c2h6], [0.1], 1) # Raises "model cannot be used with IAST" ch4_m = pygaps.ModelIsotherm.from_pointisotherm(ch4, model='Virial') with pytest.raises(pygaps.ParameterError): pygaps.iast([ch4_m, c2h6], [0.6, 0.4], 1) # Warning "extrapolate outside range" with pytest.warns(Warning): pygaps.iast(load_iast_models, [0.5, 0.5], 100)
def test_iast_verbose(self, load_iast): """Test verbosity.""" pygaps.iast(load_iast, [0.5, 0.5], 1, verbose=True)