Skip to content

Commit

Permalink
Super obvious bugfixes in a few files.
Browse files Browse the repository at this point in the history
ig.py (and ig2.py)
- line 158 (148) inverse_args to these_args
- line 228 (213) args to kwarg
- line 231 (216) Thigh to Tlim
- line 242 (227) Thigh to Tlim

igmix.py
- lines 309,310,390,394 - .data['Tlim'] to ._Tlim
-line 330 args to kwarg
  • Loading branch information
Joe Ranalli committed Dec 17, 2024
1 parent f1a52fb commit 82a6f31
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/pyromat/registry/ig.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _argparse(self, *varg, **kwarg):
if len(these_args) > 1:
message = 'Properties may not be specified together:'
prefix = ' '
for name in inverse_args:
for name in these_args:
message += prefix + name
prefix = ', '
raise pm.utility.PMParamError(message)
Expand Down Expand Up @@ -225,10 +225,10 @@ def _argparse(self, *varg, **kwarg):
# Entropy requires special iteration
if 's' in kwarg:
# If density is specified
if 'd' in args:
if 'd' in kwarg:
s,d = np.broadcast_arrays(kwarg['s'], kwarg['d'])
Tlow = self.data['Tlim'][0]
Thigh = self.data['Thigh'][-1]
Thigh = self.data['Tlim'][-1]
T = np.full_like(s, 0.5*(Tlow+Thigh))
I = np.ones_like(s,dtype=bool)
self._iter1(self._sditer, 'T', s, T, I, Tlow, Thigh, param={'d':d})
Expand All @@ -239,7 +239,7 @@ def _argparse(self, *varg, **kwarg):
# adjust entropy to the reference pressure
s += pm.units.const_Ru * np.log(p / self._pref_pa)
Tlow = self.data['Tlim'][0]
Thigh = self.data['Thigh'][-1]
Thigh = self.data['Tlim'][-1]
T = np.full_like(s, 0.5*(Tlow+Thigh))
I = np.ones_like(s,dtype=bool)
self._iter1(self._s, 'T', s, T, I, Tlow, Thigh)
Expand Down
8 changes: 4 additions & 4 deletions src/pyromat/registry/ig2.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _argparse(self, *varg, **kwarg):
if len(these_args) > 1:
message = 'Properties may not be specified together:'
prefix = ' '
for name in inverse_args:
for name in these_args:
message += prefix + name
prefix = ', '
raise pm.utility.PMParamError(message)
Expand Down Expand Up @@ -210,10 +210,10 @@ def _argparse(self, *varg, **kwarg):
# Entropy requires special iteration
if 's' in kwarg:
# If density is specified
if 'd' in args:
if 'd' in kwarg:
s,d = np.broadcast_arrays(kwarg['s'], kwarg['d'])
Tlow = self.data['Tlim'][0]
Thigh = self.data['Thigh'][-1]
Thigh = self.data['Tlim'][-1]
T = np.full_like(s, 0.5*(Tlow+Thigh))
I = np.ones_like(s,dtype=bool)
self._iter1(self._sditer, 'T', s, T, I, Tlow, Thigh, param={'d':d})
Expand All @@ -224,7 +224,7 @@ def _argparse(self, *varg, **kwarg):
# adjust entropy to the reference pressure
s += pm.units.const_Ru * np.log(p / self.data['pref'])
Tlow = self.data['Tlim'][0]
Thigh = self.data['Thigh'][-1]
Thigh = self.data['Tlim'][-1]
T = np.full_like(s, 0.5*(Tlow+Thigh))
I = np.ones_like(s,dtype=bool)
self._iter1(self._s, 'T', s, T, I, Tlow, Thigh)
Expand Down
10 changes: 5 additions & 5 deletions src/pyromat/registry/igmix.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ def _argparse(self, *varg, **kwarg):
value = kwarg['e']
value = pm.units.energy(value, to_units='kJ')
value = pm.units.matter(value, self._mw, to_units='kmol', exponent=-1)
Tlow = self.data['Tlim'][0]
Thigh = self.data['Tlim'][-1]
Tlow = self._Tlim[0]
Thigh = self._Tlim[-1]
T = np.full(value.shape, 0.5*(self._Tlim[0] + self._Tlim[-1]))
I = np.ones(value.shape, dtype=bool)
self._iter1(self._e, 'T', value, T, I, self._Tlim[0], self._Tlim[-1])
Expand All @@ -327,7 +327,7 @@ def _argparse(self, *varg, **kwarg):
# Entropy requires special iteration
if 's' in kwarg:
# If density is specified
if 'd' in args:
if 'd' in kwarg:
s,d = np.broadcast_arrays(kwarg['s'], kwarg['d'])
T = np.full_like(s, 0.5*(self._Tlim[0] + self._Tlim[-1]))
I = np.ones_like(s,dtype=bool)
Expand Down Expand Up @@ -387,11 +387,11 @@ def _argparse(self, *varg, **kwarg):
I = np.logical_or(T < self._Tlim[0], T > self._Tlim[-1])
if I.all():
raise pm.utility.PMParamError('All of the specified states were out-of-bounds. '
'Legal temperatures for {} are between {} and {} Kelvin.'.format(self.data['id'], self.data['Tlim'][0], self.data['Tlim'][-1]))
'Legal temperatures for {} are between {} and {} Kelvin.'.format(self.data['id'], self._Tlim[0], self._Tlim[-1]))
elif I.any():
T[I] = pm.config['def_oob']
pm.utility.print_warning('Some of the states were out of bounds - setting to config[\'def_oob\']. '
'Legal temperatures for {} are between {} and {} Kelvin.'.format(self.data['id'], self.data['Tlim'][0], self.data['Tlim'][-1]))
'Legal temperatures for {} are between {} and {} Kelvin.'.format(self.data['id'], self._Tlim[0], self._Tlim[-1]))
return T,p,d


Expand Down

0 comments on commit 82a6f31

Please sign in to comment.