procedure tflux (cpfigflux, imgFile,abbName,extn, useImexam, imexFile,strtFrm, rollFrames, apers, numApers, radSky, widthSky, gn, xoff, yoff, xZero, yZero, Xopt, Yopt, waveFile, ZDkeywd1, ZDkeywd2, EXPkeywd, filtWid, mirrArea, fluxFile, obsFile) bool cpfigflux {yes, prompt="Copy figfluxcal to current directory?"} string imgFile {"list2", prompt="List of images (full or abbreviated names)"} bool abbName {yes, prompt=" Are image names abbreviated?"} string extn {"ff", prompt=" Extension appended to abbreviated image names"} bool useImexam {yes, prompt="Get star XYs interactively? or from file"} string imexFile {"tflux.xys", prompt=" File of XYs (either in/out)"} int strtFrm {1, prompt=" Ximtool frame for first image"} bool rollFrames {yes, prompt=" Successive images in a fresh frame?"} string apers {"30,34", prompt="QPHOT: List of photometry apertures"} int numApers {2, prompt=" QPHOT: Number of apertures"} real radSky {50, prompt=" QPHOT: Inner rad of sky annulus"} real widthSky {15, prompt=" QPHOT: Thickness of sky annulus"} real gn {5.5, prompt=" QPHOT: Instrument gain (e-/ADU)"} int xoff {975, prompt="Lower LH (small central frame) wrt FULL CCD: X"} int yoff {1999, prompt="Lower LH (small central frame) wrt FULL CCD: Y"} int xZero {201, prompt=" Lower LH (larger frame) wrt to FULL CCD: X"} int yZero {1301, prompt=" Lower LH (larger frame) wrt to FULL CCD: Y"} int Xopt {520, prompt="Optical axis centre (full flipped image): X"} int Yopt {308, prompt="Optical axis centre (full flipped image): Y"} string waveFile {"fldA.wave2", prompt="Central wavelengths file (indiv slices)"} string ZDkeywd1 {"ZDSTART", prompt="Header Keyword: Zenith Distance, start"} string ZDkeywd2 {"ZDEND", prompt="Header Keyword: Zenith Distance, end"} string EXPkeywd {"EXPOSED", prompt="Header Keyword: Exposure time"} real filtWid {21.6, prompt="Effective width of passband (in A)"} real mirrArea {4.74e4, prompt="Area of primary mirror (in cm^2)"} string fluxFile {"hd219617a.sep10", prompt="Output: file of fluxes"} string obsFile {"hd219617b.sep10", prompt="Output: file of observation params"} struct *flist # list-directed structure struct *clist # list-directed structure begin # Variable Declarations: string rawName # raw (abbreviated) image name string fullName # full image name int j # frame counter string action # action command entered at run time string scnjnk real xc, yc # current star coords string fld # fields to print from qphot output int col string shellLine real num1, num2 int num3 int xLH, yLH # (x,y) of star measured wrt # to large frame (NOT full chip) if (! defpac ("images")) { print("Package IMAGES needs to be loaded.") bye } if (! defpac ("apphot")) { print("Package NOAO.DIGIPHOT.APPHOT needs to be loaded.") bye } # Pixel offset added to get star in pix coords of large frame xLH=xoff-(xZero-1) yLH=yoff-(yZero-1) delete (files="temp_*",go_ahea+,ver-) delete (files=fluxFile,go_ahea+,ver-) delete (files=obsFile,go_ahea+,ver-) if (useImexam==yes) { delete (files=imexFile,go_ahea+,ver-) } # Copying SM script if requested: if (cpfigflux==yes) { print (" ") print (" Copying SM script (figfluxcal) and input files...") !cp /home/dhj/iraf/TFred/figfluxcal . print (" - copied figfluxcal") !cp /home/dhj/iraf/TFred/round . print (" - copied round") !cp /home/dhj/iraf/TFred/bartkev.lis . print (" - copied bartkev.lis (HD19445, HD140285, HD219617)") !cp /home/dhj/iraf/TFred/bessell.lis . print (" - copied bessell.lis (LTT9239, EG21)") !cp /home/dhj/iraf/TFred/hamuy_short.lis . print (" - copied hamuy_short.lis (CD-32, LTT3218)") !cp /home/dhj/iraf/TFred/post . print (" - copied post") !cp /home/dhj/iraf/TFred/figfluxavg . print (" - copied figfluxavg") print (" ") } # Loop to obtain star posns: (if requested) ------------------------ if (useImexam==yes) { flist = imgFile j = strtFrm while ( fscan(flist, rawName) != EOF) { if (abbName==yes) { fullName=rawName//extn } if (abbName==no) { fullName=rawName } display (image=fullName,frame=j,erase+,bord-, sele+,repe-,fill-,zscal+,ztrans="linear", >> "temp_junk.out") print (" ") print (" *** "//fullName//" displayed in Ximtool frame "//j//" ***") delete (files="temp_tflux1",go_ahea+,ver-) # print (" ") print (" --> Use imexam commands: <,> (on star) and ") imexam(input=fullName,frame=j,image=fullName,keeplog-,defkey=",",autor+, allfram+,nfram=0,graphcu="",imagecu="",wcs="logical",graphic="stdgraph", display="display(image='$1',frame=$2)",use_dis+, >> "temp_tflux1") fields (files="temp_tflux1",fields="1-2", lines="2-9999",quit_if-, print_f-, >> imexFile) if (rollFrames==yes) { j=j+1 if (j>4) {j=j-4} } } # end of loop. } # ------------------------------------------------------------------ print (" ") print (" ") print (" List of star XYs ("//imexFile//"):") print (" ") type (input_fi=imexFile, map_cc+, device="terminal") print (" ") # Photometry (QPHOT): ---------------------------------------------- print (" ") print (" Aperture photometry at these positions (QPHOT) -- please wait:") print (" ") # List of image names: if (abbName==yes) { flist = imgFile while ( fscan(flist, rawName) != EOF) { fullName=rawName//extn print (fullName, >> "temp_tflux2") } } else { copy (input=imgFile, output="temp_tflux2", verb-) } # copy (input=imexFile, output="temp_tflux2a", verb-) # Qphot loop (one frame at a time since XYs change between frames: flist = "temp_tflux2" clist = imexFile while ( fscan(flist, fullName) != EOF) { scnjnk = fscan(clist, xc, yc) delete (files="temp_tflux2a",go_ahea+,ver-) print (xc, yc, >> "temp_tflux2a") # i.e. temporary coordinate file delete (files="temp_tflux3",go_ahea+,ver-) qphot (image=fullName, cbox=5.,annulus=radSky, dannulus=widthSky, aperture=apers, coords="temp_tflux2a", output="temp_tflux3", plotfil="", zmag=0.0, expo="",airm="", filt="", obstime="", epadu=gn, interac-, radplot-, verb+, >> "temp_tflux4") imgets (image=fullName, param=ZDkeywd1) num1 = real(imgets.value) imgets (image=fullName, param=ZDkeywd2) num2 = real(imgets.value) imgets (image=fullName, param=EXPkeywd) num3 = int(imgets.value) print (num1, num2, num3, >> "temp_tflux10") } # i.e. temp_tflux2 is the new input file, with image names # (abbrev or not) print (" ") type (input_fi="temp_tflux4", map_cc+, dev="terminal") col = numApers+4 fld = "1-3,"//col fields (files="temp_tflux4",fields=fld, lines="1-9999",quit_if-, print_f-, >> "temp_tflux5") print (" ") # type (input_fi="temp_tflux5", map_cc+, dev="terminal") # Calculating optical radius for star positions: # shellLine="awk '{x=$2+"//xoff//";y=$3+"//yoff//";a=x-"//Xopt//"; # b=y-"//Yopt//"; r=sqrt(a*a+b*b); theta = r/5346.4; print r, theta}' # temp_tflux5 > temp_tflux7" # ** OLD VERSION -- NO LONGER VALID shellLine="awk '{x=$2+"//xLH//";y=$3+"//yLH//";a=x-"//Xopt//"; b=y-"//Yopt//"; r=sqrt(a*a+b*b); theta = r/5346.4; print r, theta}' temp_tflux5 > temp_tflux7" print (shellLine, >> "temp_tflux6") !chmod 777 temp_tflux6 !temp_tflux6 # type (input_fi="temp_tflux7", map_cc+, dev="terminal") # Writing QPHOT output to file (fluxFile): ------------------------- print (" ") print (" ") print ("Output file 1 ("//fluxFile//"): ----------------------------") print (" ") joinlines (list1="temp_tflux5,"//waveFile//",temp_tflux7,temp_tflux10", list2="", output=fluxFile, delim=" ", missing="Missing", maxchar=161, shortes+, verb+) print ("# ", >> fluxFile) print ("# image X Y mag wave rad theta ZDstart ZDend Texp", >> fluxFile) print ("# (in small window) (big ap) (uncorr)(opt axis) (radian) (deg) (deg) (sec)", >> fluxFile) print ("#", >> fluxFile) print ("# "//fluxFile, >> fluxFile) type (input_fi=fluxFile, map_cc+, dev="terminal") # Writing observation params to file (obsFile): ------------------- print (" ") print (" ") print ("Output file 2 ("//obsFile//"): ----------------------------") print (" ") print ("passband_(A) "//filtWid, >> obsFile) print ("mirror_area_(cm^2) "//mirrArea, >> obsFile) print ("CCD_gain_(e-/ADU) "//gn, >> obsFile) print ("# ", >> obsFile) print ("# "//obsFile, >> obsFile) type (input_fi=obsFile, map_cc+, dev="terminal") print (" ") print (" ") print ("-----------------------------------------------------------") delete (files="temp_*",go_ahea+,ver-) print(" ") print(" ") print(" All done.") end