# And also try to make an image with the same (final) pixel scale, but that will be created (first) # larger and then scaled down, to avoid introducing artifacts from the ACovF1d being truncated. final_imsize = 1500 # pixels desired in final image final_rad_fov = 1.75*numpy.sqrt(2) # degrees final_pixscale = 2*final_rad_fov / float(final_imsize) # Start with larger image pixscale = final_pixscale rad_fov = final_rad_fov imsize = int(2*rad_fov / pixscale) if (imsize%2 != 0): imsize = imsize + 1 xr = xsf / pixscale # xr = in pixels, over range that want to simulate print 'Image: Rad_fov', rad_fov, 'Imsize', imsize, 'Pixscale', pixscale, 'deg/pix', '(', pixscale*60.*60., 'arcsec/pix)' im = PImagePlots(shift=True, nx=imsize, ny=imsize) im.makeImageFromSf(sfx=xr, sf=SF) im.showAcovf1d() im.showPsd2dI() # Trim image to desired final size trim = round((imsize - final_imsize)/2.0) print 'Trimming about %d pixels from each side' %(trim) image = im.imageI[trim:trim+final_imsize, trim:trim+final_imsize] image = rescaleImage(image.real, sigma_goal, kappa) imsize = len(image) pixscale = pixscale rad_fov = imsize/2.0*pixscale print 'Image After Trimming: Rad_fov', rad_fov, 'Imsize', imsize, 'Pixscale', pixscale, 'deg/pix', '(', pixscale*60.*60., 'arcsec/pix)' im.setImage(image.real) imageStats(im.image) im.showImage(copy=True) im.hanningFilter()
print 'Rad_fov', rad_fov, 'Imsize', imsize, 'Pixscale', pixscale, 'deg/pix', '(', pixscale*60.*60., 'arcsec/pix)' # set up 1d SF with desired scale and pixel scale """ condition = (xsf <= rad_fov) xr = xsf[condition] / pixscale # xr = in pixels, over range that want to simulate xrpix = numpy.arange(0, imsize, 1.0) sfpix = numpy.interp(xrpix, xr, SF[condition]) """ condition = (xsf <= rad_fov*numpy.sqrt(2)) xr = xsf[condition] / pixscale # xr = in pixels, over range that want to simulate xrpix = numpy.arange(0, imsize/2.*numpy.sqrt(2), 1.0) sfpix = numpy.interp(xrpix, xr, SF[condition]) # try making image im = PImagePlots(shift=True, nx= imsize, ny=imsize) im.makeImageFromSf(sfx=xrpix, sf=sfpix) im.showImageI() pylab.savefig('clouds_1.png', format='png') im.image = im.imageI.real #im.hanningFilter() im.calcAll(min_npix=2, min_dr=1) im.plotMore() pylab.savefig('clouds_1_dat.png', format='png') # Rescale sfx to be in physical (degrees) im.sfx = im.sfx * pixscale # make another image, as should see difference due to different random phases im2 = PImagePlots(shift=True, nx= imsize, ny=imsize) im2.invertSf(sfx=xrpix, sf=sfpix) im2.invertAcovf1d()