Skip to content

Commit

Permalink
Merge pull request #3468 from tylerjereddy/treddy_issue_3455
Browse files Browse the repository at this point in the history
MAINT: update Cython imports
  • Loading branch information
richardjgowers authored Nov 30, 2021
2 parents 46c8bad + 9490241 commit 5bf6359
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import numpy
cimport numpy
cimport cython

numpy.import_array()

cdef extern from "ap.h":
int CAffinityPropagation(float*, int, float, int, int, bint, long*)

Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/analysis/encore/cutils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ cimport numpy as np
import cython
from libc.math cimport sqrt

np.import_array()

@cython.boundscheck(False)
@cython.wraparound(False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import logging
import numpy
cimport numpy

numpy.import_array()
cimport cython

cdef extern from "spe.h":
Expand Down
2 changes: 2 additions & 0 deletions package/MDAnalysis/lib/_augment.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ from MDAnalysis.lib._cutil cimport _dot ,_norm, _cross

from libcpp.vector cimport vector

np.import_array()


__all__ = ['augment_coordinates', 'undo_augment']

Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/lib/_cutil.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ from libcpp.vector cimport vector
from libcpp.utility cimport pair
from cython.operator cimport dereference as deref

np.import_array()

__all__ = ['unique_int_1d', 'make_whole', 'find_fragments',
'_sarrus_det_single', '_sarrus_det_multiple']
Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/lib/c_distances.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Serial versions of all distance calculations
cimport cython
import numpy
cimport numpy
numpy.import_array()

cdef extern from "string.h":
void* memcpy(void* dst, void* src, int len)
Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/lib/c_distances_openmp.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Contains OpenMP versions of the contents of "calc_distances.h"

import numpy
cimport numpy
numpy.import_array()

cdef extern from "string.h":
void* memcpy(void* dst, void* src, int len)
Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/lib/formats/cython_util.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
cimport numpy as np
np.import_array()
cdef np.ndarray ptr_to_ndarray(void* data_ptr, np.int64_t[:] dim, int data_type)
2 changes: 2 additions & 0 deletions package/MDAnalysis/lib/formats/libdcd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ from libc.stdio cimport SEEK_SET, SEEK_CUR, SEEK_END
from libc.stdint cimport uintptr_t
from libc.stdlib cimport free

np.import_array()

_whence_vals = {"FIO_SEEK_SET": SEEK_SET,
"FIO_SEEK_CUR": SEEK_CUR,
"FIO_SEEK_END": SEEK_END}
Expand Down
1 change: 1 addition & 0 deletions package/MDAnalysis/lib/qcprot.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Users will typically use the :func:`CalcRMSDRotationalMatrix` function.

import numpy as np
cimport numpy as np
np.import_array()

from ..due import due, BibTeX, Doi

Expand Down

0 comments on commit 5bf6359

Please sign in to comment.