Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
yoelcortes committed Apr 20, 2024
1 parent 33f25d5 commit 216f081
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build
dist
thermosteam.egg-info
thermosteam/preferences.yaml
Ethanol-Water Property Package
**/__pycache__
*.pyc
Expand Down
4 changes: 3 additions & 1 deletion thermosteam/equilibrium/dew_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def x_iter(x, x_gamma, T, P, f_gamma, gamma_args):
except: return x
if (x < 0).any(): return x
mask = x > 1e3
if mask.any(): x[mask] = 1e3 + np.log(x[mask] / 1e3) # Avoid crazy numbers
if mask.any(): x[mask] = 1e3 + np.log(x[mask] - 1e3) # Avoid crazy numbers
mask = x > 1e5
if mask.any(): x[mask] = 1e5
return x

# @njit(cache=True)
Expand Down
16 changes: 8 additions & 8 deletions thermosteam/preferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ N: 7
P: Pa:.6g
T: K:.5g
autodisplay: true
background_color: transparent
background_color: '#ffffffff'
composition: false
depth_colors:
- '#5172512f'
- '#1111112f'
- '#d5edf02f'
- '#ffffffdf'
fill_cluster: true
flow: kmol/hr:.3g
graphviz_format: svg
Expand All @@ -20,17 +20,17 @@ graphviz_html_height:
unit: !!python/tuple
- 225px
- 400px
label_color: '#e5e5e5'
label_color: '#4e4e4e'
label_streams: true
minimal_nodes: false
number_path: false
profile: false
raise_exception: false
show_all_streams: true
sort: false
stream_color: '#98a2ad'
stream_color: '#4e4e4e'
stream_width: F_mass
tooltips_full_results: false
unit_color: '#555f69'
unit_label_color: white
unit_periphery_color: none
unit_color: white:#CDCDCD
unit_label_color: black
unit_periphery_color: '#4e4e4e'
6 changes: 6 additions & 0 deletions thermosteam/reaction/_reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,9 @@ def __init__(self, reactions):
X_index = [i._X_index for i in reactions]
self._X_index = tuple(X_index) if self._phases else np.array(X_index)

def __iter__(self):
for i in range(self._X.size): yield ReactionItem(self, i)

def __getitem__(self, index):
stoichiometry = self._stoichiometry[index]
if stoichiometry.__class__ is list:
Expand Down Expand Up @@ -1397,6 +1400,9 @@ class ParallelReaction(ReactionSet):
"""
__slots__ = ()

def __add__(self, other):
return self.__class__([i + j for i, j in zip(self, other)])

def _reaction(self, material_array):
reacted = self._X * np.array([material_array[i] for i in self._X_index], float)
for X, stoichiometry in zip(reacted, self._stoichiometry):
Expand Down

0 comments on commit 216f081

Please sign in to comment.