def test_Tm_ON_data(): tot = Tm_ON_data.sum() assert_allclose(tot, 4059989.425) assert Tm_ON_data.shape == (11549, 1) assert Tm_ON_data.index.is_unique assert all([checkCAS(i) for i in Tm_ON_data.index])
def test_Hfus_CRC_data(): Hfus_total = CRCHfus_data['Hfus'].sum() assert_allclose(Hfus_total, 29131241) assert CRCHfus_data.index.is_unique assert CRCHfus_data.shape == (1112, 3) assert all([checkCAS(i) for i in list(CRCHfus_data.index)])
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_Magomedovk_thermal_cond(): assert all([checkCAS(i) for i in Magomedovk_thermal_cond.index]) assert Magomedovk_thermal_cond.index.is_unique assert Magomedovk_thermal_cond.shape == (39, 3) tot_calc = Magomedovk_thermal_cond['Ai'].abs().sum() tot = 0.10688 assert_allclose(tot_calc, tot)
def test_CRC_aqueous_thermodynamics(): assert all([checkCAS(i) for i in CRC_aqueous_thermodynamics.index]) # Check CASs match up assert all([CAS_from_any(i) == i for i in CRC_aqueous_thermodynamics.index]) # Check search by formula matches up for formula, CAS in zip(CRC_aqueous_thermodynamics['Formula'], CRC_aqueous_thermodynamics.index): assert pubchem_db.search_CAS(CAS_from_any(formula)).CASs == CAS # Check the MWs match up for CAS, MW_specified in zip(CRC_aqueous_thermodynamics.index, CRC_aqueous_thermodynamics['MW']): c = pubchem_db.search_CAS(CAS) assert_allclose(c.MW, MW_specified, atol=0.05) # Checking names is an option too but of 173, only 162 are unique # and many of the others have names that seem ambiguous for ions which can # have more than one charge assert CRC_aqueous_thermodynamics.index.is_unique assert CRC_aqueous_thermodynamics.shape == (173, 7) Hf_tot = CRC_aqueous_thermodynamics['Hf(aq)'].abs().sum() assert_allclose(Hf_tot, 70592500.0) Gf_tot = CRC_aqueous_thermodynamics['Gf(aq)'].abs().sum() assert_allclose(Gf_tot, 80924000.0) S_tot = CRC_aqueous_thermodynamics['S(aq)'].abs().sum() assert_allclose(S_tot, 17389.9) Cp_tot = CRC_aqueous_thermodynamics['Cp(aq)'].abs().sum() assert_allclose(Cp_tot, 2111.5)
def test_CRC_const_inorg_l(): assert CRC_inorg_l_const_data.index.is_unique assert all([checkCAS(i) for i in CRC_inorg_l_const_data.index]) tot_calc = CRC_inorg_l_const_data['Vm'].sum() tot = 0.01106122489849834 assert_allclose(tot_calc, tot)
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_ATcT_g(): assert ATcT_g.index.is_unique assert ATcT_g.shape == (595, 5) assert all([checkCAS(i) for i in ATcT_g.index]) tots_calc = [ATcT_g[i].abs().sum() for i in ['Hf_0K', 'Hf_298K', 'uncertainty']] tots = [300788330, 300592764, 829204] assert_allclose(tots_calc, tots)
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_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_CRC_organic(): tots_calc = [CRC_organic_data[i].sum() for i in ['Tm', 'Tb', 'rho', 'RI']] tots = [2571284.4804000002, 2280667.0800000001, 6020405.0616999995, 6575.4144047999998] assert_allclose(tots_calc, tots) assert CRC_organic_data.index.is_unique assert CRC_organic_data.shape == (10867, 5) assert all([checkCAS(i) for i in CRC_organic_data.index])
def test_WagnerPoling(): sums_calc = [WagnerPoling[i].abs().sum() for i in ['A', 'B', 'C', 'D', 'Tmin', 'Tmax', 'Tc', 'Pc']] sums = [894.39071999999999, 271.76480999999995, 525.8134399999999, 538.25393000000008, 24348.006000000001, 59970.149999999994, 63016.021000000001, 357635500] assert_allclose(sums_calc, sums) assert WagnerPoling.index.is_unique assert WagnerPoling.shape == (104, 9) assert all([checkCAS(i) for i in WagnerPoling.index])
def test_AntoinePoling(): sums_calc = [AntoinePoling[i].abs().sum() for i in ['A', 'B', 'C', 'Tmin', 'Tmax']] sums = [2959.75131, 398207.29786, 18732.24601, 86349.09, 120340.66] assert_allclose(sums_calc, sums) assert AntoinePoling.index.is_unique assert AntoinePoling.shape == (325, 6) assert all([checkCAS(i) for i in AntoinePoling.index])
def test_VN2E_data(): assert all([checkCAS(i) for i in VN2E_data.index]) tots_calc = [VN2E_data[i].abs().sum() for i in ['C', 'D', 'Tmin', 'Tmax']] tots = [567743298666.74878, 48.8643, 3690, 4860] assert_allclose(tots_calc, tots) assert VN2E_data.index.is_unique assert VN2E_data.shape == (14, 6)
def test_AntoineExtended(): sums_calc = [AntoineExtended[i].abs().sum() for i in ['A', 'B', 'C', 'Tc', 'to', 'n', 'E', 'F', 'Tmin', 'Tmax']] sums = [873.55827000000011, 107160.285, 4699.9650000000001, 47592.470000000001, 7647, 241.56537999999998, 22816.815000000002, 1646509.79, 33570.550000000003, 46510.849999999999] assert_allclose(sums_calc, sums) assert AntoineExtended.index.is_unique assert AntoineExtended.shape == (97, 11) assert all([checkCAS(i) for i in AntoineExtended.index])
def test_VN2_data(): assert all([checkCAS(i) for i in VN3_data.index]) tots_calc = [VN2_data[i].abs().sum() for i in ['A', 'B', 'Tmin', 'Tmax']] tots = [674.10069999999996, 83331.98599999999, 39580, 47897] assert_allclose(tots_calc, tots) assert VN2_data.index.is_unique assert VN2_data.shape == (135, 6)
def test_VN3_data(): assert all([checkCAS(i) for i in VN3_data.index]) tots_calc = [VN3_data[i].abs().sum() for i in ['A', 'B', 'C', 'Tmin', 'Tmax']] tots = [645.18849999999998, 169572.65159999998, 50050.151870000002, 126495, 175660] assert_allclose(tots_calc, tots) assert VN3_data.index.is_unique assert VN3_data.shape == (432, 7)
def test_Dutt_Prasad_data(): assert all([checkCAS(i) for i in Dutt_Prasad.index]) tots_calc = [Dutt_Prasad[i].abs().sum() for i in ['A', 'B', 'C', 'Tmin', 'Tmax']] tots = [195.89260000000002, 65395.299999999996, 9849.1899999999987, 25952, 35016] assert_allclose(tots_calc, tots) assert Dutt_Prasad.index.is_unique assert Dutt_Prasad.shape == (100, 6)
def test_VDI_PPDS_7_data(): assert all([checkCAS(i) for i in VDI_PPDS_7.index]) tots_calc = [VDI_PPDS_7[i].abs().sum() for i in [u'A', u'B', u'C', u'D', u'E']] tots = [507.14607000000001, 1680.7624099999998, 165461.14259999999, 46770.887000000002, 0.057384780000000003] assert_allclose(tots_calc, tots) assert VDI_PPDS_7.index.is_unique assert VDI_PPDS_7.shape == (271, 7)
def test_WagnerMcGarry(): sums_calc = [WagnerMcGarry[i].abs().sum() for i in ['A', 'B', 'C', 'D', 'Pc', 'Tc', 'Tmin']] sums = [1889.3027499999998, 509.57053652899992, 1098.2766456999998, 1258.0866876, 1005210819, 129293.19100000001, 68482] assert_allclose(sums_calc, sums) assert WagnerMcGarry.index.is_unique assert WagnerMcGarry.shape == (245, 8) assert all([checkCAS(i) for i in WagnerMcGarry.index])
def test_CRC_inorganic(): tots_calculated = [CRC_inorganic_data[i].sum() for i in ['Tm', 'Tb', 'rho']] tots = [1543322.6125999999, 639213.23099999991, 8767127.4880000018] assert_allclose(tots, tots_calculated) assert CRC_inorganic_data.index.is_unique assert CRC_inorganic_data.shape == (2438, 4) assert all([checkCAS(i) for i in CRC_inorganic_data.index])
def test_IARC_data(): assert IARC_data.index.is_unique assert all([checkCAS(i) for i in IARC_data.index]) assert IARC_data.shape == (843, 4) dict_exp = {11: 66, 1: 76, 3: 449, 12: 251, 4: 1} dict_calc = IARC_data['group'].value_counts().to_dict() assert dict_exp == dict_calc
def test_fluid_props(): tots = [sum([getattr(f, prop) for f in coolprop_fluids.values()]) for prop in ['Tmin', 'Tmax', 'Pmax', 'Tc', 'Pc', 'Tt', 'omega']] tots_exp = [18589.301, 71673.0, 30717000000.0, 45189.59849999997, 440796750.0429425, 18589.301, 11.8685953516] assert_allclose(tots_exp, tots) assert len(coolprop_fluids) == len(coolprop_dict) assert len(coolprop_dict) == 105 assert all([checkCAS(i) for i in coolprop_dict])
def test_TSCA_data(): tots_calc = [TSCA_data[i].sum() for i in ['UV', 'E', 'F', 'N', 'P', 'S', 'R', 'T', 'XU', 'SP', 'TP', 'Y1', 'Y2']] tots = [16829, 271, 3, 713, 8371, 1173, 13, 151, 19035, 74, 50, 352, 9] assert tots_calc == tots assert TSCA_data.index.is_unique assert TSCA_data.shape == (67635, 13) assert all([checkCAS(int2CAS(i)) for i in TSCA_data.index])
def test_fluid_props(): # Not a particularly clever test - CoolProp regularly has updated values #tots = [sum([getattr(f, prop) for f in coolprop_fluids.values()]) for prop in ['Tmin', 'Tmax', 'Pmax', 'Tc', 'Pc', 'Tt', 'omega']] #tots_exp = [18589.301, 71575.0, 31017000000.0, 45189.59849999997, 440791794.7987591, 18589.301, 30.90243968446593] #assert_allclose(tots_exp, tots) assert len(coolprop_fluids) == len(coolprop_dict) assert len(coolprop_dict) == 105 assert all([checkCAS(i) for i in coolprop_dict])
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_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_Perrys2_314_data(): # In perry's, only 102 is used. No chemicals are missing. # Tmaxs all match to 5E-4. Tmins match to 1E-3. assert all([checkCAS(i) for i in Perrys2_314.index]) tots_calc = [Perrys2_314[i].abs().sum() for i in [u'C1', u'C2', u'C3', u'C4', u'Tmin', u'Tmax']] tots = [48935634.823768869, 297.41545078799999, 421906466448.71423, 232863514627157.62, 125020.26000000001, 347743.42000000004] assert_allclose(tots_calc, tots) assert Perrys2_314.index.is_unique assert Perrys2_314.shape == (345, 7)
def test_fluid_props(): tots = [sum([getattr(f, prop) for f in coolprop_fluids.values()]) for prop in ['Tmin', 'Tmax', 'Pmax', 'Tc', 'Pc', 'Tt', 'omega']] tots_exp = [18589.301, 71575.0, 30817000000.0, 45189.59849999997, 440791794.7987591, 18589.301, 30.90243968446593] assert_allclose(tots_exp, tots) assert len(coolprop_fluids) == len(coolprop_dict) assert len(coolprop_dict) == 105 assert all([checkCAS(i) for i in coolprop_dict])
def test_CRC_inorganic(): tots_calculated = [ CRC_inorganic_data[i].sum() for i in ['Tm', 'Tb', 'rho'] ] tots = [1543322.6125999999, 639213.23099999991, 8767127.4880000018] assert_allclose(tots, tots_calculated) assert CRC_inorganic_data.index.is_unique assert CRC_inorganic_data.shape == (2438, 4) assert all([checkCAS(i) for i in CRC_inorganic_data.index])
def test_VDI_PPDS_4_data(): '''I believe there are no errors here. ''' assert all([checkCAS(i) for i in VDI_PPDS_4.index]) tots_calc = [VDI_PPDS_4[i].abs().sum() for i in [u'A', u'B', u'C', u'D', u'E', u'Tc', u'MW']] tots = [1974.2929800000002, 2653.9399000000003, 2022.530649, 943.25633100000005, 3124.9258610000002, 150142.28, 27786.919999999998] assert_allclose(tots_calc, tots) assert VDI_PPDS_4.index.is_unique assert VDI_PPDS_4.shape == (272, 8)
def test_VDI_PPDS_11_data(): '''I believe there are no errors here. ''' assert all([checkCAS(i) for i in VDI_PPDS_11.index]) tots_calc = [VDI_PPDS_11[i].abs().sum() for i in [u'A', u'B', u'C', u'D', u'E', u'Tc', u'Tm']] tots = [18.495069999999998, 336.69950000000006, 6.5941200000000002, 7.7347200000000003, 6.4262199999999998, 150142.28, 56917.699999999997] assert_allclose(tots_calc, tots) assert VDI_PPDS_11.index.is_unique assert VDI_PPDS_11.shape == (272, 8)
def test_VDI_PPDS_3_data(): '''I believe there are no errors here. Average temperature deviation 0.144% vs tabulated values. ''' assert all([checkCAS(i) for i in VDI_PPDS_3.index]) tots_calc = [VDI_PPDS_3[i].abs().sum() for i in [u'A', u'B', u'C', u'D', u'Tc', u'Pc', u'Tm']] tots = [2171.4607300000002, 694.38631999999996, 931.3604499999999, 919.88944000000004, 150225.16000000003, 1265565000, 56957.849999999991] assert_allclose(tots_calc, tots) assert VDI_PPDS_3.index.is_unique assert VDI_PPDS_3.shape == (275, 8)
def test_CRC_organic(): tots_calc = [CRC_organic_data[i].sum() for i in ['Tm', 'Tb', 'rho', 'RI']] tots = [ 2571284.4804000002, 2280667.0800000001, 6020405.0616999995, 6575.4144047999998 ] assert_allclose(tots_calc, tots) assert CRC_organic_data.index.is_unique assert CRC_organic_data.shape == (10867, 5) assert all([checkCAS(i) for i in CRC_organic_data.index])
def test_CRC_virial_poly(): assert CRC_virial_data.index.is_unique assert all([checkCAS(i) for i in CRC_virial_data.index]) tots_calc = [ CRC_virial_data[i].abs().sum() for i in ['a1', 'a2', 'a3', 'a4', 'a5'] ] tots = [ 146559.69999999998, 506997.70000000001, 619708.59999999998, 120772.89999999999, 4483 ] assert_allclose(tots_calc, tots)
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)