Advertisement
olivercromwell

Untitled

May 13th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. z = numpy.concatenate((numpy.flip(x[:l]),x))
  2. z = numpy.concatenate((z,numpy.flip(x[-l:])))
  3.  
  4. fr = planfftw.fft(z)
  5. ff = fr(z)
  6.  
  7. # obtain the boundaries in the extend f
  8. bound2 = numpy.ceil(bounds*round(len(ff)/2)/numpy.pi).astype(dtype=int)
  9. #bound2 = numpy.concatenate((bound2,[8000]))
  10. efd = numpy.zeros(((len(bound2)-1,len(x))),dtype=numpy.float64)
  11. ft = numpy.zeros((efd.shape[0],len(ff)),dtype=numpy.cdouble)
  12. fz = planfftw.ifft(ft[0,:])
  13. # define an ideal functions and extract components
  14. for k in range(efd.shape[0]):
  15. if bound2[k] == 0:
  16. ft[k,0:bound2[k+1]] = ff[0:bound2[k+1]]
  17. ft[k,len(ff)+2-bound2[k+1]:len(ff)] = ff[len(ff)+2-bound2[k+1]:len(ff)]
  18. else:
  19. ft[k,bound2[k]:bound2[k+1]] = ff[bound2[k]:bound2[k+1]]
  20. 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]]
  21. rx = numpy.real(fz(ft[k,:]))
  22. efd[k,:] = rx[l:-l]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement