Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cortespea committed Dec 17, 2023
1 parent 1d6797d commit 41c2c9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions thermosteam/_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ def from_data(cls, data, ID=None, price=0., characterization_factors=None, therm
self.set_data(data)
return self

def __getitem__(self, key):
phase = self.phase
if key.lower() == phase.lower(): return self
raise tmo.UndefinedPhase(phase)

def __reduce__(self):
return self.from_data, (self.get_data(), self._ID, self._price, self.characterization_factors, self._thermo)

Expand Down
3 changes: 2 additions & 1 deletion thermosteam/base/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,8 @@ def _truediv_sparse(self, other):
other_size = other.size
other_dct = other.dct
if size == other_size:
if len(dct) > len(other_dct): raise ZeroDivisionError('division by zero')
if len(dct) > len(other_dct):
raise ZeroDivisionError('division by zero')
new = {i: dct[i] / other_dct[i] for i in dct if i in other_dct}
elif size == 1 and other_size:
if 0 in dct:
Expand Down

0 comments on commit 41c2c9a

Please sign in to comment.