; docformat = 'rst' ; ; NAME: ; AstroIM ; PURPOSE: ; AstroIM is a simple graphical interface to the suite of tools ; redIM and binarIM. ; ;+ ; :Description: ; AstroIM is a simple graphical interface to the suite of tools ; RedIM and BinarIM. ; ; :Categories: ; AstroIM ; ; :Params: ; root: in, optional, type=string ; The path to the root directory containing all the observing nights. ; ; :Examples: ; Default launcher:: ; IDL> AstroIM ; Launch AstroIM using /observ as root directory:: ; IDL> AstroIM, '/observ/' ; ; :Uses: ; redIM, binarIM ; ; :Author: ; B.Carry (IMCCE) ; ; :History: ; Change History:: ; Written in January 2014, B. Carry (IMCCE) ; 2014-Mar.: B.Carry (IMCCE) - ; ;- pro AstroIM, root ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden ;--I.1-- Set IDL to Local Working Environment ----------------------------------------- ;--I.1.1-- Loading Default Configurations confAstroIM= initIDL() confRedim = initIDL(confAstroIM.soft.redim, /REDIM) confBinary= initIDL(confAstroIM.soft.binary, /BINARY) help, confRedim, /stru ;--I.1.2-- Set Device Size screen = get_screen_size() print, screen winSize = [1200,800] print, 'todo: set winsize according to screen' ;/usr/local/exelis/idl/examples/doc/widgets ;--I.2-- Common Variables for Dialog -------------------------------------------------- common commonAstroIM, cPath, cTask, cConf ;--I.2.1-- Directories if keyword_set(root) then root=strtrim(root,2) else root=confAstroIM.path.root spawn, 'ls -d '+root+'/????-*/', dir nbNight = n_elements(dir) for k=0, nbNight-1 do dir(k) = strmid(dir(k),strlen(root),strlen(dir(k))-strlen(root)-1) cPath={root: root, $ ;-Root directory dir: ptr_new(/ALLOC), $ ;-Sub-directories night: ptr_new(/ALLOC) } ;-List of observing night to analyze *cPath.dir = dir ;--I.2.2-- List of Tasks cTask={cal: intarr(3), $ ;-DO median / mask / calibration sci: intarr(2), $ ;-DO clean / align sat: intarr(2) } ;-DO coronography / astrometry ;--I.X-- xxxxxxxxxxxxxxxxxxxxxx -------------------------------------------------------- borderPix=2 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Definition/Organization of Widgets -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- General Window --------------------------------------------------------------- base = widget_base( /ROW, TITLE='AstroIM', xsize=winSize(0), ysize=winSize(1) ) ;--II.2-- Main Columns ----------------------------------------------------------------- colData = widget_base( base, /COL, xsize=0.95*winSize(0)/3., frame=borderPix ) colConf = widget_base( base, /COL, xsize=1.95*winSize(0)/3., frame=borderPix ) ;--II.3-- Root, Night Selection Section ------------------------------------------------ panelRoot = widget_base( colData, /ROW, frame=borderPix ) rootText = widget_text( panelRoot, value=cPath.root ) rootBuMod= widget_button(panelRoot, VALUE='Browse') rootBuRef= widget_button(panelRoot, VALUE='Refresh') panelNight = widget_base( colData, /COL, frame=borderPix, YSIZE=0.8*winSize(1) ) nightList = cw_bgroup(panelNight, *cPath.dir, /COL, /NONEXCLUSIVE, /SCROLL, $ X_SCROLL_SIZE=0.8*winSize(0)/3., $ Y_SCROLL_SIZE=0.8*winSize(1)) panelRun = widget_base( colData, /ROW, frame=borderPix ) runBuRun = widget_button(panelRun, VALUE='Run') runBuQuit= widget_button(panelRun, VALUE='Quit') ;--II.4-- Parameters Definition Section ------------------------------------------------ panelParam = widget_tab( colConf ) tabBadPix = widget_base(panelParam, TITLE='Bad Pixels', /ROW) tabFringe = widget_base(panelParam, TITLE='Fringes', /COL) tabStripe = widget_base(panelParam, TITLE='Stripes', /COL) tabClean = widget_base(panelParam, TITLE='Reduction', /COL) tabAlign = widget_base(panelParam, TITLE='Alignment', /ROW) ;--II.4.1-- Bad-Pixels Parameters -------------------------------------------------------- tabBadPixLeft = widget_base(tabBadPix, /COL, frame=1) tabBadPixRight= widget_base(tabBadPix, /COL, frame=1) bdCleanBase = widget_base(tabBadPixLeft, /ROW) bpCleanT = widget_label( bdCleanBase, value='Clean bad pixels?' ) bpCleanF = cw_bgroup( bdCleanBase, ['Yes','No'], set_value=1-confRedim.mask.yn, /ROW, /EXCLUSIVE) bdHotBase = widget_base(tabBadPixLeft, /ROW) bpHotT = widget_label( bdHotBase, value='Threshold for hot pixels: ' ) bpHotF = widget_text( bdHotBase, value=strtrim(string(confRedim.mask.s(0)),2), /EDIT ) bdDeadBase = widget_base(tabBadPixLeft, /ROW) bpDeadT = widget_label( bdDeadBase, value='Threshold for dead pixels: ' ) bpDeadF = widget_text( bdDeadBase, value=strtrim(string(confRedim.mask.s(1)),2), /EDIT ) bdWidthBase = widget_base(tabBadPixLeft, /ROW) bpWidthT = widget_label( bdWidthBase, value='Window width: ' ) bpWidthF = widget_text( bdWidthBase, value=strtrim(string(confRedim.mask.w,format='(I)'),2), /EDIT ) bdUserBase = widget_base(tabBadPixRight, /ROW) bpUserT = widget_label( bdUserBase, value='User cuts from File? ' ) bpUserF = cw_bgroup( bdUserBase, ['Yes','No'], set_value=1-confRedim.mask.u, /ROW, /EXCLUSIVE) bdFileBase = widget_base(tabBadPixRight, /ROW) bpFileT = widget_label( bdFileBase, value='File: ' ) bpFileF = widget_text( bdFileBase, value=strtrim(confRedim.mask.f,2), /EDIT ) ;--II.4.2-- Fringes Parameters ----------------------------------------------------------- fYnBase = widget_base(tabFringe, /ROW) fYnT = widget_label( fYnBase, value='Clean fringes?' ) fYnF = cw_bgroup( fYnBase, ['Yes','No'], set_value=1-confRedim.fringe.yn, /ROW, /EXCLUSIVE) fCpBase = widget_base(tabFringe, /ROW) fCpT = widget_label( fCpBase, value='Control point file: ' ) fCpF = widget_text( fCpBase, value=strtrim(string(confRedim.fringe.cp),2), /EDIT ) ;--II.4.3-- Stripes Parameters ----------------------------------------------------------- sYnBase = widget_base(tabStripe, /ROW) sYnT = widget_label( sYnBase, value='Clean stripes?' ) sYnF = cw_bgroup( sYnBase, ['Yes','No'], set_value=1-confRedim.stripe.yn, /ROW, /EXCLUSIVE) sDirBase = widget_base(tabStripe, /ROW) sDirT = widget_label( sDirBase, value='Stripes direction: ' ) sDirVal = [ strcmp(confRedim.stripe.dir,'hor',3,/fold) or strcmp(confRedim.stripe.dir,'bot',3,/fold), $ strcmp(confRedim.stripe.dir,'ver',3,/fold) or strcmp(confRedim.stripe.dir,'bot',3,/fold) ] sDirF = cw_bgroup( sDirBase, ['Horizontal','Vertical'], set_value=sDirVal, /ROW, /NONEXCLUSIVE) sModeBase = widget_base(tabStripe, /ROW) sModeT = widget_label( sModeBase, value='Cleaning mode:' ) if strcmp(confRedim.stripe.mode,'fine',/fold) then sModeVal=1 else sModeVal=0 sModeF = cw_bgroup( sModeBase, ['Median','Fine'], set_value=sModeVal, /ROW, /EXCLUSIVE) sSampBase = widget_base(tabStripe, /ROW) sSampT = widget_label( sSampBase, value='Sample size:' ) sSampF = widget_text( sSampBase, value=strtrim(string(confRedim.stripe.samp),2), /EDIT ) sCosmBase = widget_base(tabStripe, /ROW) sCosmT = widget_label( sCosmBase, value='Cosmic threshold:' ) sCosmF = widget_text( sCosmBase, value=strtrim(string(confRedim.stripe.cosmic),2), /EDIT ) ;--II.4.4-- Reduction Parameters --------------------------------------------------------- cTargetBase = widget_base(tabClean, /ROW) cTargetT = widget_label( cTargetBase, value='Target:' ) cTargetF = widget_text( ctargetBase, value=strtrim(string(confRedim.sci.target),2), /EDIT ) cFiltBase = widget_base(tabClean, /ROW) cFiltT = widget_label( cFiltBase, value='Filter:' ) cFiltF = widget_text( cfiltBase, value=strtrim(string(confRedim.sci.filter),2), /EDIT ) cSerBase = widget_base(tabClean, /ROW) cSerT = widget_label( cSerBase, value='Starting Serie:' ) cSerF = widget_text( cSerBase, value=strtrim(string(confRedim.sci.Serie),2), /EDIT ) cFlatBase = widget_base(tabClean, /ROW) cFlatT = widget_label( cFlatBase, value='Type of Flat:' ) if strcmp(confRedim.sci.flat,'sky',/fold) then cFlatVal=1 else cFlatVal=0 cFlatF = cw_bgroup( cFlatBase, ['Dome','Sky'], set_value=cFlatVal, /ROW, /EXCLUSIVE) cSkyBase = widget_base(tabClean, /ROW) cSkyT = widget_label( cSkyBase, value='Sky evaluation:' ) case strlowcase(confRedim.sci.sky) of 'dark' : cSkyVal=0 'median': cSkyVal=1 'fine' : cSkyVal=2 endcase cSkyF = cw_bgroup( cSkyBase, ['Dark','Median', 'Fine'], set_value=cSkyVal, /ROW, /EXCLUSIVE) ;--II.4.5-- Alignment Parameters --------------------------------------------------------- tabAlignLeft = widget_base(tabAlign, /COL, frame=1) tabAlignRight= widget_base(tabAlign, /COL, frame=1) alignBase = widget_base(tabAlignLeft, /ROW) alignT = widget_label( alignBase, value='Create co-added frame?' ) alignF = cw_bgroup( alignBase, ['Yes','No'], set_value=1-confRedim.align.coadd, /ROW, /EXCLUSIVE) alRefBase = widget_base(tabAlignLeft, /ROW) alRefT = widget_label( alRefBase, value='Reference frame ID:' ) alRefF = widget_text( alRefBase, value=strtrim(string(confRedim.align.refID),2), /EDIT ) alSizeBase = widget_base(tabAlignLeft, /ROW) alSizeT = widget_label( alSizeBase, value='Size of output frames (pix): ' ) alSizeF = widget_text( alSizeBase, value=strtrim(string(confRedim.align.size),2), /EDIT ) alMarginBase = widget_base(tabAlignLeft, /ROW) alMarginT = widget_label( alMarginBase, value='Margin for shifting (%): ' ) alMarginF = widget_text( alMarginBase, value=strtrim(string(confRedim.align.margin),2), /EDIT ) guiSizeBase = widget_base(tabAlignRight, /ROW) guiSizeT = widget_label( guiSizeBase, value='Size of the GUI (pix):' ) guiSizeF = widget_text( guiSizeBase, value=strtrim(string(confRedim.align.gui.size),2), /EDIT ) guiMinBase = widget_base(tabAlignRight, /ROW) guiMinT = widget_label( guiMinBase, value='Minimum ADU to display:' ) guiMinF = widget_text( guiMinBase, value=strtrim(string(confRedim.align.gui.min),2), /EDIT ) guiMaxBase = widget_base(tabAlignRight, /ROW) guiMaxT = widget_label( guiMaxBase, value='Maximum ADU to display:' ) guiMaxF = widget_text( guiMaxBase, value=strtrim(string(confRedim.align.gui.max),2), /EDIT ) ;--II.5-- Choose Task Buttons ---------------------------------------------------------- panelTask = widget_base( colConf, COL=3 ) panelSubTask1 = widget_base( colConf, xsize=winSize(0)/4. ) panelSubTask2 = widget_base( colConf, xsize=winSize(0)/4. ) panelSubTask3 = widget_base( colConf, xsize=winSize(0)/4. ) taskBuCal = cw_bgroup(panelSubTask1, ['Median', 'Mask', 'Calib'], /COL, /NONEXCLUSIVE) taskBuSci = cw_bgroup(panelSubTask2, ['Reduc', 'Align'], /COL, /NONEXCLUSIVE) taskBuSat = cw_bgroup(panelSubTask3, ['Coronography', 'Astrometry'], /COL, /NONEXCLUSIVE) ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Realize Widgets and Set Main Structures -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Realization WIDGET_CONTROL, base, /REALIZE ;--III.2-- Put all IDs in a structure node = { b: { path: {mov: rootBuMod, $ ref: rootBuRef}, $ action: {run: runBuRun, $ quit: runBuQuit}, $ task: {cal: taskBuCal, $ sci: taskBuSci, $ sat: taskBuSat} }, $ f: {path: {root: rootText, $ dir: nightList, $ night: intarr(nbNight)}, $ conf: {mask: {yn: bpCleanF, $ file: bpFileF, $ user: bpUserF, $ hot: bpHotF, $ dead: bpDeadF, $ width: bpWidthF}, $ fringe: {yn: fYnF, $ cp: fCpF}, $ stripe: {yn: sYnF, $ dir: sDirF, $ mode: sModeF, $ samp: sSampF, $ cosmic: sCosmF} $ } $ } $ } WIDGET_CONTROL, base, SET_UVALUE=node XMANAGER, 'astroim', base end