simTable['pa'][i], '\n')) # Split the image up here if there are problems. split = int(np.round(NAXIS2 / splitRatio)) outfilelist = [] for si in range(int(splitRatio)): # Sort out the splitting up of the image outfile = outputImage+'.split{0}.fits'.format(si) outfilelist.append(outfile) infile = inputImage+'[1:{0},{2}:{1}]'.format(NAXIS1, split*(si+1)+1, (split*si)+1) # Copy the split files to the output directory. if os.path.isfile(outfile): os.remove(outfile) images.imcopy(input=infile, output=outfile, Stdout=1) # If there was no spatial PSF dependence, we could run mkobject here. But bum. # Choose a random PSF file psfidx = np.random.randint(0, len(psfTable)-1) psfImage = os.path.split(psfTable['file'][psfidx]) psfFile = psfPath + psfImage[-1] psfSize = psfSize # Can change this later to get it from file # Make a new image with simulated galaxies in it newImage = art.mkobject(outfile, objects = gallist_out+'.modx', yoffset = -1*(split*si), star = psfFile, radius = psfSize, magzero = inputImageZP,
print 'Image has been trimmed, binning = 2x2.....' #xcopy1_2=[ '33:288', '289:544', '545:800', '801:1056'] xcopy_3 =[ '1:256', '257:512', '513:768', '769:1024'] xcopy_1_2 = xcopy_3 datasec=['[1:256,1:2304]','[1:256,1:2304]'] biassec=['[1:32,1:2304]','[257:288,1:2304]'] else: print 'Binning = 2x1.....' print 'Image has been trimmed, binning = 2x1.....' #xcopy1_2=[ '33:288', '289:544', '545:800', '801:1056'] xcopy_3 =[ '1:256', '257:512', '513:768', '769:1024'] xcopy_1_2 = xcopy_3 datasec=['[1:256,1:4608]','[1:256,1:4608]'] biassec=['[1:32,1:4608]','[257:288,1:4608]'] else: images.imcopy( arg+'[1][1:32,*]' ,'sliceOverscan1' ) images.imcopy( arg+'[2][1:32,*]' ,'sliceOverscan2' ) if oneByOne: print 'Binning = 1x1.....' xcopy1_2 =[ '33:544', '545:1056','1057:1568','1569:2080' ] xcopy_3 =[ '1:512', '513:1024','1025:1536','1537:2048' ] datasec=['[33:544,1:4608]','[1:512,1:4608]'] biassec=['[1:32,1:4608]','[513:544,1:4608]'] images.imcopy( arg+'[3][2049:2080,*]','sliceOverscan3' ) elif twoByTwo: print 'Binning = 2x2.....' xcopy1_2=[ '33:288', '289:544', '545:800', '801:1056'] xcopy_3 =[ '1:256', '257:512', '513:768', '769:1024'] datasec=['[33:288,1:2304]','[1:256,1:2304]'] biassec=['[1:32,1:2304]','[257:288,1:2304]']