pro argus_23swapRawSDITS,INc,INd ;; ;;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 raw 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. ;;Beam 2 and Beam 3 data are in different VEGAS banks so need to read ;;in the C and D bank VEGAS files (INc and INd) ;;e.g., ;INc=/home/sdfits/AGBT17B_151_01/AGBT17B_151_01.raw.vegas/AGBT17B_151_01.raw.vegas.C.fits' ;INd=/home/sdfits/AGBT17B_151_01/AGBT17B_151_01.raw.vegas/AGBT17B_151_01.raw.vegas.D.fits' ;;read in data extensions crows=mrdfits(INc,1,hdrc1) drows=mrdfits(INd,1,hdrd1) ;;read in extensition 0 cext0=mrdfits(INc,0,hdrc0) dext0=mrdfits(INd,0,hdrd0) ;; ;;use help to figure out input data structure if needed ;help,rows,/struct ;; ;;Beam-3 is in C Bank and Beam-2 is in D Bank rac=crows.crval2 decc=crows.crval3 feedc=crows.feed ;; rad=drows.crval2 decd=drows.crval3 feedd=drows.feed idx2=where(feedd eq 2) idx3=where(feedc eq 3) raoutc=rac decoutc=decc raoutd=rad decoutd=decd ;;swap positions for feed 2 and 3 raoutc[idx3]=rad[idx2] raoutd[idx2]=rac[idx3] decoutc[idx3]=decd[idx2] decoutd[idx2]=decc[idx3] ;;replace data drows.crval2=raoutc drows.crval3=decoutc crows.crval2=raoutd crows.crval3=decoutd ;;Produce output file matching structure of input ;;write out data mwrfits,cext0,'NEWc.fits',hdrc0,/create mwrfits,crows,'NEWc.fits',hdrc1 mwrfits,dext0,'NEWd.fits',hdrd0,/create mwrfits,drows,'NEWd.fits',hdrd1 return end