root='/data/vlt/87_Sylvia/' targetBDD='87_Sylvia' nights=[$; '20170708/red', $ $; '20170710/Red', $ $; '20170722/Red', $ '20181015_1/red',$ '20181015_2/red',$ '20181019/red',$ '20181112_1/red',$ '20181112_2/red',$ '20181125/red',$ '20181126/red',$ '20181129/red' ] nbNight=n_elements(nights) doCent= 0 doDC = 01 confAstroIM= initIDL() confRedim = initIDL(confAstroIM.soft.binary, /REDIM ) confBinary = initIDL(confAstroIM.soft.binary, /BINARY) dcINFO = {mode: confBinary.mode, $ ;-Coronography Mode radius: confBinary.radius, $ ;-Maximum search radius bin: confBinary.bin, $ ;-Radial size of the DC annulii sample: confBinary.sample, $ ;-Number of sample to interpolate the intersection ring/pixel step: {flux: confBinary.step.flux,$ ;-Default step in flux for halo evaluation (% of primary peak) radius: confBinary.step.radius} } ;-Default step in radius for halo evaluation (pixel) for kN=0, nbNight-1 do begin spawn, 'ls -1 '+root+nights[kN]+'/*fits', files nbFile=n_elements(files) dirCSV = root+nights[kN]+'/csv/' dirDC = root+nights[kN]+'/dc/' if not file_test( dirCSV, /Dir ) then file_mkdir, dirCSV if not file_test( dirDC, /Dir ) then file_mkdir, dirDC for kF=0, nbFile-1 do begin if doCent eq 1 then begin ;-name formatting split=strSplit(files[kF],'/',/Extract) nameCSV = dirCSV+strMid( split[-1], 0, strLen(split[-1])-4)+'csv' ;-click to get center of object im=readfits( files[kF], h, /Silent ) XY = grabXY( im, subframe=64, /peak2D, win=1024 ) ;-export center to a file forprint, xy[0],xy[1],format='(F9.4,",",F9.4)',/Silent, comment='X,Y', textout=nameCSV endif if doDC eq 1 then begin ;-name formatting split=strSplit(files[kF],'/',/Extract) rootName = strMid( split[-1], 0, strLen(split[-1])-5) nameCSV = dirCSV+rootName+'.csv' nameFig = rootName nameDC = dirDC+rootName+'-DC.fits' nameCorono1 = dirDC+rootName+'-Corono1.fits' nameCorono2 = dirDC+rootName+'-Corono2.fits' nameCorono3 = dirDC+rootName+'-Corono3.fits' ;--get center readcol, nameCSV, xC, yC,format='(F9.4,F9.4)',delimiter=',', /Silent ;-read image image=readfits( files[kF], hImage, /Silent ) dims = size(image) ;--III.3-- Analyze Flux Halo -------------------------------------------------------- haloINFO = findHalo( image, mode=dcINFO.mode, $ targetINFO={X:xc[0], Y:yc[0], head:hImage}, $ dcINFO=dcINFO, quickDC=DC, $ figINFO={dir:dirDC, name:nameFig} ) ;--III.4-- Self-Substract Halo ------------------------------------------------------ if ~strCmp(dcINFO.mode,'quick',/fold) then $ DC = subtractHalo( image, mode=dcINFO.mode, quickDC=DC, $ haloINFO=haloINFO, dcINFO=dcINFO ) ;--III.5-- Write Result on Disk ----------------------------------------------------- filter=getCameraFilter(hImage) sxaddpar, hImage, 'PRIM-X', haloINFO.pos.X, ' Primary X position (pix)', before='HISTORY' sxaddpar, hImage, 'PRIM-Y', haloINFO.pos.Y, ' Primary Y position (pix)', after='PRIM-X' sxaddpar, hImage, 'PRIM-DX', haloINFO.pos.dX, ' Uncertainty on primary X position (pix)', after='PRIM-Y' sxaddpar, hImage, 'PRIM-DY', haloINFO.pos.dY, ' Uncertainty on primary Y position (pix)', after='PRIM-DX' sxaddpar, hImage, 'PRIM-F', haloINFO.flux.val,' Primary total flux', after='PRIM-DY' sxaddpar, hImage, 'PRIM-dF', haloINFO.flux.unc,' Uncertainty on primary total flux', after='PRIM-F' CHECK_FITS, DC, hImage, /UPDATE, /SILENT writefits, nameDC, DC, hImage ;--III.6-- Special Output, Cleaned from Keywords, For AudeLa ------------------------ hBDD = genoidHeaderBDD(DC[*,*,1], hImage, targetBDD, type='CORONO1' ) CHECK_FITS, DC[*,*,1], hBDD, /Update, /Silent writefits, nameCorono1, DC[*,*,1], hBDD hBDD = genoidHeaderBDD(DC[*,*,2], hImage, targetBDD, type='CORONO2' ) CHECK_FITS, DC[*,*,2], hBDD, /Update, /Silent writefits, nameCorono2, DC[*,*,2], hBDD hBDD = genoidHeaderBDD(DC[*,*,3], hImage, targetBDD, type='CORONO3' ) CHECK_FITS, DC[*,*,3], hBDD, /Update, /Silent writefits, nameCorono3, DC[*,*,3], hBDD endif endfor endfor end