procedure tratio (imgNum, imgDen, starFile, usePeak) string imgNum {"s0110w", prompt="Image for the numerator"} string imgDen {"s0110c1", prompt="Image for the denominator"} string starFile {"xys.out", prompt="File of star positions"} bool usePeak {yes, prompt="Star peaks? (otherwise uses fluxes)"} struct *flist1 # list-directed structure begin # Variable Declarations: int col # column number from which star peak/flux data is taken real avg # average of numerator/denominator values string imgjnk # junk string for superfluous fscan() data string colType # string describing type of star data used # Make sure the IMAGES and PROTO packages are loaded: if (! defpac ("images")) { print("IMAGES package not loaded") bye } if (! defpac ("proto")) { print("PROTO package not loaded") bye } if (usePeak==yes) { col=10 colType="PEAKS" # i.e. use star peaks } else { col=4 colType="FLUXES" # i.e. use star fluxes } # Removing old copies of files: delete (files="temp_tratio*",go_ahea+,ver-, >> "tempJNK") # Obtaining numerator-image values: imexam(inp=imgNum,frame=1,image=imgNum,logfile="",keeplog-, defkey=",",autored+,allfram+,nframes=0,ncstat=50,nlstat=50,graphcu="", imagecu=starFile,wcs="logical",graphic="stdgraph",use_dis-, >> "temp_tratio1") fields (files="temp_tratio1",fields=col,lines="2-", quit_if-, print_f-, >> "temp_tratio2") # Obtaining denominator-image values: imexam(inp=imgDen,frame=1,image=imgDen,logfile="",keeplog-, defkey=",",autored+,allfram+,nframes=0,ncstat=50,nlstat=50,graphcu="", imagecu=starFile,wcs="logical",graphic="stdgraph",use_dis-, >> "temp_tratio3") fields (files="temp_tratio3",fields=col,lines="2-", quit_if-, print_f-, >> "temp_tratio4") # *** N.B: Note the use of the "," key. *** # Joining lists, taking ratio of each value and finding average: joinlines(list1="temp_tratio2,temp_tratio4", list2="", output="temp_tratio5", delim="", missing="Missing", maxchar=161,shortes+,verb+) ! awk '{print ($1/$2)}' temp_tratio5 > temp_tratio6 type (input_fi="temp_tratio6",map_cc+,device="terminal",flpar-) | average(option="new_sample", >> "temp_tratio7") fields (files="temp_tratio7",fields=1,lines="1-", quit_if-, print_f-, >> "temp_tratio8") flist1 = "temp_tratio8" imgjnk = fscan(flist1, avg) printf ("%6.2f \n",avg) print ("# Image ratio (stellar "//colType//")") print (" ") end