예제 #1
0
def compare1d_psd_acovf():
    """Compare 1d ACovF in physical coordinates to 1d PSD in physical coordinates, for two similar but different images."""
    im = TestImage(shift=True, nx=1000, ny=1000)
    scale = 100
    im.addSin(scale=scale)
    im.hanningFilter()
    im.zeroPad()
    im.calcAll(min_npix=1, min_dr=1)
    im.showImage()
    pylab.grid()
    pylab.savefig('compare1d_image1.%s' %(figformat), format='%s' %(figformat))
    im.showPsd2d()
    pylab.savefig('compare1d_psd2d1.%s' %(figformat), format='%s' %(figformat))
    im.showPsd1d()
    pylab.savefig('compare1d_psd1.%s' %(figformat), format='%s' %(figformat))
    im.showAcovf1d()
    pylab.savefig('compare1d_acovf1.%s' %(figformat), format='%s' %(figformat))
    im = TestImage(shift=True, nx=1000, ny=1000)
    im.addSin(scale=scale*2)
    im.hanningFilter()
    im.zeroPad()
    im.calcAll(min_npix=1, min_dr=1)
    im.showImage()
    pylab.grid()
    pylab.savefig('compare1d_image2.%s' %(figformat), format='%s' %(figformat))
    im.showPsd2d()
    pylab.savefig('compare1d_psd2d2.%s' %(figformat), format='%s' %(figformat))
    im.showPsd1d()
    pylab.savefig('compare1d_psd2.%s' %(figformat), format='%s' %(figformat))
    im.showAcovf1d()
    pylab.savefig('compare1d_acovf2.%s' %(figformat), format='%s' %(figformat))
    pylab.close()
    return
예제 #2
0
# Start here to invert from FFT (useI = False, and will get perfect reconstruction). 
im.invertFft(useI=True)

# Use im2 to recalculate 1d PSD/ACovF starting from the reconstructed image, without altering the original. 
im2 = PImagePlots()
im2.setImage(im.imageI.real, copy=True)
im2.calcAll(min_dr=1.0, min_npix=2)
im2.plotMore()

# Now start plotting things, in comparison. 
clims = im.showImage()
#print clims
im2.showImage(clims=clims)
im2.showImage()
im.showFft(clims=clims)
im2.showFft(clims=clims)
im.showPsd2d()
im2.showPsd2d()
im.showPhases()
im2.showPhases()
im.showAcovf2d()
im2.showAcovf2d(imag=False)
im.showPsd1d(comparison=im2)
im.showAcovf1d(comparison=im2)
im.showSf(linear=True, comparison=im2)

pylab.show()
exit()