Beispiel #1
0
 def compare(x, y):
     try:
         if any(gisinf(x)) or any( gisinf(y)):
             xinfid = gisinf(x)
             yinfid = gisinf(y)
             if not xinfid == yinfid:
                 return False
             # if one item, x and y is +- inf
             if x.size == y.size == 1:
                 return x == y
             x = x[~xinfid]
             y = y[~yinfid]
     except TypeError:
         pass
     z = abs(x-y)
     if not issubdtype(z.dtype, number):
         z = z.astype(float_) # handle object arrays
     return around(z, decimal) <= 10.0**(-decimal)
Beispiel #2
0
 def compare(x, y):
     try:
         if any(gisinf(x)) or any(gisinf(y)):
             xinfid = gisinf(x)
             yinfid = gisinf(y)
             if not xinfid == yinfid:
                 return False
             # if one item, x and y is +- inf
             if x.size == y.size == 1:
                 return x == y
             x = x[~xinfid]
             y = y[~yinfid]
     except TypeError:
         pass
     z = abs(x - y)
     if not issubdtype(z.dtype, number):
         z = z.astype(float_)  # handle object arrays
     return around(z, decimal) <= 10.0**(-decimal)
Beispiel #3
0
 def compare(x, y):
     z = abs(x - y)
     if not issubdtype(z.dtype, number):
         z = z.astype(float_)  # handle object arrays
     return around(z, decimal) <= 10.0**(-decimal)
Beispiel #4
0
 def compare(x, y):
     z = abs(x-y)
     if not issubdtype(z.dtype, number):
         z = z.astype(float_) # handle object arrays
     return around(z, decimal) <= 10.0**(-decimal)