;+ ; NAME: ; qGlitch_Show ; PURPOSE: ; Display results of a search for glitches through an image cube ; CATEGORY: ; Widget qGlitch ; CALLING SEQUENCE: PRO qGlitch_Show, state, nGroup, pGroup, lGroup, fGroup ; 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) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; ArrayLocation, 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 flip_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