Skip to content

Commit

Permalink
Solve numpy depreciation of float
Browse files Browse the repository at this point in the history
Numpy is depreciating the Float type in their package, and was acting as
a passthough for python's builtin float type. However, we want to stick
exclusively to Numpy types so the solution is to simply change all
references to numpy.float to numpy.float64
  • Loading branch information
markjonestx committed Jun 11, 2021
1 parent 713ddfe commit 39274be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PyPWA/libs/vectors/_base_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def sanitize_vector_input(a, b=None, c=None, d=None, has_e=False):
if isinstance(a, int) and isinstance(b, type(None)):
if a == 0:
if has_e:
return np.float(0), np.float(0), np.float(0), np.float(0)
return np.float(0), np.float(0), np.float(0)
return np.float64(0), np.float64(0), np.float64(0), np.float64(0)
return np.float64(0), np.float64(0), np.float64(0)

d = [np.zeros(a), np.zeros(a), np.zeros(a)]
if has_e:
Expand All @@ -61,12 +61,12 @@ def sanitize_vector_input(a, b=None, c=None, d=None, has_e=False):

# Pass through single values
elif all([isinstance(var, (int, float)) for var in [a, b, c]]):
returns = [np.float(a), np.float(b), np.float(c)]
returns = [np.float64(a), np.float64(b), np.float64(c)]
if has_e:
if not isinstance(d, (int, float)):
raise ValueError("No Z value provided!")
else:
returns.append(np.float(d))
returns.append(np.float64(d))
return returns

# Convert Structured Arrays to Contiguous Arrays
Expand Down

0 comments on commit 39274be

Please sign in to comment.