Use numpy functions for equality check
This commit is contained in:
parent
9367c93743
commit
9376055240
@ -6,6 +6,7 @@ import math
|
||||
from typing import Union, Callable
|
||||
import os
|
||||
from scipy.integrate import trapz
|
||||
import numpy as np
|
||||
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
@ -118,8 +119,8 @@ class SpectralQty:
|
||||
"""
|
||||
return self.wl.unit.is_equivalent(other.wl.unit) and self.qty.unit.is_equivalent(other.qty.unit) and \
|
||||
len(self.wl) == len(other.wl) and len(self.qty) == len(other.qty) and \
|
||||
all([math.isclose(x, y, rel_tol=1e-5) for x, y in zip(self.wl.value, other.wl.to(self.wl.unit).value)]) and\
|
||||
all([math.isclose(x, y, rel_tol=1e-5) for x, y in zip(self.qty.value, other.qty.to(self.qty.unit).value)])
|
||||
np.allclose(self.wl.value, other.wl.to(self.wl.unit).value) and \
|
||||
np.allclose(self.qty.value, other.qty.to(self.qty.unit).value)
|
||||
|
||||
def __add__(self, other: Union[int, float, u.Quantity, "SpectralQty", Callable[[u.Quantity], u.Quantity]]) ->\
|
||||
"SpectralQty":
|
||||
|
Loading…
Reference in New Issue
Block a user