Skip to content

Commit

Permalink
Merge pull request #10 from rlwastro/master
Browse files Browse the repository at this point in the history
Fix Python 3 bug with integer division
  • Loading branch information
taobrienlbl authored Jul 28, 2022
2 parents 42e4384 + ceeb16f commit 030bf72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fastkde/fastKDE.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def applyBernacchiaFilter(self,doFlushArrays=True):
if(self.doSaveTransformedKernel):
self.kappaSC = kappaSC

midPointAccessor = tuple([(tp-1)/2 for tp in self.numTPoints])
midPointAccessor = tuple([(tp-1)//2 for tp in self.numTPoints])
#Calculate the transform of the self-consistent density estimate
self.phiSC[iCalcPhi] = self.ECF[iCalcPhi]*kappaSC[iCalcPhi]

Expand Down Expand Up @@ -549,7 +549,7 @@ def normFunc(delta):

if(self.beVerbose):
normConst = sum(pdf*prod(self.deltaX))
midPointAccessor = tuple([(tp-1)/2 for tp in self.numTPoints])
midPointAccessor = tuple([(tp-1)//2 for tp in self.numTPoints])
print("Normalization of pdf = {}. phiSC[0] = {}".format(normConst,self.phiSC[midPointAccessor]))


Expand Down Expand Up @@ -839,7 +839,7 @@ def reApplyFilter(self,pdf):
#Transform the PDF to fourier space
phiTilde_tmp = fft.fftshift(fft.ifftn(fft.ifftshift(ma.filled(pdf,0.0))))
#Normalize the transform
midPointAccessor = tuple([(tp-1)/2 for tp in self.numTPoints])
midPointAccessor = tuple([(tp-1)//2 for tp in self.numTPoints])
phiTilde_tmp /= phiTilde_tmp[midPointAccessor]

#Reapply the filter
Expand Down

0 comments on commit 030bf72

Please sign in to comment.