PRO INSPECT_CHECK,parent,files,flag desc = [ '1\Inspect Data' , $ '0\Image' , $ '0\Residual' , $ '0\Limb' , $ '2\Flatfield' , $ '0\Accept Data',$ '0\Cancel'] ;----- create the widget base = WIDGET_BASE(GROUP_LEADER=parent,/ALIGN_CENTER,$ TITLE='Inspect/Accept Data',ROW=1) menu = CW_PDMENU(base, desc, /RETURN_FULL_NAME) WIDGET_CONTROL, /REALIZE, base ;----- provide a simple event handler REPEAT BEGIN ev = WIDGET_EVENT(base) IF ev.value EQ 'Inspect Data.Image' THEN BEGIN SPAWN,'xv '+files(0)+'&',dum ev.value='' ENDIF IF ev.value EQ 'Inspect Data.Residual' THEN BEGIN SPAWN,'xv '+files(1)+'&',dum ev.value='' ENDIF IF ev.value EQ 'Inspect Data.Limb' THEN BEGIN SPAWN,'xv '+files(2)+'&',dum ev.value='' ENDIF IF ev.value EQ 'Inspect Data.Flatfield' THEN BEGIN SPAWN,'xv '+files(3)+'&',dum ev.value='' ENDIF IF ev.value EQ 'Accept Data' THEN BEGIN flag='Yes' GOTO,ende ENDIF IF ev.value EQ 'Cancel' THEN BEGIN flag='No' GOTO,ende ENDIF ENDREP UNTIL ev.value EQ 'Exit' ende: WIDGET_CONTROL,/DESTROY,base END PRO ha_check, wid ;+ ; NAME: ; HA_CHECK ; ; PURPOSE: ; Check if all images obtained with the KX4 camera are containing the ; Sun. Non-solar images are moved to a temporary directory where they ; can be deleted. ; ; This program is called by ARCHIVE_TOOL.PRO. ; ; CATEGORY: ; KSO Archiving System. ; Image Processing. ; ; CALLING SEQUENCE: ; HA_CHECK, wid, date ; ; INPUTS: ; WID: widget ID ; ; OUTPUTS: ; Images not containing the Sun are first written to a temporary archive ; and are then deleted. ; ; KEYWORDS: ; None. ; ; MODIFICATION HISTORY: ; 2000-04-24: Michael Steinegger, BBSO/NJIT ; ;- start = SYSTIME( 1 ) ;path = {DIR: '/home/kx4_data/synoptic/', $ ; TMP: '/arch1/halpha_tmp/', $ ; RED: 8 } ;----- for testing: path = { DIR: '/home/tracker/michael/fulldisk/testdata/orig_data/', $ TMP: '/home/tracker/michael/fulldisk/testdata/tmp_data/',$ RED: 8 } WIDGET_CONTROL, wid.t1, /APPEND, SET_VALUE = [' Check images in '+path.dir,''] WIDGET_CONTROL, wid.d1, GET_VALUE = index WSET, index ERASE ;----- create image file list SPAWN, 'ls -1 ' + path.dir + '*.fts', file pos=STRPOS(file,'.fts') wo=WHERE(pos ne -1) IF wo(0) eq -1 THEN BEGIN WIDGET_CONTROL, wid.t1, /APPEND, SET_VALUE=['',$ ' ERROR: DIRECTORY DOES NOT CONTAIN FTS FILES',' ',$ ' TERMINATED',' '] WSET, index READ_JPEG, 'kso.jpg', img TV, img, TRUE = 1 RETURN ENDIF file=file(wo) m = 0 n = n_elements(file) flag=intarr(n) ;----- read images and check them WIDGET_CONTROL, wid.t1, /APPEND,SET_VALUE=['',$ ' Check '+STRCOMPRESS(STRING(n),/REMOVE_ALL)+' images:'] FOR i=0,n-1 DO BEGIN WIDGET_CONTROL, wid.t1, /APPEND, SET_VALUE=' Image '+$ STRCOMPRESS(STRING(i+1),/REMOVE_ALL)+': '+file(i) tmp = ( READFITS ( file( i ), fhdr, /SILENT) ) cen = median(tmp(1000:1100,1000:1100)) c1 = median(tmp(100:200,100:200)) c2 = median(tmp(1800:1900,1800:1900)) c3 = median(tmp(100:200,1800:1900)) c4 = median(tmp(1800:1900,100:200)) c = mean([c1,c2,c3,c4]) ;----- image is probably a dark image IF cen/c LT 2 THEN BEGIN WIDGET_CONTROL, wid.t1, /APPEND, SET_VALUE=' Probably a dark image!' flag(i)=1 WSET, index TVSCL,congrid(tmp,256,256),m m=m+1 IF m gt 5 then m=0 ENDIF ENDFOR wo=WHERE(flag NE 0) n=N_ELEMENTS(wo) IF wo( 0 ) EQ -1 THEN BEGIN WIDGET_CONTROL, wid.t1, /APPEND, SET_VALUE=['',$ ' ALL IMAGES ARE OKAY',' ',$ ' FINISHED CPU Time: '+STRCOMPRESS(STRING(SYSTIME(1)-start),/REMOVE_ALL),' '] WSET, index READ_JPEG, 'kso.jpg', img TV, img, TRUE = 1 RETURN ENDIF ;----- moving probably bad images to temporary directory WIDGET_CONTROL, wid.t1, /APPEND,SET_VALUE=['',$ ' Move '+STRCOMPRESS(STRING(n),/REMOVE_ALL)+' images to '+path.tmp,''] file=file(wo) FOR i=0,n-1 DO BEGIN WIDGET_CONTROL, wid.t1, /APPEND,SET_VALUE=' Move '+file(i) SPAWN,'mv '+file(i)+' '+path.tmp,dummy ENDFOR WIDGET_CONTROL, wid.t1, /APPEND,SET_VALUE=['',$ ' Please inspect these files before deleting them!'] ;----- show the BBSO image to indicate that we are done WSET, index READ_JPEG, 'kso.jpg', img TV, img, TRUE = 1 ;----- how long did we have to wait? WIDGET_CONTROL, wid.t1, /APPEND, SET_VALUE=['',$ ' FINISHED CPU Time: '+STRCOMPRESS(STRING(SYSTIME(1)-start),/REMOVE_ALL),' '] RETURN END