Skip to content

Commit

Permalink
update np.float and np.int
Browse files Browse the repository at this point in the history
  • Loading branch information
al-jshen committed Dec 16, 2022
1 parent 030bf72 commit 8110300
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions fastkde/fastKDE.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ def vprint(msg):
dataRank = len(shape(data))
#If the data are a vector, promote the data to a rank-1 array with only 1 column
if(dataRank == 1):
data = array(originalData[newaxis,:],dtype=npy.float)
data = array(originalData[newaxis,:],dtype=npy.float_)
else:
data = array(originalData,dtype=npy.float)
data = array(originalData,dtype=npy.float_)
if(dataRank > 2):
raise ValueError("data must be a rank-2 array of shape [numVariables,numDataPoints]")

Expand Down
22 changes: 11 additions & 11 deletions fastkde/nufft.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ cpdef np.ndarray[double complex] nuifft( \
#********************************************
vprint("Getting the size of the frequency spaces",beVerbose)
cdef int n,t,iNotMissing
cdef np.int_t [:] frequencySizes = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] frequencySizes = np.zeros([numDimensions],dtype=np.int_)

for n in range(numDimensions):
iNotMissing = 0
Expand Down Expand Up @@ -163,8 +163,8 @@ cpdef np.ndarray[double complex] nuifft( \
hyperSlabSize = nspread**numDimensions

#get the shape of a hyperslab
#cdef np.ndarray[np.int_t,ndim=1] hyperSlabShape = nspread*np.ones([numDimensions],dtype=np.int)
cdef np.int_t [:] hyperSlabShape = nspread*np.ones([numDimensions],dtype=np.int)
#cdef np.ndarray[np.int_t,ndim=1] hyperSlabShape = nspread*np.ones([numDimensions],dtype=np.int_)
cdef np.int_t [:] hyperSlabShape = nspread*np.ones([numDimensions],dtype=np.int_)
vprint("\tconvolution hyperslab shape: {}".format(hyperSlabShape),beVerbose)

#Calculate the quantities necessary for estimating x-indices
Expand All @@ -174,9 +174,9 @@ cpdef np.ndarray[double complex] nuifft( \
deltaxs = np.array([ abscissaGrids[n,1] - abscissaGrids[n,0] for n in range(numDimensions) ])

#Inialize worker terms for the convolution
#cdef np.ndarray[long,ndim=1] mvec = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] mvec = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] m0vec = np.zeros([numDimensions],dtype=np.int)
#cdef np.ndarray[long,ndim=1] mvec = np.zeros([numDimensions],dtype=np.int_)
cdef np.int_t [:] mvec = np.zeros([numDimensions],dtype=np.int_)
cdef np.int_t [:] m0vec = np.zeros([numDimensions],dtype=np.int_)
cdef np.float_t [:] mprimevec = np.zeros([numDimensions])
cdef np.float_t mprime = 0.0
cdef double complex gaussTerm = 0.0
Expand Down Expand Up @@ -247,7 +247,7 @@ cpdef np.ndarray[double complex] nuifft( \
#Pre-declare and allocate a raveled form of the DFT
cdef double complex [:] DFT = np.zeros([freqSpaceSize],dtype=np.complex128)
#Pre declare a dimension index vector
cdef np.int_t [:] dimInds = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] dimInds = np.zeros([numDimensions],dtype=np.int_)

#Deconvolve the FFT (divide by the FFT of the gaussian) to obtain the DFT estimate
vprint("Deconvolving the Fourier transformed data",beVerbose)
Expand Down Expand Up @@ -354,7 +354,7 @@ cpdef np.ndarray[double complex] idft( \
#********************************************
vprint("Getting the size of the frequency spaces",beVerbose)
cdef int n,t,iNotMissing
cdef np.int_t [:] frequencySizes = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] frequencySizes = np.zeros([numDimensions],dtype=np.int_)

for n in range(numDimensions):
iNotMissing = 0
Expand All @@ -375,7 +375,7 @@ cpdef np.ndarray[double complex] idft( \
cdef int i,k

#Pre declare a dimension index vector
cdef np.int_t [:] dimInds = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] dimInds = np.zeros([numDimensions],dtype=np.int_)

cdef double complex myDFT
cdef double expArg
Expand Down Expand Up @@ -577,7 +577,7 @@ cpdef np.ndarray[double complex] dft_points( \
#********************************************
vprint("Getting the size of the frequency spaces",beVerbose)
cdef int t,iNotMissing
cdef np.int_t [:] frequencySizes = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] frequencySizes = np.zeros([numDimensions],dtype=np.int_)

for n in range(numDimensions):
iNotMissing = 0
Expand All @@ -596,7 +596,7 @@ cpdef np.ndarray[double complex] dft_points( \
cdef double complex [:] DFT = np.zeros([freqSpaceSize],dtype=np.complex128)

#Pre declare a dimension index vector
cdef np.int_t [:] dimInds = np.zeros([numDimensions],dtype=np.int)
cdef np.int_t [:] dimInds = np.zeros([numDimensions],dtype=np.int_)

vprint("Calculating the DFT",beVerbose)
with nogil:
Expand Down

0 comments on commit 8110300

Please sign in to comment.