PRO hsi_snooper, MAKE_RDB = make_rdb, SHOW_IMAGES=show_images, $ START_DATE_CODE = start_date_code ; ; OK, go through all the hsi exposures and count the number ; of events in the central tile and in the depressed region... ; /MAKE_RDB creates rdb files ( hsi_snoop_[date_code].rdb ) ; containing the counts information from the runids. ; /SHOW_IMAGES will create plots of events in the central tile ; to keep operator ammused. ; START_DATE_CODE = '970117' will skip over earlier data ; ; Setup where the data come from data_prefix = !DDHXDSDATA+'/phase1/data/' ; where to put the rdb output files keep_em_dir = !DDHETGCAL+'/cmp/hsi_snoop' if n_elements(START_DATE_CODE) EQ 0 then start_date_code = '961201' print, '' print, ' HSI Snooper (Starting at '+start_date_code+')' print, '' ; Define the central tile: ytmin = 1920. ytmax = 2180. ztmin = 1920. ztmax = 2180. ; and the depressed region dwidth = 40.0 ydmin = 2046.7 - dwidth/2 ydmax = 2046.7 + dwidth/2 zdmin = 2045.5 - dwidth/2 zdmax = 2045.5 + dwidth/2 ; Loop through the date codes for iy = 96,97 do begin mstart = 12 mstop = 12 if iy EQ 97 then begin mstart = 1 mstop = 2 end for im = mstart, mstop do begin for id=1, 31 do begin month_str = STRCOMPRESS(im,/REMOVE_ALL) if STRLEN(month_str) EQ 1 then month_str = '0'+month_str day_str = STRCOMPRESS(id,/REMOVE_ALL) if STRLEN(day_str) EQ 1 then day_str = '0'+day_str date_code = STRCOMPRESS(iy,/REMOVE_ALL) + month_str + day_str ;- - - - - Make the rdb file for this date code... if KEYWORD_SET(MAKE_RDB) AND (date_code GE start_date_code) then begin print, ' Checking in ['+date_code+']' hsi_files = findfile(data_prefix+date_code+'/hsi*.fits', COUNT=n_files) print, ' found: ', n_files ; Setup a structure for the results from this date code ; it's small so make it big enough... (1440 iterations in a day!?!) snoop = REPLICATE({mst_date:date_code, run_id:'', iteration:'0', $ c_total:0L, c_tile:0L, c_depress:0L}, 1440) ; and loop over the files for iff=0,n_files-1 do begin ; set the run_id and iteration run_id = strmid(hsi_files(iff), 4 + $ strpos(hsi_files(iff),'/hsi'), 6) snoop(iff).run_id = run_id it_temp = strmid(hsi_files(iff), 11 + $ strpos(hsi_files(iff),'/hsi'), 80) iteration = strmid(it_temp, 0, $ strlen(it_temp) -5) snoop(iff).iteration = iteration ; now read it in! hsi_data = 0 ; catch some problem files... if run_id GE '106720' AND $ NOT(run_id EQ '107015') AND $ NOT(run_id EQ '107016') AND $ NOT(run_id EQ '107027') AND $ NOT(run_id EQ '107028') AND $ NOT(run_id EQ '107038') AND $ NOT(run_id EQ '108992') AND $ NOT(run_id EQ '108996') AND $ NOT(run_id EQ '109632') AND $ NOT(run_id EQ '110035') AND $ NOT(run_id EQ '110036') AND $ NOT(run_id EQ '110103') AND $ NOT(run_id EQ '110168') AND $ NOT(run_id EQ '110207') AND $ NOT(run_id EQ '110224' AND iteration EQ '6') AND $ NOT(run_id EQ '110281') AND $ NOT(run_id EQ '110599') AND $ NOT(run_id EQ '110600') AND $ NOT(run_id EQ '110694') AND $ NOT(run_id EQ '110942' AND iteration EQ '2') AND $ NOT(run_id EQ '110942' AND iteration EQ '3') AND $ NOT(run_id EQ '111156') AND $ NOT(run_id EQ '111253') AND $ NOT(run_id EQ '107010') then begin hsi_data = mrdfits(hsi_files(iff),1) end ; and set the count values if there is data ; THe values default to 0.0 if n_elements(hsi_data) GE 2 then begin ; Total snoop(iff).c_total = n_elements(hsi_data) ; Tile dummy = where( hsi_data.Y GT ytmin AND $ hsi_data.Y LT ytmax AND $ hsi_data.Z GT ztmin AND $ hsi_data.Z LT ztmax, n_found ) snoop(iff).c_tile = n_found ; watch what is happening! if n_found GT 1 and KEYWORD_SET(SHOW_IMAGES) then begin plot, hsi_data(dummy).Y, hsi_data(dummy).Z, PSYM=3, $ XRANGE=[ytmin, ytmax], XSTYLE=1, $ YRANGE=[ztmin, ztmax], YSTYLE=1 ; show the depression region to oplot, [ydmin,ydmax], [zdmin,zdmin] oplot, [ydmin,ydmax], [zdmax,zdmax] oplot, [ydmin,ydmin], [zdmin,zdmax] oplot, [ydmax,ydmax], [zdmin,zdmax] end ; Depressed Region dummy = where( hsi_data.Y GT ydmin AND $ hsi_data.Y LT ydmax AND $ hsi_data.Z GT zdmin AND $ hsi_data.Z LT zdmax, n_found ) snoop(iff).c_depress = n_found end end ; iff ; save the rdb file if there are any entries in it if n_files GT 0 then begin ; keep only the valid lines snoop = snoop(0:n_files-1) rdb_write, keep_em_dir+'/hsi_snoop_'+date_code+'.rdb', snoop end end ; of make rdb ; - - - - - - - - - end ; id end ; im end ; iy RETURN END