Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_Perrys2_313_data():
# All values calculated at Tmin and Tmax check out to at least 5E-3 precision
# The rounding has some effect, but it is not worrying.
assert all([checkCAS(i) for i in Perrys2_313.index])
tots_calc = [Perrys2_313[i].abs().sum() for i in [u'C1', u'C2', u'C3', u'C4', u'C5', u'Tmin', u'Tmax']]
tots = [9166.6971369999992, 615425.94497999991, 1125.5317557875198, 9.054869390623603e+34, 402.21244000000002, 72467.140000000014, 136954.85999999999]
assert_allclose(tots_calc, tots)
assert Perrys2_313.index.is_unique
assert Perrys2_313.shape == (337, 8)
def test_VDI_PPDS_2_data():
'''Plenty of interesting errors here.
The chemicals 463-58-1, 75-44-5, 75-15-0, 7446-11-9, 2551-62-4
do not match the tabulated data. They are all in the same section, so a
mixup was probably made there. The errors versus the tabulated data are
very large.
Note this table needed to have Tc and MW added to it as well, from the
same source.
'''
assert all([checkCAS(i) for i in VDI_PPDS_2.index])
tots_calc = [VDI_PPDS_2[i].abs().sum() for i in [u'A', u'B', u'C', u'D', u'Tc', u'rhoc', u'MW']]
tots = [208878.27130000002, 117504.59450000001, 202008.99950000001, 85280.333600000013, 150142.28, 97269, 27786.919999999998]
assert_allclose(tots_calc, tots)
assert VDI_PPDS_2.index.is_unique
assert VDI_PPDS_2.shape == (272, 8)
def test_CRC_inorg_l_data2():
tots_calc = [CRC_inorg_l_data[i].abs().sum() for i in ['rho', 'k', 'Tm', 'Tmax']]
tots = [882131, 181.916, 193785.09499999997, 233338.04999999996]
assert_allclose(tots_calc, tots)
assert CRC_inorg_l_data.index.is_unique
assert all([checkCAS(i) for i in CRC_inorg_l_data.index])
def test_Perrys2_315_data():
# From perry's - Deuterium , Nitrogen trifluoride , Nitrous oxide Silicon tetrafluoride , Terephthalic acid all have no data
# All perry's use #100.
# Tmins all match at 5E-4.
# Tmaxs all match at 2E-3.
assert all([checkCAS(i) for i in Perrys2_315.index])
tots_calc = [Perrys2_315[i].abs().sum() for i in [u'C1', u'C2', u'C3', u'C4', u'C5', u'Tmin', u'Tmax']]
tots = [82.001667499999996, 0.19894598900000002, 0.0065330144999999999, 0.00046928630199999995, 1.0268010799999999e-07, 70996.369999999995, 138833.41]
assert_allclose(tots_calc, tots)
assert Perrys2_315.index.is_unique
assert Perrys2_315.shape == (340, 8)
def test_CRC_const_inorg_s():
tot = CRC_inorg_s_const_data['Vm'].sum()
assert_allclose(tot, 0.13528770767318143)
assert CRC_inorg_s_const_data.index.is_unique
assert all([checkCAS(i) for i in CRC_inorg_s_const_data.index])
def test_ATcT_l():
assert ATcT_l.index.is_unique
assert ATcT_l.shape == (34,5)
assert all([checkCAS(i) for i in ATcT_l.index])
tots_calc = [ATcT_l[i].abs().sum() for i in ['Hf_0K', 'Hf_298K', 'uncertainty']]
tots = [2179500.0, 6819443, 19290]
assert_allclose(tots_calc, tots)
def test_Yaws_Tb_data():
tot = Yaws_data.sum()
assert_allclose(tot, 6631287.51)
assert Yaws_data.index.is_unique
assert Yaws_data.shape == (13461, 1)
assert all([checkCAS(i) for i in Yaws_data.index])
def test_VDI_PPDS_8_data():
# Coefficients for water are incorrect - obtained an average deviation of 150%!
assert all([checkCAS(i) for i in VDI_PPDS_8.index])
tots_calc = [VDI_PPDS_8[i].abs().sum() for i in [u'A', u'B', u'C', u'D', u'E']]
tots = [0.00032879559999999999, 9.5561339999999995e-06, 2.8377710000000001e-09, 2.8713399999999998e-12, 2.8409200000000004e-15]
assert_allclose(tots_calc, tots)
assert VDI_PPDS_8.index.is_unique
assert VDI_PPDS_8.shape == (274, 6)
def test_Perry_l_data():
assert Perry_l_data.index.is_unique
assert all([checkCAS(i) for i in Perry_l_data.index])
tots_calc = [Perry_l_data[i].sum() for i in ['C1', 'C2', 'C3', 'C4', 'Tmin', 'Tmax']]
tots = [376364.41000000003, 89.676429999999996, 189873.32999999999, 96.68741, 71151.899999999994, 189873.32999999999]
assert_allclose(tots_calc, tots)
def test_Perrys2_312_data():
# rtol=2E-4 for Tmin; only helium-4 needs a higher tolerance
# Everything hits 0 at Tmax except Difluoromethane, methane, and water;
# those needed their Tmax adjusted to their real Tc.
# C1 is divided by 1000, to give units of J/mol instead of J/kmol
# Terephthalic acid removed, was a constant value only.
assert all([checkCAS(i) for i in Perrys2_150.index])
tots_calc = [Perrys2_150[i].abs().sum() for i in [u'Tc', u'C1', u'C2', u'C3', u'C4', u'Tmin', u'Tmax']]
tots = [189407.42499999999, 18617223.739999998, 174.34494000000001, 112.51209900000001, 63.894040000000004, 70810.849999999991, 189407.005]
assert_allclose(tots_calc, tots)
assert Perrys2_150.index.is_unique
assert Perrys2_150.shape == (344, 8)