pro qGlitch_Show, state, nGroup, pGroup, lGroup, fGroup @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; qGlitch_Show ; PURPOSE: ; Display results of a search for glitches through an image cube ; CATEGORY: ; Widget qGlitch ; CALLING SEQUENCE: ; qGlitch_Show, state, nGroup, pGroup, lGroup ; INPUTS: ; state array[1]; type: structure ; qGlitch state structure ; nGroup scalar; type: integer ; pGroup array[nGroup]; type: integer ; lGroup array[nGroup]; type: integer ; output from Find2DGlitch (called in qGlitch_Run) ; contains a description of the glitches found. ; fGroup ; OUTPUTS: ; (to qImage_cw compound widget) ; CALLS: ; ArrayLocation, Reset_Colors, qBar ; PROCEDURE: ; The information returned from Find2DGlitch describes the glitches: ; there are nGroup glitches of lGroup pixels. The locations are ; specified in pGroup as indices into the Loc array stored as user ; value to state.wid_frames (also return from Find2DGlitch). ; For each glitch a circle is drawn on an image plane with the ; same size as the images searched for glitches. The image number ; is plotted next to the glitch. ; STATE INFO USED: ; widget_control, state.wid_sigma , get_uvalue=Loc , /no_copy ; widget_control, state.wid_frames, get_uvalue=frames, /no_copy ; STATE INFO MODIFIED: ; widget_control, state.wid_frames, set_uvalue=frames, /no_copy ; widget_control, state.wid_sigma , set_uvalue=Loc , /no_copy ; widget_control, state.wid_qimage_cw, set_value=template ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- widget_control, state.wid_sigma , get_uvalue=Loc , /no_copy widget_control, state.wid_frames, get_uvalue=Frames, /no_copy sz = size(frames) iP = ArrayLocation(Loc, size=sz) fP = Frames[Loc] widget_control, state.wid_frames, set_uvalue=Frames, /no_copy widget_control, state.wid_sigma , set_uvalue=Loc , /no_copy old_device = !D.name catch, ierr ; Don't want to get stuck in the Z-buffer if ierr ne 0 then goto, cleanup set_plot, 'Z' device, z_buffering = 0, $ ; Forces zbuffer into 2D mode set_character_size = 1.5*[1,1],$ set_resolution = sz[1:2] ; Set size of z-buffer tv, bytarr(sz[1],sz[2]) erase widget_control, state.wid_done, get_uvalue=img_id if n_elements(img_id) eq 0 then if sz[0] eq 3 then img_id = indgen(sz[3]) else img_id = 0 nc = 361 circle = findgen(nc)/!radeg circle = 5*transpose([[cos(circle)],[sin(circle)]]) color = fix(0.5*[!p.color+!p.background]) for i=0L,nGroup-1 do begin g_pos = iP[0:1,pGroup[i]] if sz[0] eq 2 then g_img = 0 else g_img = iP[2 ,pGroup[i]] tv, [!p.color], g_pos[0], g_pos[1] for j=1,lGroup[i]-1 do tv, [color], iP[0,pGroup[i]+j], iP[1,pGroup[i]+j] plots , /device, g_pos#replicate(1,nc)+circle if sz[0] eq 3 then xyouts, /device, g_pos[0]+8,g_pos[1], strcompress(img_id[g_img], /rem),charsize=10 print, 'CR '+strcompress(i+1)+ $ ' at ['+strcompress(g_pos[0])+','+strcompress(g_pos[1])+']'+ $ ' of frame'+strcompress(img_id[g_img])+' ('+strcompress(lGroup[i])+' pixels)'+ $ ', min'+strcompress(1*min(fP[pGroup[i]:pGroup[i]+lGroup[i]-1]) )+ $ ', max'+strcompress(1*max(fP[pGroup[i]:pGroup[i]+lGroup[i]-1]) )+ $ ', tot'+strcompress(fGroup[i]) endfor template = tvrd() cleanup: catch, /cancel set_plot, old_device reset_colors widget_control, state.wid_qimage_cw, set_value=template if ngroup eq 0 then $ message, /info, 'no glitches detected' $ else $ qBar, fGroup, group=state.wid_run, /histo, xtitle='# ADUs', ytitle='# glitches', charsize=1.5 return & end