pro qGlitch_Run, state, event @compile_opt.pro ; On error, return to caller ;+ ; NAME: ; qGlitch_Run ; PURPOSE: ; Search for glitches through an image cube ; CATEGORY: ; Widget qGlitch ; CALLING SEQUENCE: ; qGlitch_Run, state, event ; INPUTS: ; state array[1]; type: structure ; qGlitch state structure ; OUTPUTS: ; (none) ; CALLS: ; qGlitch_Show, Find2DGlitch, Inside_Wedge, smei_camera, destroyvar, gridgen ; BadValue ; SIDE EFFECTS: ; RESTRICTIONS: ; Find2DGlitch is incredibly memory intensive .... ; PROCEDURE: ; The call to Find2DGlitch is set up using values from the qGlitch widgets. ; The output of Find2DGlitch is passed to qGlitch_Show for display. ; STATE INFO USED: ; widget_control, state.wid_frames , get_uvalue=frames, /no_copy ; widget_control, state.wid_sum , get_value = SumWidth ; widget_control, state.wid_spot , get_value = SpotWidth ; widget_control, state.wid_sigma , get_value = SigmaThreshold ; widget_control, state.wid_min , get_value = MinThreshold ; widget_control, state.wid_exclude, get_uvalue= exclude ; widget_control, state.wid_remove , get_uvalue= remove ; widget_control, state.wid_qimage_cw, get_uvalue=mask_smei_fov ; STATE INFO MODIFIED: ; widget_control, state.wid_sigma , set_uvalue=Loc , /no_copy ; widget_control, state.wid_frames , set_uvalue=frames, /no_copy ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- widget_control, state.wid_frames , get_uvalue=frames, /no_copy sz = size(frames) widget_control, state.wid_exclude, get_uvalue= exclude widget_control, state.wid_remove , get_uvalue= remove widget_control, state.wid_sum , get_value = SumWidth widget_control, state.wid_spot , get_value = SpotWidth widget_control, state.wid_sigma , get_value = SigmaThreshold widget_control, state.wid_min , get_value = MinThreshold widget_control, state.wid_qimage_cw, get_uvalue=mask_smei_fov widget_control, /hourglass if mask_smei_fov eq 1 then begin wid_child = widget_info(state.wid_qimage_cw, /child) widget_control, wid_child, get_uvalue=qimage_cw_state, /no_copy img_offset = qimage_cw_state.img_offset widget_control, wid_child, set_uvalue=qimage_cw_state, /no_copy r = cv_coord(from_rect=gridgen(sz[1:2], origin=SMEI_camera(/get_center)-img_offset), /to_polar) ; r = where( Inside_Wedge(SMEI_camera(/get_fov_limits), r)) r = where(1-Inside_Wedge(SMEI_camera(/get_fov_limits), r)) if r[0] eq -1 then $ mask_smei_fov = 0B $ else begin ; The mask is applied to each image r = (sz[1]*sz[2]*lindgen(sz[3]))#replicate(1,n_elements(r))+replicate(1,sz[3])#r r = reform(r, n_elements(r), /overwrite) frames = float(frames) save_mask = frames[r] frames[r] = BadValue(frames) endelse endif nLoc = Find2DGlitch(frames, sumwidth=SumWidth, spotwidth=SpotWidth, $ sigmathreshold=SigmaThreshold, minthreshold=MinThreshold, exclude=Exclude, remove=Remove,$ loc=Loc, /group, ngroup=nGroup, pgroup=pGroup, lgroup=lGroup, fgroup=fGroup, /quiet) if mask_smei_fov eq 1B then begin frames[r] = save_mask frames = round(frames) destroyvar, r, save_mask endif widget_control, state.wid_sigma , set_uvalue=Loc , /no_copy widget_control, state.wid_frames , set_uvalue=frames, /no_copy if nGroup gt 0 then qGlitch_Show, state, nGroup, pGroup, lGroup, fGroup return & end