Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebBell committed Dec 13, 2024
1 parent 95d21fe commit 7642f4c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 0 additions & 1 deletion tests/Data/joback_log_good_sorted.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2321,7 +2321,6 @@ Did not match all atoms present 110690-43-2 CCOCN1C=C(C(=O)N(C1=O)C(=O)C2=CC(=CC
Did not match all atoms present 1107-00-2 C1=CC2=C(C=C1C(C3=CC4=C(C=C3)C(=O)OC4=O)(C(F)(F)F)C(F)(F)F)C(=O)OC2=O {16: 6, 28: 4, 4: 3, 14: 6}
Did not match all atoms present 1107-69-3 C/C(=N\NC1=C(C=C(C=C1)[N+](=O)[O-])[N+](=O)[O-])/C=N/NC2=C(C=C(C=C2)[N+](=O)[O-])[N+](=O)[O-] {1: 1, 34: 2, 38: 4, 6: 1, 7: 1, 14: 6, 31: 2}
Did not match all atoms present 110720-66-6 [C@@H]([C@H](C(=O)[O-])O)(C(=O)[O-])O.[Ca+2] {24: 2, 3: 2, 20: 2}
Did not match all atoms present 11073-85-1 [Ge].[Te] {}
Did not match all atoms present 110735-99-4 C(COC(=O)CC(C(=O)OCCC(C(C(C(C(C(F)(F)F)(F)F)(F)F)(F)F)(F)F)(F)F)S(=O)(=O)[O-])C(C(C(C(C(C(F)(F)F)(F)F)(F)F)(F)F)(F)F)(F)F.[Na+] {2: 5, 3: 1, 4: 12, 16: 26, 28: 2, 29: 3}
Did not match all atoms present 110736-41-9 O.O.O.[Fe].[Fe] {}
Did not match all atoms present 11075-28-8 C1=CC=C2C(=C1)C(=O)C3=C(C=CC(=C3C2=O)NCC(CCl)O)NCC(CCl)O {2: 4, 3: 2, 14: 6, 17: 2, 20: 2, 25: 2, 31: 2}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_chemical.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_H_Chemical():
@pytest.mark.meta_Chemical
@pytest.mark.deprecated
def test_all_chemicals():
for i in pubchem_db.CAS_index.values():
for i in pubchem_db:
c = Chemical(i.CASs)
print(i.CASs)

Expand Down
11 changes: 11 additions & 0 deletions tests/test_heat_capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ def test_JANAF_fit_carbon_exists():

@pytest.mark.slow
@pytest.mark.fuzz
@pytest.mark.meta_T_dept
def test_locked_integral():
obj = HeatCapacityGas(load_data=False, CASRN="7732-18-5", similarity_variable=0.16652530518537598, MW=18.01528,
extrapolation="linear", method="POLY_FIT",
Expand All @@ -888,6 +889,7 @@ def test_locked_integral():

@pytest.mark.slow
@pytest.mark.fuzz
@pytest.mark.meta_T_dept
def test_locked_integral_over_T():
obj = HeatCapacityGas(load_data=False, CASRN="7732-18-5", similarity_variable=0.16652530518537598, MW=18.01528, extrapolation="linear", method="POLY_FIT", poly_fit=(50.0, 1000.0, [5.543665000518528e-22, -2.403756749600872e-18, 4.2166477594350336e-15, -3.7965208514613565e-12, 1.823547122838406e-09, -4.3747690853614695e-07, 5.437938301211039e-05, -0.003220061088723078, 33.32731489750759]))

Expand All @@ -899,3 +901,12 @@ def to_int(T):
quad_ans = quad(to_int, T1, T2)[0]
analytical_ans = obj.T_dependent_property_integral_over_T(T1, T2)
assert_close(quad_ans, analytical_ans, rtol=1e-5)

@pytest.mark.meta_T_dept
def test_heat_capacity_interp1d_removed_extrapolation_method_compatibility():
EtOH = HeatCapacityGas(CASRN='64-17-5', similarity_variable=0.1953615, MW=46.06844, extrapolation='interp1d', method='POLING_POLY')
assert_close(EtOH(EtOH.Tmin - 10), 37.421995400002054)
assert_close(EtOH(EtOH.Tmax + 10), 142.81153700770574)
EtOH = HeatCapacityGas(CASRN='64-17-5', similarity_variable=0.1953615, MW=46.06844, extrapolation='interp1d|interp1d', method='POLING_POLY')
assert_close(EtOH(EtOH.Tmin - 10), 37.421995400002054)
assert_close(EtOH(EtOH.Tmax + 10), 142.81153700770574)
4 changes: 1 addition & 3 deletions thermo/electrochem.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,6 @@ def Laliberte_heat_capacity_mix(T, ws, a1s, a2s, a3s, a4s, a5s, a6s):
Temperature of fluid [K]
ws : array
Weight fractions of fluid components other than water
CASRNs : array
CAS numbers of the fluid components other than water
Returns
-------
Expand Down Expand Up @@ -798,7 +796,7 @@ def Laliberte_heat_capacity(T, ws, CASRNs):
Temperature of fluid [K]
ws : array
Weight fractions of fluid components other than water
CASRNs : array
CASRNs : list[str]
CAS numbers of the fluid components other than water
Returns
Expand Down
3 changes: 3 additions & 0 deletions thermo/utils/t_dependent_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -4264,6 +4264,9 @@ def extrapolation(self):

@extrapolation.setter
def extrapolation(self, extrapolation):
# backwards compatibility
if extrapolation is not None:
extrapolation = extrapolation.replace('interp1d', 'linear')
self._extrapolation = extrapolation
if extrapolation is None:
self.extrapolation_split = False
Expand Down

0 comments on commit 7642f4c

Please sign in to comment.