Skip to content

Commit

Permalink
prevent div 0
Browse files Browse the repository at this point in the history
  • Loading branch information
yoelcortes committed Jun 27, 2024
1 parent b6e4e29 commit f80cec3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion thermosteam/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,10 @@ def _info_df(self, units, notation, composition, N_max, all_IDs, indexer, factor
total_flow = flow_array.sum()
index.append((f"{phase} [{flow_units}]", ''))
data.append(f"{total_flow:{flow_notation}}")
comp_array = 100 * flow_array / total_flow
if total_flow == 0:
comp_array = flow_array
else:
comp_array = 100 * flow_array / total_flow
for i, (ID, comp) in enumerate(zip(all_IDs, comp_array)):
if not comp: continue
if i >= N_max:
Expand Down

0 comments on commit f80cec3

Please sign in to comment.