procedure ts3 (imageFile, outImage, genformat, coordFile, nSlices, hl, nObjCol, verb) string imageFile {prompt="File listing scan images (full names)"} string outImage {prompt="Mosaic image file name"} bool genformat {yes, prompt="Are coords from a spectext output file?"} string coordFile {prompt="Object coordinate file"} int nSlices {7,prompt="Number of image slices"} int hl {10,prompt="Half-length of box (in pix)"} int nObjCol {14,prompt="Number of objects per column"} bool verb {yes,prompt="Verbose output?"} struct *clist # list-directed structure to go thru coordFile # Suggestions for a better script: # 1. Have it work out number of images in a scan from the # no. of lines in images.lis # 4. Have it label each row by its image coordinates, and hori- # zontally by wavelength (from zoffset in image header?). begin # Variable Declarations: struct image # image currently being added to mosaic int x,y # coords of each box centre int i string imgFile # file containing images to be mosaiced string colFile # file containg columns of images to mosaic string subImage string box # Make sure the NOAO.NPROTO package is loaded: if (! defpac ("nproto")) { print("Package NPROTO needs to be loaded.") bye } # Cleaning-up any stray images: imdelete (images="ftemp*") delete (files="fdata?.lis",go_ahea+,ver-) delete (files="mostemp.out",go_ahea+,ver-) delete (files="temp_*",go_ahea+,ver-) print (" ") # Extracting coordinates if they are in a general format spectext file: if (genformat==yes) { copy (input=coordFile, output="temp_orig",verb-) delete (files=coordFile,go_ahea+,ver-) print ("awk '{print $2,$3}' temp_orig >"//coordFile, >> "temp_awk") !chmod 777 temp_awk !temp_awk # need to use AWK here since IRAF script fields cannot handle # many wide columns successfully. } clist = coordFile # putting the contents of the list contained in imageFile # to the list-directed structure *flist imgFile = "@"//imageFile i=0 # while ( fscan(flist, image) != EOF) { while ( fscan(clist,x,y) != EOF) { i=i+1 subImage="ftemp"//i # output filename for temporary sub-mosaic colFile = "fdata"//(int((i-1)/nObjCol))//".lis" if (verb==yes) { print(subImage) print (colFile) print("---------") } else { printf(".") } print(subImage, >> colFile) box="["//(x-hl)//":"//(x+hl)//","//(y -hl)//":"//(y+hl)//"]" irmosaic (input=imgFile,output=subImage, database="mostemp.out",nxsub=nSlices,nysub=1,trim_section=box, corner="ul",direct="row",raster-,nxoverl=-2,nyoverl=0,verbose=no) } clist = coordFile # equivalent to rewinding place in coordinate file back to the top # } # Forming final full mosaic (of strips): fstrip irmosaic (input="@fdata0.lis",output="ftempcol1", database="mostemp.out",nxsub=1,nysub=nObjCol,trim_section="[*,*]", corner="ul", direct="row",raster-,nxoverl=0,nyoverl=-5,verb-) irmosaic (input="@fdata1.lis",output="ftempcol2", database="mostemp.out",nxsub=1,nysub=nObjCol,trim_section="[*,*]", corner="ul", direct="row",raster-,nxoverl=0,nyoverl=-5,verb-) irmosaic (input="@fdata2.lis",output="ftempcol3", database="mostemp.out",nxsub=1,nysub=nObjCol,trim_section="[*,*]", corner="ul", direct="row",raster-,nxoverl=0,nyoverl=-5,verb-) # Butting columns all together: irmosaic (input="ftempcol1,ftempcol2,ftempcol3",output=outImage, database="mostemp.out",nxsub=3,nysub=1,trim_section="[*,*]", corner="ul", direct="row",,nxoverl=-10,nyoverl=0,verb-) if (verb==yes) { print (outImage) } else { printf (" - Done\n") } # Retrieving general format spectext file: if (genformat==yes) { delete (files=coordFile,go_ahea+,ver-) rename (files="temp_orig", newnam=coordFile) } # Clean-up: imdelete (images="ftemp*") delete (files="fdata?.lis",go_ahea+,ver-) delete (files="mostemp.out",go_ahea+,ver-) end