pro argus_23swap,INfile ;; ;;D.T.Frayer 2018.10.30 ;; ;;Swapping the RA and DEC positions for Argus beam 2 and 3 due to ;;cable mis-match for Argus data taken before 2018.10.22 19:30 UT ;; ;;This program assumes input is SDFITS files ;;where scan and integration numbers are in the exact same order ;;between beams. If this is not the case or not sure, then should ;;loop through unqiue scan numbers and integration numbers and ;;replace individual records which would be much slower. ;; ;;INfile = input SDFITS file ;; ;;read in data extension rows=mrdfits(INfile,1,hdr1) ;;read in extensition 0 ext0=mrdfits(INfile,0,hdr0) ;; ;;use help to figure out input data structure if needed ;help,rows,/struct ;; ra=rows.crval2 dec=rows.crval3 feed=rows.feed idx2=where(feed eq 2) idx3=where(feed eq 3) raout=ra decout=dec ;;swap positions for feed 2 and 3 raout[idx2]=ra[idx3] raout[idx3]=ra[idx2] decout[idx2]=dec[idx3] decout[idx3]=dec[idx2] ;;replace data rows.crval2=raout rows.crval3=decout ;;Produce output file matching structure of input OUTfile='swap23_'+INfile ;;write out data mwrfits,ext0,OUTfile,hdr0,/Create mwrfits,rows,OUTfile,hdr1 return end