Skip to content

Commit

Permalink
Merge pull request #44 from AdamOrmondroyd/numpy2
Browse files Browse the repository at this point in the history
numpy 2 compatibility
  • Loading branch information
taobrienlbl authored Sep 10, 2024
2 parents d8b77eb + b7667f2 commit 4b213c0
Show file tree
Hide file tree
Showing 5 changed files with 5,415 additions and 3,999 deletions.
8 changes: 4 additions & 4 deletions src/fastkde/fastKDE.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ def vprint(msg):
data_rank = len(npy.shape(data))
# If the data are a vector, promote the data to a rank-1 array with only 1 column
if data_rank == 1:
data = npy.array(original_data[npy.newaxis, :], dtype=npy.float_)
data = npy.array(original_data[npy.newaxis, :], dtype=npy.float64)
else:
data = npy.array(original_data, dtype=npy.float_)
data = npy.array(original_data, dtype=npy.float64)
if data_rank > 2:
raise ValueError(
"data must be a rank-2 array of shape [num_variables,num_data_points]"
Expand Down Expand Up @@ -1642,7 +1642,7 @@ def pdf_at_points(*args, **kwargs):
# make sure list_of_points is in the expected format
if list_of_points_provided_in_kwargs:
try:
list_of_points = npy.array(list_of_points, copy=True, dtype=npy.float_).T
list_of_points = npy.array(list_of_points, copy=True, dtype=npy.float64).T
except ValueError:
raise RuntimeError("Could not convert list_of_points to a numpy array.")

Expand All @@ -1652,7 +1652,7 @@ def pdf_at_points(*args, **kwargs):
# If the data are a vector, promote the data to a rank-1 array with only
# 1 column
if data_rank == 1:
list_of_points = npy.array(list_of_points[npy.newaxis, :], dtype=npy.float_)
list_of_points = npy.array(list_of_points[npy.newaxis, :], dtype=npy.float64)

if data_rank > 2:
# raise an error indicating the proper shape for list_of_points
Expand Down
Loading

0 comments on commit 4b213c0

Please sign in to comment.