root='/data/vlt/87_Sylvia/' dirBDD = root+'for-bdd/' dir=[ $ '2017-07-10', $ '2017-07-22', $ '2018-10-15', $ '2018-10-19', $ '2018-11-12', $ '2018-11-25', $ '2018-11-26', $ '2018-11-29' ] nD = n_elements(dir) for kD=0, nD-1 do begin spawn, 'ls -1 '+dir[kD]+'/satellite/*DC*fits', list nF=n_elements(list) print, kd+1, nD, dir[kd], format='("--- ",I2,"/",I2," -- ",A-10," ------------------------------")' for kF=0, nF-1 do begin nameDC = list[kF] split = strSplit(nameDC,'/',/Extract) rName = strMid(split[-1], 0, strLen(split[-1])-7) locDir= strMid(nameDC, 0, strLen(nameDC)-strLen(split[-1])) nameIm = rName+'Image.fits' nameC1 = rName+'Corono1.fits' nameC2 = rName+'Corono2.fits' nameC3 = rName+'Corono3.fits' print, kF+1, nF, nameIm, format='(I2,"/",I2,2x,A-30)' ; print, nameDC ; print, nameIm ; print, nameC1 ; print, nameC2 ; print, nameC3 ;--- read DC & header from Corono3 dc=readfits(nameDC, /Silent) head=headfits(locdir+nameC3) ;--- Write IMAGE sxAddPar, head, 'BIMTYPE', 'IMG', ' Level of image processing' writefits, dirBDD+nameIm, DC[*,*,0], head ;---- Read Image im = readfits( dirBDD+nameIm, head, /Silent ) pix = getCameraPixel(head) dit = getCameraDit(head) eph = sspEphemCC( 87, dit.start, nbd=1 ) ra = eph[0].ra.deg dec = eph[0].dec.deg ; print, ra, dec ; print, sxpar(head, 'RA'), sxpar(head,'DEC') ;stop ;---correct astrometry sxAddPar, head, 'CTYPE1', 'RA---TAN' sxAddPar, head, 'CTYPE2', 'DEC--TAN' sxAddPar, head, 'CD1_1', -pix.resol / 3600. sxAddPar, head, 'CD2_2', pix.resol / 3600. sxAddPar, head, 'CDELT1',-pix.resol / 3600. sxAddPar, head, 'CDELT2', pix.resol / 3600. sxAddPar, head, 'CROTA2', 0 sxAddPar, head, 'PV1_4', 0 sxAddPar, head, 'RADESYS', 'FK5' sxDelPar, head, 'PV1_0' sxDelPar, head, 'PV1_1' sxDelPar, head, 'PV1_2' sxDelPar, head, 'PV1_3' sxDelPar, head, 'PV1_4' sxDelPar, head, 'PV2_1' sxDelPar, head, 'PV2_2' sxDelPar, head, 'RADECSYS' sxAddPar, head, 'PIXSIZE1', pix.size sxAddPar, head, 'PIXSIZE2', pix.size sxAddPar, head, 'XPIXSZ', pix.size sxAddPar, head, 'YPIXSZ', pix.size sxAddPar, head, 'FOCLEN', pix.foclen writefits, dirBDD+nameIm, im, head ;---- Read & update Corono1 c1 = readfits( locDir+nameC1, /Silent ) sxAddPar, head, 'BIMTYPE', 'CORONO1' writefits, dirBDD+nameC1, c1, head ;---- Read & update Corono1 c2 = readfits( locDir+nameC2, /Silent ) sxAddPar, head, 'BIMTYPE', 'CORONO2' writefits, dirBDD+nameC2, c2, head ;---- Read & update Corono1 c3 = readfits( locDir+nameC3, /Silent ) sxAddPar, head, 'BIMTYPE', 'CORONO3' writefits, dirBDD+nameC3, c3, head ;stop endfor endfor end