def _deconv_rl_gpu_fft(data_g, h_g, Niter=10):
    """
    using fft_convolve

    """

    if data_g.shape!=h_g.shape:
        raise ValueError("data and h have to be same shape")

    # set up some gpu buffers
    u_g = OCLArray.empty(data_g.shape, np.complex64)

    u_g.copy_buffer(data_g)

    tmp_g = OCLArray.empty(data_g.shape, np.complex64)

    # fix this
    hflip_g = OCLArray.from_array((h_g.get()[::-1, ::-1]).copy())

    plan = fft_plan(data_g.shape)

    # transform psf
    fft(h_g, inplace=True)
    fft(hflip_g, inplace=True)

    for i in range(Niter):
        logger.info("Iteration: {}".format(i))
        fft_convolve(u_g, h_g,
                     res_g=tmp_g,
                     kernel_is_fft=True)

        _complex_divide_inplace(data_g, tmp_g)

        fft_convolve(tmp_g, hflip_g,
                     inplace=True,
                     kernel_is_fft=True)

        _complex_multiply_inplace(u_g, tmp_g)

    return u_g
def _deconv_rl_gpu_fft ( data_g , h_g , Niter = 10 ) : if data_g . shape != h_g . shape : raise ValueError ( "data and h have to be same shape" ) u_g = OCLArray . empty ( data_g . shape , np . complex64 ) u_g . copy_buffer ( data_g ) tmp_g = OCLArray . empty ( data_g . shape , np . complex64 ) hflip_g = OCLArray . from_array ( ( h_g . get ( ) [ : : - 1 , : : - 1 ] ) . copy ( ) ) plan = fft_plan ( data_g . shape ) fft ( h_g , inplace = True ) fft ( hflip_g , inplace = True ) for i in range ( Niter ) : logger . info ( "Iteration: {}" . format ( i ) ) fft_convolve ( u_g , h_g , res_g = tmp_g , kernel_is_fft = True ) _complex_divide_inplace ( data_g , tmp_g ) fft_convolve ( tmp_g , hflip_g , inplace = True , kernel_is_fft = True ) _complex_multiply_inplace ( u_g , tmp_g ) return u_g
using fft_convolve