procedure tpull (abbImgs, SUMextn, CLNextn, flxRat, rptCalc, xysFile, pk, off, maskImg, thresh, thrVals, thrFile, act, dis, f1, f2, rad, outFile) string abbImgs {"list10",prompt="List of images to measure (abbreviated names)"} string SUMextn {"w",prompt=" Extension appended to summed images"} string CLNextn {"c1",prompt=" Extension appended to cleaned images"} real flxRat {5.5, prompt="Fixed flux ratio (sum/cln), or... "} bool rptCalc {yes, prompt="Calculate flux ratio each image?"} string xysFile {"=", prompt=" Star x-y posn file for ratio calculations"} bool pk {yes, prompt=" Star peaks for ratio? (otherwise uses fluxes)"} real off {100, prompt="Offset to add before comparing images"} string maskImg {"s0mask3",prompt="Image mask to apply"} real thresh {7.0, prompt="CR threshold (lower limit), in counts"} bool thrVals {no, prompt="OR read threshold values from file?"} string thrFile {"-", prompt=" -> Name of threshold file"} bool act {yes,prompt="Interactive mode?"} bool dis {yes,prompt="Display each image pair after search?"} int f1 {1,prompt=" sumImage display frame number"} int f2 {2,prompt=" clnImage display frame number"} int rad {10, prompt=" pixel radius of circle markers"} string outFile {"tpull.out",prompt="Name of output pixel ascii file"} struct *flist1 # list-directed structure struct *flist2 # list-directed structure struct *flist3 # list-directed structure struct *flist4 # list-directed structure begin # Variable Declarations: string c1 # first character of all filenames (for checking, since # FORTRAN will not read filenames beginning with a no.) string rawName # raw, abbreviated image name string CLNimage string SUMimage # full names of cleaned and summed images bool redo # flag defining whether tcray is repeated int j # image slice counter string action # action command entered at run time real x real y # x and y as read from tcray output file bool quitTask # flag signalling premature exit from task int tot # CR pixel counters string imgjnk # junk string for superfluous fscan() data # Make sure the IMAGES and IMGTOOLS packages are loaded: if (! defpac ("images")) { print("IMAGES package not loaded") bye } if (! defpac ("imgtools")) { print("STSDAS.TOOLBOX.IMGTOOLS package not loaded") bye } # Deleting any old version of images/files: delete(files=outFile,verify=no,default=yes, go_ahead=yes) delete(files="temp_tpull*",verify=no,default=yes, go_ahead=yes) # Checking for numeric starters in supplied file names: # (FORTRAN will not read such names if given as input!!) c1 = substr(outFile, 1, 1) if ((c1=="0")||(c1=="1")||(c1=="2")||(c1=="3")|| (c1=="4")||(c1=="5")||(c1=="6")||(c1=="7")||(c1=="8")||(c1=="9")) { print("** ERROR: first character of 'outFile' ("//outFile//") is numeric **") print(" ") print(" --> Please change incorrect file name and re-run") print(" ") print (" Done.") print (" ") print (" ") bye } if ((xysFile=="=")&&(flxRat<=0.0)) { print (" ") print (" ") print (" *** ERROR: Need to specify an X-Y position file name ...") print (" (Since fluxRat value is invalid and needs re-calculation.") print (" ") print (" Try again.") bye } if ((thrVals==yes)&&(thrFile=="-")) { print (" ") print (" ") print (" *** ERROR: No file name of thresholds specified ...") print (" ") print (" Try again.") bye } # Checking interactive/non-interactive: print (" ") print (" ") print (" Flux ratio: "//flxRat) if (flxRat<=0.0) { print (" --> Entered flux ratio invalid") print (" --> Will have to calculate (using TRATIO)") print (" ") rptCalc=yes } print (" Repeat flux ratio calcs: "//rptCalc) print (" Display images after each search: "//dis) print (" Interactive mode: "//act) print (" ") if (act==no) { f1=1 f2=2 rad=10 } # Main image loop: -------------------------------------------- flist1 = abbImgs if (thrVals==yes) { flist4 = thrFile } j=0 tot=0 quitTask=no redo=yes while ((fscan(flist1, rawName) != EOF)&&(quitTask==no)) { j=j+1 SUMimage=rawName//SUMextn CLNimage=rawName//CLNextn print (" ") print ("==================================================") print (" "//rawName) print (" ") if (thrVals==yes) { imgjnk = fscan(flist4, thresh) print (" CR threshold "//thresh//" read from "//thrFile) print (" ") } # tcray loop (to redo if necessary): while ((redo==yes)&&(quitTask==no)) { # Calculating flux ratio between current images: if (rptCalc==yes) { print (" Calculating flux ratio...") tratio(imgNum=SUMimage,imgDen=CLNimage, starFile=xysFile, usePeak=pk, >> "temp_tpull1") type (input_fi="temp_tpull1",map_cc+, device="terminal",flpar-) flist3 = "temp_tpull1" imgjnk = fscan(flist3, flxRat) delete(files="temp_tpull1",verify=no,default=yes, go_ahead=yes) } print ("Running TCRAY --------------------------------") print (" ") tcray(sumImage=SUMimage,clnImage=CLNimage,ratio=flxRat, compOffs=off,maskImage=maskImg,crThreshold=thresh,asciiFil="temp_tpull2", full-, inspect=dis, frm1=f1,frm2=f2,circRad=rad) print ("----------------------------------------------") # Option of repeating tcray calculation: if (act==no) { redo=no } else { print (" ") print (" *** Re-do tcray on this image? (y/n)") scan(action) if (action=="y") { redo=yes } else { redo=no } if (redo==yes) { print (" ") print (" --> Please input new values for:") print ("1. Flux ratio ("//flxRat//"):") scan (flxRat) print ("2. Additive offset ("//off//"):") scan (off) print ("3. CR threshold ("//thresh//"):") scan (thresh) } } # Option of running remaining images in batch mode: if ((act==yes)&&(redo==no)) { print (" ") print (" *** Do remaining interactively? (y/n/uit)") scan(action) if (action=="y") { act=yes } else if (action=="q") { quitTask=yes print (" ") print (" --> QUITTING TASK EARLY ...") print (" --> Please wait.") print (" ") } else { act=no } } # Adding results to output file: if (redo==no) { flist2="temp_tpull2" while ( fscan(flist2, x, y) != EOF) { tot=tot+1 print (x//" "//y//" "//j, >> outFile) } } print(" ") print(" ") } redo=yes } print (" ") # print ("---------------------------------------------") print (" Total Number CR pixels: "//tot) print (" ") print ("==================================================") print (" ") print (" Done.") print (" ") print (" ") end