mirror of
https://github.com/vale981/hopsflow
synced 2025-03-04 16:31:38 -05:00
do not allow adding values with different bath numbers
This commit is contained in:
parent
e2f1c76090
commit
f8b554fcfe
1 changed files with 6 additions and 1 deletions
|
@ -189,10 +189,15 @@ class EnsembleValue:
|
|||
def __add__(
|
||||
self, other: Union["EnsembleValue", float, int, np.ndarray]
|
||||
) -> EnsembleValue:
|
||||
if type(self) == type(other):
|
||||
if isinstance(other, EnsembleValue):
|
||||
if len(self) != len(other):
|
||||
raise RuntimeError("Can only add values of equal length.")
|
||||
|
||||
if self.num_baths != other.num_baths:
|
||||
raise RuntimeError(
|
||||
"Can only add values pertaining to an equal number of baths."
|
||||
)
|
||||
|
||||
left = self._value
|
||||
right = other._value
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue