# then compile everything and link to denest with f2py #Make pyf file as usual, then compile shared object #f2py denest.f -m denest2 -h denest.pyf #edit pyf #-c flag makes it available to other programs, fPIC builds a shared library #/usr/bin/gfortran -Wall -c -fPIC fft.f #f2py -c denest.pyf ./fft.o denest.f try: from denest2 import denest # @UnresolvedImport a = -3.4884382032045504 b = 4.3671504686785605 RANGE = b - a bw = bandwidths.bw_silverman(xi) ft,smooth,ifault,weights,smooth1 = denest(xi,a,b,bw,np.zeros(512),np.zeros(512),0, np.zeros(512), np.zeros(512)) # We use a different binning algo, so only accurate up to 3 decimal places np.testing.assert_almost_equal(f2, smooth, 3) #NOTE: for debugging # y2 = forrt(weights) # RJ = np.arange(512/2+1) # FAC1 = 2*(np.pi*bw/RANGE)**2 # RJFAC = RJ**2*FAC1 # BC = 1 - RJFAC/(6*(bw/((b-a)/M))**2) # FAC = np.exp(-RJFAC)/BC # SMOOTH = np.r_[FAC,FAC[1:-1]] * y2 # dens = revrt(SMOOTH) except: # ft = np.loadtxt('./ft_silver.csv')
#f2py denest.f -m denest2 -h denest.pyf #edit pyf #-c flag makes it available to other programs, fPIC builds a shared library #/usr/bin/gfortran -Wall -c -fPIC fft.f #f2py -c denest.pyf ./fft.o denest.f try: from denest2 import denest # @UnresolvedImport a = -3.4884382032045504 b = 4.3671504686785605 RANGE = b - a bw = bandwidths.bw_silverman(xi) ft, smooth, ifault, weights, smooth1 = denest(xi, a, b, bw, np.zeros(512), np.zeros(512), 0, np.zeros(512), np.zeros(512)) # We use a different binning algo, so only accurate up to 3 decimal places np.testing.assert_almost_equal(f2, smooth, 3) #NOTE: for debugging # y2 = forrt(weights) # RJ = np.arange(512/2+1) # FAC1 = 2*(np.pi*bw/RANGE)**2 # RJFAC = RJ**2*FAC1 # BC = 1 - RJFAC/(6*(bw/((b-a)/M))**2) # FAC = np.exp(-RJFAC)/BC # SMOOTH = np.r_[FAC,FAC[1:-1]] * y2 # dens = revrt(SMOOTH)