;+ ; NAME: ; wr_2_positionv ; PURPOSE: (one line) ; Write the beam positions for images (v*) ; DESCRIPTION: ; Write a short log ; tables/YYMMDD_2_positionv_SETNO.txt ; CATEGORY: ; NIRES reduction ; CALLING SEQUENCE: ; wr_2_positionv, datestr, set ; INPUTS: ; datestr: string (YYMMDD) ; sets: array of set structures ; nset: number of sets ; OUTPUTS: ; SIDE EFFECTS: ; write tables/YYMMDD_2_positionv_SETNO.txt ; RESTRICTIONS: ; tables directory must exist ; PROCEDURE: ; MODIFICATION HISTORY: ; Written 2021 Dec 30, by Leslie Young, SwRI ;- pro wr_2_positionv, datestr, set deg = !dpi/180.d arcsec = deg / 3600.d format1 = '("# set number ", I3, " ", A-12, F8.3, " seconds")' forms = '(A5," ", A-12," ", A-7," : ", A1," / ",A1," ", A7, ",",A7, " ", A7, ",",A7, ",",A7, " ", A10, A10)' formp = '(I5, " ",A-12," ", A-7," : ", I1," / ",I1," ", F7.3,",",F7.3," ", F7.3,",",F7.3,",",F7.3, " ",A10, A10)' fn = 'tables/'+datestr+'_2_positionv_'+string(set.setno, form='(I03)')+'.txt' openw, lun, fn, /get_lun !textunit = lun printf, lun, set.setno, set.object, set.itime, $ format = format1 printf, lun, 'Frame', 'OBJECT', 'PATTERN','i','N', 'XOFFSET', 'YOFFSET', 'EAST', 'NORTH', 'D', 'POSITION', 'OVERRIDE', $ format=forms foo = rdsetv(datestr, set.framenum0, set.n, h, /nodata, object=object, $ targra=targra, targdec=targdec, ra=ra, dec=dec, $ xoffset=xoffset, yoffset=yoffset, $ dpatipos=dpatipos, dpatnpos=dpatnpos, dpatname=dpatname) framenum = set.framenum0 + lindgen(set.n) rd2xieta, targra*deg, targdec*deg, ra*deg, dec*deg, xi,eta d = sqrt(xi^2+eta^2)/arcsec if strtrim(dpatname[0],2) eq 'ABBA' then begin beam = (['ABEAM','BBEAM'])[yoffset lt 0] endif else begin beam = (['CENTER','SKY'])[sqrt(xi^2+eta^2) gt 8.*arcsec] endelse forprint, framenum, object, dpatname, dpatipos, dpatnpos, xoffset, yoffset, xi/arcsec, eta/arcsec, d, beam, beam, $ format=formp, textout = 5, /nocomment close, lun & free_lun, lun end