procedure tmosaic (outType, datFile, takeAll, i1, i2, selectStr, loc, imgFile, abbName, extnAbb, putLast, numCols, halfL, inclIDs, txtheight, inclAps, firstFrm, a1, a2, a3, a4, outFile, inputImg, frm, inclCirc, apert, inclSigs, fontSize, stdX, stdY, outChart) string outType {"chart", prompt="Output to produce (strip|chart|both)"} string datFile {"two", prompt="Input elgRed catalogue extension"} bool takeAll {yes, prompt=" Select all candidates?"} int i1 {1, prompt=" -> if not, START row"} int i2 {62, prompt=" -> if not, END row"} string selectStr {"", prompt=" Further selection criterion (if (...))"} int loc {1, prompt="Strip: Frame to display in"} string imgFile {"-",prompt="Strip: List of images (full or abb names)"} bool abbName {no, prompt="Strip: Are image names abbreviated?"} string extnAbb {prompt="Strip: Extension appended to abbreviated image names"} bool putLast {yes, prompt="Strip: Put non-contin candidates last?"} int numCols {3, prompt="Strip: Number of columns in mosaic"} int halfL {20, prompt="Strip: Half-length of box (in pix)"} bool inclIDs {yes, prompt="Strip: Include object IDs on mosaic?"} int txtheight {2, prompt="Strip: -> Text font size"} bool inclAps {yes, prompt="Strip: Include apertures on mosaic?"} bool firstFrm {yes, prompt="Strip: -> apertures on first frame only?"} real a1 {6, prompt="Strip: Aperture 1 (diameter)"} real a2 {9, prompt="Strip: Aperture 2 (diameter)"} real a3 {12, prompt="Strip: Aperture 3 (diameter)"} real a4 {20, prompt="Strip: Aperture 4 (diameter)"} string outFile {"mos1fldA", prompt="Strip: Output file"} string inputImg {"deepCLNfldA", prompt="Chart: Input image for chart"} int frm {2, prompt="Chart: Frame to display in"} bool inclCirc {yes, prompt="Chart: Encircle objects with an aperture?"} int apert {10, prompt="Chart: -> Aperture diameter "} bool inclSigs {yes, prompt="Chart: Write sig-devns? (o/wise just IDs)"} int fontSize {2, prompt="Chart: Text font size"} int stdX {2048, prompt="Chart: Size of STDIMAGE in X"} int stdY {2048, prompt="Chart: Size of STDIMAGE in Y"} string outChart {"mos2fldA", prompt="Chart: Output file"} struct *flist # list-directed structure to go thru filenames begin # Variable declarations: real xc, yc # current candidate coordinates int j # input file line counter real jR, numColsR # real-number equivalents of these variables real quot # quotient int quotIR # real-valued version of the int(quot) int numPads # number of pads real numPadsR # real-valued version of number of pads int n # counter string fullName string rawName int nSlices # number of slices string action # action command entered at run time int apRad # aperture-radius used on chart string symb int mosX, mosY # dimensions of mosaic-strip image int x1, x2, y1, y2 string trimStr # string for trimming tvmark output images string empty # string to add to awk command to print # a nonsensical line to ensure non-empty o/put # empty="; if(NR==1){print 3e3,3e3,0}" empty="" if (! defpac ("images")) { print("Package IMAGES needs to be loaded.") bye } if (! defpac ("nproto")) { print("Package NPROTO needs to be loaded.") bye } if (! defpac ("sdisplay")) { print("STSDAS.GRAPHICS.SDISPLAY package not loaded") bye } if ((numCols!=1)&&(numCols!=2)&&(numCols!=3)) { print (" ") print (" *** ERROR: Illegal value for numCols") print (" Please try again.") print (" ") print (" ") bye } if ((takeAll==yes)&&(i1<=0)) { print (" ") print (" *** ERROR: Illegal value for i1") print (" Please try again.") print (" ") print (" ") bye } if ((takeAll==yes)&&(i2<=0)) { print (" ") print (" *** ERROR: Illegal value for i2") print (" Please try again.") print (" ") print (" ") bye } # Clean-up before start: imdelete (image="tempMO_img*", ver-, def+, go_ahead+) delete (files="tempMO_*",go_ahea+,ver-) delete (files="tempMOids*",go_ahea+,ver-) # Main AWK script is in tempMO_0; other files are tempMO_? print (" ") print (" ") print ("***********************************************************") print ("*** ***") print ("*** Task will bomb-out if selection causes empty files ***") print ("*** ***") print ("***********************************************************") print (" ") print (" ") if ((outType=="chart")||(outType=="both")) { print (" ") print ("*****************************************************") print (" ") imhead (images=" ", imlist=inputImg, longhead-, userfie+) print (" ") print ("*****************************************************") print (" ") print (" -> Please input these values from information above") print (" (Required for chart-making below...)") print (" ") print (" 1. Size of strip-mosaic in X:") scan (mosX) print (" 2. Size of strip-mosaic in Y:") scan (mosY) print (" ") print (" -> thank you (please wait)...") print (" ") print (" ") x1=int((stdX-mosX)/2) x2=int(x1+mosX) y1=int((stdY-mosY)/2) y2=int(y1+mosY) trimStr="tempMO_img2["//x1//":"//x2//","//y1//":"//y2//"]" } print (" ") print ("==============================================================") print (" ") print (" ") if (takeAll==yes) { print (" (full list)") print ("awk '{ "//selectStr//" {print $2, $3, $1}"//empty//"}' elgRed."//datFile//" > tempMO_10", > "tempMO_0") print ("awk '{ "//selectStr//" {print $2, $3, $16}"//empty//"}' elgRed."//datFile//" > tempMO_11", >> "tempMO_0") # i.e. for chart print ("awk '{ "//selectStr//" {print $2, $3, $17}"//empty//"}' elgRed."//datFile//" > tempMO_1a", >> "tempMO_0") print ("awk '{ "//selectStr//" {print $4, $1, $17}"//empty//"}' elgRed."//datFile//" > tempMO_3a", >> "tempMO_0") # i.e. for strip-mosaic } else { print (" ("//i1//"-"//i2//")") print ("awk '{ "//selectStr//" {a=a+1; if ((a>="//i1//")&&(a<="//i2//")) {print $2, $3, $1}}"//empty//"}' elgRed."//datFile//" > tempMO_10", > "tempMO_0") print ("awk '{ "//selectStr//" {a=a+1; if ((a>="//i1//")&&(a<="//i2//")) {print $2, $3, $16}}"//empty//"}' elgRed."//datFile//" > tempMO_11", >> "tempMO_0") # i.e. for chart print ("awk '{ "//selectStr//" {a=a+1; if ((a>="//i1//")&&(a<="//i2//")) {print $2, $3, $17}}"//empty//"}' elgRed."//datFile//" > tempMO_1a", >> "tempMO_0") print ("awk '{ "//selectStr//" {a=a+1; if ((a>="//i1//")&&(a<="//i2//")) {print $4, $1, $17}}"//empty//"}' elgRed."//datFile//" > tempMO_3a", >> "tempMO_0") # i.e. for strip-mosaic } print ("awk '{if ($3==5.0) {print $1, $2}}' tempMO_1a > tempMO_1b", >> "tempMO_0") print ("awk '{if (($3<5.0)||($3>5.0)) {print $1, $2}}' tempMO_1a > tempMO_1c", >> "tempMO_0") print ("awk '{if ($3==5.0) {print $1, $2}}' tempMO_3a > tempMO_3b", >> "tempMO_0") print ("awk '{if (($3<5.0)||($3>5.0)) {print $1, $2}}' tempMO_3a > tempMO_3c", >> "tempMO_0") if (putLast==yes) { print ("cat tempMO_1c tempMO_1b > tempMO_1", >> "tempMO_0") print ("cat tempMO_3c tempMO_3b > tempMO_3", >> "tempMO_0") } else { print ("cat tempMO_1b tempMO_1c > tempMO_1", >> "tempMO_0") print ("cat tempMO_3b tempMO_3c > tempMO_3", >> "tempMO_0") } # i.e. more catalogue extraction for strip-mosaic print (" ") print (" Extracting candidates (please wait)...") !chmod 777 tempMO_0 !tempMO_0 flist="tempMO_1" j=0 while ( fscan(flist, xc, yc) != EOF) { j=j+1 } print (" -> there are "//j//" candidates") print (" ") if ((outType=="strip")||(outType=="both")) { print (" ") print (" ") print ("==============================================================") print (" ") print (" 1. Creating Strip-Mosaic:") print (" ") imdelete (image=outFile, ver-, def+, go_ahead+) print (" ") # Working out if objects divide evenly among columns; # padding if not: ------------------------------------------------ numPadsR=0.0 jR=j*1.0 numColsR=numCols*1.0 quot=(jR+numPadsR)/numColsR quotIR=1.0*(int(quot)) while (quot!=quotIR) { numPadsR=numPadsR+1.0 quot=(jR+numPadsR)/numColsR quotIR=1.0*int(quot) } numPads=int(numPadsR) if (numPads>0) { print (" "//j//" candidates do not divide evenly into "//numCols//" columns") } else { if (numCols>1) { print (" "//j//" candidates divide evenly into "//numCols//" columns") } else { print (" "//j//" candidates divides evenly into "//numCols//" column") } } if (putLast==yes) { print (" Putting the non-contin candidates last") } print (" ") print (" -> Number of columns: "//numCols) print (" -> Rows per column: "//quotIR) print (" -> Rows of padding included: "//numPads) print (" ") n=1 while (n<=numPads) { print ("100.0 100.0", >> "tempMO_1") n=n+1 } if (j>0) { # Creating strip-mosaic (tstrip etc) and displaying (tapdraw): ------- flist = imgFile nSlices=0 while ( fscan(flist, rawName) != EOF) { if (abbName==yes) { fullName=rawName//extnAbb } if (abbName==no) { fullName=rawName } print(fullName, >> "tempMO_2") nSlices=nSlices+1 } # i.e. "tempMO_2" is the list of full image names print (" Number of slices: "//nSlices) print (" Half-length of box: "//halfL//" pix") print (" ") print (" Creating strip-mosaic (please wait)...") if (numCols==1) { print (" -> Using tstrip") tstrip (imageFil="tempMO_2", outImage="tempMO_img1", genforma-, coordFil="tempMO_1", nSlices=nSlices, hl=halfL, verb-) } else if (numCols==2) { print (" -> Using ts2") ts2 (imageFil="tempMO_2", outImage="tempMO_img1", genforma-, coordFil="tempMO_1", nSlices=nSlices, hl=halfL, nObjCol=quotIR, verb-) } else { print (" -> Using ts3") ts3 (imageFil="tempMO_2", outImage="tempMO_img1", genforma-, coordFil="tempMO_1", nSlices=nSlices, hl=halfL, nObjCol=quotIR, verb-) } print (" ") print ("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") print (" ") print (" Displaying (please wait)...") print (" ") tapdraw (readAps-, elgFile="-", colQnt=1, apFile="tempMO_3", mosImage="tempMO_img1", frm=loc, ap1=a1, ap2=a2, ap3=a3, ap4=a4, nSl=nSlices, hf=halfL, Nc=quotIR, hs=2, ws=10, vs=5, wrtcoord+, verb-, inclIDs=inclIDs, txtheight=txtheight, inclAps=inclAps, firstFrm=firstFrm, saveImg+, outImg=outFile, stdX=2048, stdY=2048) } else { print (" -> NO INPUTS TO EXAMINE IN THAT INPUT LINE RANGE") print (" ") } } # end of strip-mosaic section. if ((outType=="chart")||(outType=="both")) { print (" ") print (" ") print ("==============================================================") print (" ") print (" 2. Creating Chart:") print (" ") imdelete (image=outChart, ver-, def+, go_ahead+) print (" ") print (" Displaying and labelling...") display (image=inputImg,fra=frm,bpdispl="none",erase+,bord-, sele+,repe-,fill-,zscal+,ztrans="linear", >>"tempMO_JNK") apRad = int(apert/2) if (inclCirc==yes) { symb="circle" } else { symb="none" } tvmark(frame=frm,coords="tempMO_10",logfile="",autolog-, outimag="", mark=symb,radii=apRad,lengths=0,font="raster",color=200, label+,number-,nxoffse=5,nyoff=4,pointsi=3,txsize=fontSize,interac-) if (inclSigs==yes) { tvmark(frame=frm,coords="tempMO_11",logfile="",autolog-, outimag="", mark=symb,radii=apRad,lengths=0,font="raster",color=200, label+,number-,nxoffse=5,nyoff=-15,pointsi=3,txsize=fontSize,interac-) } print (" ") print (" Saving...") dsimg (frame=frm, image="tempMO_img2", maxrange+) imcopy(input=trimStr, output=outChart, verb-) imdelete (image="tempMO_img2", ver-, def+, go_ahead+) } # end of chart-making section. # Clean-up at end: imdelete (image="tempMO_img*", ver-, def+, go_ahead+) delete (files="tempMO_*",go_ahea+,ver-) delete (files="tempMOids*",go_ahea+,ver-) # Main AWK script is in tempMO_0; other files are tempMO_? print (" ") print (" ") print ("==============================================================") print (" ") print (" Done.") print (" ") end