Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- z = numpy.concatenate((numpy.flip(x[:l]),x))
- z = numpy.concatenate((z,numpy.flip(x[-l:])))
- fr = planfftw.fft(z)
- ff = fr(z)
- # obtain the boundaries in the extend f
- bound2 = numpy.ceil(bounds*round(len(ff)/2)/numpy.pi).astype(dtype=int)
- #bound2 = numpy.concatenate((bound2,[8000]))
- efd = numpy.zeros(((len(bound2)-1,len(x))),dtype=numpy.float64)
- ft = numpy.zeros((efd.shape[0],len(ff)),dtype=numpy.cdouble)
- fz = planfftw.ifft(ft[0,:])
- # define an ideal functions and extract components
- for k in range(efd.shape[0]):
- if bound2[k] == 0:
- ft[k,0:bound2[k+1]] = ff[0:bound2[k+1]]
- ft[k,len(ff)+2-bound2[k+1]:len(ff)] = ff[len(ff)+2-bound2[k+1]:len(ff)]
- else:
- ft[k,bound2[k]:bound2[k+1]] = ff[bound2[k]:bound2[k+1]]
- ft[k,len(ff)+2-bound2[k+1]:len(ff)+2-bound2[k]] = ff[len(ff)+2-bound2[k+1]:len(ff)+2-bound2[k]]
- rx = numpy.real(fz(ft[k,:]))
- efd[k,:] = rx[l:-l]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement