# Crop image to input size
        xi = x_gpu.get()[sf2[0]:-sf2[0], sf2[1]:-sf2[1]] / x_max
        imagetools.imwrite(xi, xname(i))

        # Concatenate PSF kernels for ease of visualisation
        f = imagetools.gridF(fs, csf)
        imagetools.imwrite(f / f.max(), fname(i))

    # ------------------------------------------------------------------------
    # For displaying intermediate results
    # ------------------------------------------------------------------------
    if np.mod(i, 1) == 0 and doshow:
        pl.figure(1)
        pl.subplot(121)
        pl.imshow(imagetools.crop(x_gpu.get(), sy, np.ceil(sf / 2)), 'gray')
        pl.title('x after %d observations' % i)
        pl.subplot(122)
        pl.imshow(y_gpu.get(), 'gray')
        pl.title('y(%d)' % i)
        pl.draw()
        pl.figure(2)
        pl.title('PSF(%d)' % i)
        imagetools.cellplot(fs, winaux.csf)
        tf = t.clock()
        print('Time elapsed after %d frames %.3f' % (i, (tf - ti)))

tf = t.clock()
print('Time elapsed for total image sequence %.3f' % (tf - ti))
# ----------------------------------------------------------------------------
Example #2
0
        pl.title("Result of direct deconvolution")
        pl.show()

    gdirect = 1
    if gdirect:
        print "-------------------"
        print "Gdirect deconvolution"
        start = time.clock()
        fhat_gpu = X.deconv(yX_gpu, mode = 'gdirect', alpha = 0.01,beta = 0.01)
        print "Time elapsed: %.4f" % (time.clock()-start)
        print "-------------------"
        print ""
     
        fhat = fhat_gpu.get()
        pl.figure(3)
        imagetools.cellplot(fhat, csf);
        pl.title("Result of gdirect deconvolution")
        pl.show()

    sparse = 1
    if sparse:
        print "-------------------"
        print "Sparse deconvolution"
        start = time.clock()
        xhat_gpu = F.deconv(yF_gpu, mode = 'sparse', alpha = 0.0001)
        print "Time elapsed: %.4f" % (time.clock()-start)
        print "-------------------"
        print ""
     
        xhat = xhat_gpu.get()
        pl.figure(4)
         # Concatenate PSF kernels for ease of visualisation
         f = imagetools.gridF(fs,csf)
         imagetools.imwrite(f/f.max(), fname(i))


    # ------------------------------------------------------------------------
    # For displaying intermediate results
    # ------------------------------------------------------------------------
    if np.mod(i,1) == 0 and doshow:
        pl.figure(1)
        pl.subplot(121)
        pl.imshow(imagetools.crop(x_gpu.get(),sy,np.ceil(sf/2)),'gray')
        pl.title('x after %d observations' % i)
        pl.subplot(122)
        pl.imshow(y_gpu.get(),'gray')
        pl.title('y(%d)' % i)
        pl.draw()
        pl.figure(2)
        pl.title('PSF(%d)' % i)
        imagetools.cellplot(fs, winaux.csf)
        tf = t.clock()
        print('Time elapsed after %d frames %.3f' % (i,(tf-ti)))

tf = t.clock()
print('Time elapsed for total image sequence %.3f' % (tf-ti))
# ----------------------------------------------------------------------------
   
    
    
Example #4
0
        pl.title("Result of direct deconvolution")
        pl.show()

    gdirect = 1
    if gdirect:
        print "-------------------"
        print "Gdirect deconvolution"
        start = time.clock()
        fhat_gpu = X.deconv(yX_gpu, mode='gdirect', alpha=0.01, beta=0.01)
        print "Time elapsed: %.4f" % (time.clock() - start)
        print "-------------------"
        print ""

        fhat = fhat_gpu.get()
        pl.figure(3)
        imagetools.cellplot(fhat, csf)
        pl.title("Result of gdirect deconvolution")
        pl.show()

    sparse = 1
    if sparse:
        print "-------------------"
        print "Sparse deconvolution"
        start = time.clock()
        xhat_gpu = F.deconv(yF_gpu, mode='sparse', alpha=0.0001)
        print "Time elapsed: %.4f" % (time.clock() - start)
        print "-------------------"
        print ""

        xhat = xhat_gpu.get()
        pl.figure(4)