procedure tedge (imgFilX, abbNamX, extX, skyFilX, a1X, a2X, a3X, a4X, SNliX, gaiX, rnY, outTX, outRMX, XcY, YcY, radY, XmaxY, YmaxY, maskZerZ, displFin, fm) string imgFilX {"-",prompt="List of images (full or abbreviated names)"} bool abbNamX {no, prompt=" Are image names abbreviated?"} string extX {prompt=" Extension appended to abbreviated image names"} string skyFilX {"=", prompt="File of sky regions."} real a1X {4, prompt="Aperture 1 (diameter)"} real a2X {8, prompt="Aperture 2 (diameter)"} real a3X {12, prompt="Aperture 3 (diameter)"} real a4X {20, prompt="Aperture 4 (diameter)"} real SNliX {1, prompt="Photometry limit (as a S/N ratio)"} real gaiX {2.74, prompt="CCD gain (e-/ADU)"} real rnY {2.0, prompt="Read noise of CCD (rms e-)"} string outTX {"--", prompt="Output file for flux threshold data"} string outRMX {"---", prompt="Output file for sky data"} real XcY {730.0, prompt="X-coord of circular aperture centre"} real YcY {830.0, prompt="Y-coord of circular aperture centre"} real radY {720.0, prompt="Radius of circular aperture"} int XmaxY {0, prompt="Image dimension in X"} int YmaxY {0, prompt="Image dimension in Y"} string maskZerZ {"-",prompt="Zero mask image (full name)"} bool displFin {yes,prompt="Display mask-applied images, one-by-one?"} int fm {1, prompt=" Ximtool frame to display into"} struct *flist1 struct *flist2 # list-directed structures # inputs for tnoise have an "X", inputs for tmask have a "Y" and # inputs for tmcomb have a "Z" appended to the variable name begin # Variable Declarations: string rawName # raw (abbreviated) image name string fullName # full image name string imgjnk # junk string to store first image name string strjnk # junk string real avgSky # average sky level for an image real avgRMS # average RMS for an image if (! defpac ("images")) { print("Package IMAGES needs to be loaded.") bye } if (! defpac ("lists")) { print("Package LISTS needs to be loaded.") bye } if (! defpac ("proto")) { print("Package PROTO needs to be loaded.") bye } if (! defpac ("utilities")) { print("UTILITIES package not loaded") bye } if (! defpac ("artdata")) { print("ARTDATA package not loaded") bye } print (" ") print ("========================================================") print (" ") print (" 1. Running TNOISE:" print (" ") # all necessary checks/file deletions are done within tnoise: tnoise (imgFile=imgFilX,abbName=abbNamX,extn=extX,useRimcur-,frm=1, boxSize=60,skyFile=skyFilX,fluxThresh+,ap1=a1X,ap2=a2X,ap3=a3X,ap4=a4X, SNlim=SNliX,gain=gaiX,outTh=outTX,outRMS=outRMX,inclMeans+) # Creating noise masks and applying to images: flist1 = imgFilX flist2 = outRMX print (" ") print ("========================================================") print (" ") print (" 2. Running TMASK and TMCOMB image-by-image:") print (" ") # Top of Main Image Loop: - - - - - - - - - - - - - - - - - - - - - while ( fscan(flist1, rawName) != EOF) { if (abbNamX==yes) { fullName=rawName//extX } if (abbNamX==no) { fullName=rawName } imgjnk = fscan(flist2, strjnk, avgSky, avgRMS) # print (" ==> "//fullName//" "//avgSky//" "//avgRMS) imdelete (images="temp_tedge1",verify=no,default=yes, go_ahead=yes) delete (files="temp_tedge2",go_ahea+,ver-) # Creating RMS corner mask: tmask (maskType="rms",maskZER="-",maskRMS="temp_tedge1", skyRMS=avgRMS, gn=gaiX, rn=rnY, subBack+, newBack=avgSky, Xc=XcY, Yc=YcY, rad=radY, Xmax=XmaxY, Ymax=YmaxY) # Applying RMS corner mask to image: print (rawName, >> "temp_tedge2") tmcomb (offImgs="temp_tedge2", combType="sum", CLNextn="-", SUMextn=extX, maskType="rms", maskZer=maskZerZ, clnmaRMS="-", summaRMS="temp_tedge1") # Displaying result in Ximtool frame if this was requested: if (displFin==yes) { print (" ") print (" --> Displaying mask-applied image in Ximtool, frame "//fm) print (" ") display (image=fullName,frame=fm,erase+,bord-, sele+,repe-,fill-,zscal+,ztrans="linear", >> "temp_junk") } print (" ") print ("========================================================") print (" ") } # End of main image loop. - - - - - - - - - - - - - - - - - - - - - # Cleaning up: imdelete (images="temp_tedge1",verify=no,default=yes, go_ahead=yes) delete (files="temp_junk",go_ahea+,ver-) delete (files="temp_tedge2",go_ahea+,ver-) end