Skip to content

Commit

Permalink
Numpy 2.2.1 (#1679)
Browse files Browse the repository at this point in the history
* support latest numpy

* numpy 2.2.1
  • Loading branch information
hainm authored Jan 17, 2025
1 parent d38bafa commit 890b5a1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
name: pytraj-gha
dependencies:
- pyflakes
- numpy=2.0.0
- numpy=2.2.1
- cython=0.29 # 3.0.11 (segmentation fault)
- parmed
- pytest
Expand Down
8 changes: 4 additions & 4 deletions pytraj/datasets/c_datasets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ cdef class Dataset:
def __setitem__(self, idx, value):
raise NotImplementedError("Must over-write Dataset data attr")

def __array__(self):
def __array__(self, *args, **kwargs):
"""
Aim: directly use numpy to perform analysis without casting to ndararay again
Expand Down Expand Up @@ -702,7 +702,7 @@ cdef class DatasetMatrixDouble (Dataset2D):

@data.setter
def data(self, double[:, :] data):
cdef size_t i,j
cdef size_t i,j
cdef int n_rows
cdef int n_cols

Expand Down Expand Up @@ -1039,8 +1039,8 @@ cdef class DatasetModes(Dataset):
self.thisptr.AllocateAvgCoords(n)

def _set_avg_frame(self, double[:] arr):
cdef unsigned int i
cdef double* ptr = self.thisptr.AvgFramePtr()
cdef unsigned int i
cdef double* ptr = self.thisptr.AvgFramePtr()

for i in range(arr.shape[0]):
ptr[i] = arr[i]
Expand Down
2 changes: 1 addition & 1 deletion pytraj/math/cpp_math.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ cdef class Matrix_3x3:
cdef double[:] arr0 = <double[:9]> self.thisptr.Dptr()
return arr0

def __array__(self):
def __array__(self, *args, **kwargs):
return np.asarray(self.buffer2d)

cdef class Vec3:
Expand Down
2 changes: 1 addition & 1 deletion pytraj/trajectory/frame.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ cdef class Frame (object):
for i in range(self.n_atoms):
yield np.asarray(self._buffer2d[i])

def __array__(self):
def __array__(self, *args, **kwargs):
"""
arr0 = np.asarray(frame)
Expand Down

0 comments on commit 890b5a1

Please sign in to comment.