;+ ;NAME: ; thm_ui_call_tplot ;PURPOSE: ; A widget interface for calling tplot from the themis_w widget, ; currently of limited usefulness, but expandable ;CALLING SEQUENCE: ; thm_ui_call_tplot, master_widget_id ;INPUT: ; master_widget_id = the id number of the widget that calls this ;OUTPUT: ; none, there are buttons to push for plotting, setting limits, not ; sure what else yet... ;HISTORY: ; 14-dec-2006, jmm, jimm@ssl.berkeley.edu ; ;$LastChangedBy: kenb-mac $ ;$LastChangedDate: 2007-01-26 15:52:34 -0800 (Fri, 26 Jan 2007) $ ;$LastChangedRevision: 241 $ ;$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/thmsoc/trunk/idl/themis/common/thm_ui_call_tplot.pro $ ; ;- Pro thm_ui_call_tplot_event, event @tplot_com ;Put a catch here to insure that the states remain defined err_xxx = 0 catch, err_xxx If(err_xxx Ne 0) Then Begin catch, /cancel message, /info, 'FYI:' help, /last_message, output = err_msg For j = 0, n_elements(err_msg)-1 Do print, err_msg[j] If(is_struct(state)) Then Begin If(is_struct(wstate)) Then $ widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy Endif Return Endif ;start here widget_control, event.id, get_uval = uval Case uval Of 'EXIT': widget_control, event.top, /destroy 'PLOT':Begin ;find the tplot variables that are selected, and do the tplot widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy ;do the tlimit here... t0 = state.st_time & t1 = state.en_time If(is_struct(tplot_vars)) Then Begin tlimit, t0, t1 t0 = ''''+time_string(t0)+'''' t1 = ''''+time_string(t1)+'''' history_ext = 'tlimit, '+t0+', '+t1 thm_ui_update_history, history_ext, wstate Endif If(ptr_valid(wstate.active_vnames)) Then Begin tv_plot = thm_ui_temp_arr2str(*wstate.active_vnames) Endif Else Begin message, /info, 'No Active Dataset, Plotting it all' tv_plot = '*' Endelse tv_plot_s = ''''+tv_plot+'''' ;get the plot type ptyp = wstate.plot_type If(ptyp Eq 'PNG') Then Begin dname = !d.name ;'X' or 'WIN' set_plot, 'z' ;do this in the z-buffer tplot, tv_plot filename = 'thm_gui_plot_'+time2file(!stime) makepng, filename set_plot, dname history_ext = ['dname = !d.name', 'set_plot, ''z''', $ 'tplot, '+tv_plot_s, 'makepng, '+''''+filename+'''', $ 'set_plot, dname'] Endif Else Begin If(!version.os_family Eq 'Windows') Then begin set_plot, 'win' history_ext = ['set_plot, ''win''', 'tplot, '+tv_plot_s] Endif Else Begin set_plot, 'x' history_ext = ['set_plot, ''x''', 'tplot, '+tv_plot_s] Endelse tplot, tv_plot Endelse thm_ui_update_history, history_ext, wstate widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End ;avg, takes the given tplot variables, subtracts the mean and creates ;new variables for plotting 'SUBAVG':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames nnn = n_elements(tvn) vn_new = strarr(nnn) For j = 0, nnn-1 Do Begin vname = tvn[j] get_data, vname, data = d ; Subtract off the average svalue = average(d.y, 1, /double) print, vname+': Subtracted Average Values:' print, svalue d.y = d.y-(replicate(1, n_elements(d.x))#svalue) ; create name and ID vn_new[j] = vname+'-d' ; Return data to "TPLOT limbo" with new name store_data, vname+'-d', data = temporary(d) Endfor ;change active datasets to new variables data_ss = thm_ui_set_active_dset(vn_new, wstate) ;history of this is not easy... history_ext = ['nvars = n_elements(varnames)', $ 'new_vars = strarr(varnames)', $ 'For j = 0, nvars -1 Do Begin &$', $ ' get_data, varnames[j], data=d &$', $ ' svalue = average(d.y, 1, /double)', $ ' d.y = d.y-(replicate(1, n_elements(d.x))#svalue) &$', $ ' new_vars[j] = varnames[j]+''-d'' &$', $ ' tplot, /add, new_vars[j]', $ 'varnames = new_vars'] ;reset states, and display thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End ;subtract the median value, creates new variables for plotting 'SUBMED':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames nnn = n_elements(tvn) vn_new = strarr(nnn) For j = 0, nnn-1 Do Begin vname = tvn[j] get_data, vname, data = d ; Subtract off the median svalue = average(d.y, 1, /double, /ret_median) print, vname+': Subtracted Median Values:' print, svalue d.y = d.y-(replicate(1, n_elements(d.x))#svalue) ; create name and ID vn_new[j] = vname+'-m' ; Return data to "TPLOT limbo" with new name store_data, vname+'-m', data = temporary(d) Endfor ;change active datasets to new variables data_ss = thm_ui_set_active_dset(vn_new, wstate) ;history of this is not easy... history_ext = ['nvars = n_elements(varnames)', $ 'new_vars = strarr(varnames)', $ 'For j = 0, nvars -1 Do Begin &$', $ ' get_data, varnames[j], data=d &$', $ ' svalue = average(d.y, 1, /double, /ret_median)', $ ' d.y = d.y-(replicate(1, n_elements(d.x))#svalue) &$', $ ' new_vars[j] = varnames[j]+''-m'' &$', $ ' tplot, /add, new_vars[j]', $ 'varnames = new_vars'] ;reset states, and display thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End 'SMOOTH':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin ;Get the smoothing parameter smooth_res = thm_ui_par('Smoothing Resolution', '11') smooth_res = smooth_res[0] smr = strcompress(smooth_res, /remove_all) smooth_res = long(smooth_res) tvn = *wstate.active_vnames vn_new = tvn+'_sm_'+smr For j = 0, n_elements(vn_new)-1 Do Begin tsmooth2, tvn[j], smooth_res, newname = vn_new[j] Endfor data_ss = thm_ui_set_active_dset(vn_new, wstate) history_ext = ['width = '+smr, $ 'new_vars = varnames+''_sm_'+smr+'''', $ 'For j = 0, n_elements(new_vars)-1 Do', $ ' tsmooth2, varnames[j], width, newname = new_vars[j]', $ 'varnames = new_vars'] thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End 'AVG':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin ;Get the time_resolution time_res = thm_ui_par('Time Resolution (sec)', '60') time_res = time_res[0] smr = strcompress(time_res, /remove_all) time_res = float(time_res) tvn = *wstate.active_vnames vn_new = tvn+'_av_'+smr For j = 0, n_elements(vn_new)-1 Do Begin avg_data, tvn[j], time_res, newname = vn_new[j] Endfor data_ss = thm_ui_set_active_dset(vn_new, wstate) history_ext = ['time_res = '+smr, $ 'new_vars = varnames+''_av_'+smr+'''', $ 'For j = 0, n_elements(new_vars)-1 Do $', $ ' avg_data, varnames[j], time_res, newname = new_vars[j]', $ 'varnames = new_vars'] thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End 'DERIV':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames vn_new = 'd_'+tvn For j = 0, n_elements(vn_new)-1 Do Begin deriv_data, tvn[j], newname = vn_new[j] Endfor data_ss = thm_ui_set_active_dset(vn_new, wstate) history_ext = ['new_vars = ''d_''+varnames', $ 'For j = 0, n_elements(new_vars)-1 Do $', $ ' deriv_data, varnames[j], newname = new_vars[j]', $ 'varnames = new_vars'] thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End 'SPIKE':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames vn_new = tvn+'_dspk' For j = 0, n_elements(vn_new)-1 Do Begin clean_spikes, tvn[j], new_name = vn_new[j] Endfor data_ss = thm_ui_set_active_dset(vn_new, wstate) history_ext = ['new_vars = varnames+''_dspk''', $ 'For j = 0, n_elements(new_vars)-1 Do $', $ ' clean_spikes, varnames[j], newname = new_vars[j]', $ 'varnames = new_vars'] thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End 'CLIP':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin xxx = thm_ui_par('Min and Max for clipping', ['-20.0', '20.0']) amin = min(float(xxx)) & amax = max(float(xxx)) tvn = *wstate.active_vnames vn_new = tvn+'_clip' tclip, tvn, amin, amax, newname = vn_new data_ss = thm_ui_set_active_dset(vn_new, wstate) history_ext = ['new_vars = varnames+''_clip''', $ 'tclip, varnames, newname = new_vars', $ 'varnames = new_vars'] thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End 'DEFLAG':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin xxx = thm_ui_par('deflag method: LINEAR (Interpolate) or REPEAT (Last Value', 'repeat') method = strtrim(strlowcase(xxx[0]), 2) tvn = *wstate.active_vnames vn_new = tvn+'_deflag' tdeflag, tvn, method, newname = vn_new data_ss = thm_ui_set_active_dset(vn_new, wstate) history_ext = ['new_vars = varnames+''_deflag''', $ 'tdeflag, varnames, newname = new_vars', $ 'varnames = new_vars'] thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy thm_ui_update_data_display, state.master_id widget_control, event.top, set_uval = state, /no_copy End ;set ylimits for the active dataset 'YLIMIT':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames get_data, tvn[0], data = d, dlim = dlim, lim = lim yr = [0.0d0, 0.0d0] yl = 0 If(is_struct(lim)) Then Begin If(tag_exist(lim, 'yrange')) Then yr = lim.yrange If(tag_exist(lim, 'ylog')) Then yl = lim.ylog Endif yr = strcompress(/remove_all, string(yr)) yl = strcompress(/remove_all, string(yl)) ylims = thm_ui_npar(['YMIN', 'YMAX', 'YLOG'], [yr[0], yr[1], yl]) yr = [double(ylims[0]), double(ylims[1])] yl = fix(ylims[2]) For j = 0, n_elements(tvn)-1 Do ylim, tvn[j], yr[0], yr[1], yl ystring = ylims[0]+', '+ylims[1]+', '+ylims[2] history_ext = 'For j=0, n_elements(varnames)-1 Do ylim, varnames[j], '+ystring thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End ;set zlimits for the active dataset 'ZLIMIT':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames get_data, tvn[0], data = d, dlim = dlim, lim = lim zr = [0.0d0, 0.0d0] zl = 0 If(is_struct(lim)) Then Begin If(tag_exist(lim, 'zrange')) Then zr = lim.zrange If(tag_exist(lim, 'zlog')) Then zl = lim.zlog Endif zr = strcompress(/remove_all, string(zr)) zl = strcompress(/remove_all, string(zl)) zlims = thm_ui_npar(['ZMIN', 'ZMAX', 'ZLOG'], [zr[0], zr[1], zl]) zr = [double(zlims[0]), double(zlims[1])] zl = fix(zlims[2]) For j = 0, n_elements(tvn)-1 Do zlim, tvn[j], zr[0], zr[1], zl zstring = zlims[0]+', '+zlims[1]+', '+zlims[2] history_ext = 'For j=0, n_elements(varnames)-1 Do zlim, varnames[j], '+zstring thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End ;Set spectrogram, or not 'SPEC':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy If(ptr_valid(wstate.active_vnames)) Then Begin tvn = *wstate.active_vnames get_data, tvn[0], data = d, dlim = dlim, lim = lim spec = 0 If(is_struct(lim)) Then Begin If(tag_exist(lim, 'spec')) Then spec = lim.spec Endif spec = thm_ui_par('Set to 1 for spectrogram, 0 for lines', strcompress(string(spec))) spec = fix(spec[0]) < 1 For j = 0, n_elements(tvn)-1 Do options, tvn[j], 'spec', spec history_ext = 'For j=0, n_elements(varnames)-1 Do options, varnames[j], ''spec'', '+strcompress(string(spec)) thm_ui_update_history, history_ext, wstate Endif Else message, /info, 'No Active Dataset, Nothing happened' widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End 'SETWNSZ':Begin widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy wsz = strcompress(string(state.windowsize), /remove_all) wsz = thm_ui_npar(['XSIZE (pixels)', 'YSIZE (pixels)'], wsz) state.windowsize = fix(wsz) ptyp = wstate.plot_type If(ptyp Eq 'PNG') Then Begin set_plot, 'z' device, set_resolution = state.windowsize If(!version.os_family Eq 'Windows') Then set_plot, 'win' $ Else set_plot, 'x' Endif Else Begin wno = state.current_wno If(!version.os_family Eq 'Windows') Then set_plot, 'win' $ Else set_plot, 'x' window, wno, xs = state.windowsize[0], ys = state.windowsize[1] Endelse widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End 'SETWNNO':Begin wno = thm_ui_npar('WINDOW_NUMBER', '0') wno = fix(wno[0]) widget_control, event.top, get_uval = state, /no_copy state.current_wno = wno If(!version.os_family Eq 'Windows') Then set_plot, 'win' $ Else set_plot, 'x' window, wno, xs = state.windowsize[0], ys = state.windowsize[1] widget_control, event.top, set_uval = state, /no_copy End ;set tlimit, using the cursor 'TLIMIT':Begin ctime, trange_new, npoints = 2 t0 = trange_new[0] & t1 = trange_new[1] tlimit, t0, t1 widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy state.st_time = t0 & state.en_time = t1 t00 = ''''+time_string(t0)+'''' t10 = ''''+time_string(t1)+'''' thm_ui_update_history, 'tlimit, '+t00+', '+t10, wstate ;reset displayed times widget_control, state.sttime_display, set_val = time_string(t0) widget_control, state.entime_display, set_val = time_string(t1) widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End 'RESET_TLIMIT': Begin tlimit, 0, 0 widget_control, event.top, get_uval = state, /no_copy widget_control, state.master_id, get_uval = wstate, /no_copy t0 = wstate.st_time & t1 = wstate.en_time state.st_time = t0 & state.en_time = t1 thm_ui_update_history, 'tlimit, 0, 0', wstate ;reset displayed times widget_control, state.sttime_display, set_val = time_string(t0) widget_control, state.entime_display, set_val = time_string(t1) widget_control, state.master_id, set_uval = wstate, /no_copy widget_control, event.top, set_uval = state, /no_copy End 'STTIME_DISPLAY':Begin widget_control, event.id, get_val = temp_string t0 = time_string(temp_string) If(event.type Le 2) Then Begin If(is_string(t0)) Then Begin t1 = time_double(t0) widget_control, event.top, get_uval = state, /no_copy state.st_time = t1 widget_control, event.top, set_uval = state, /no_copy Endif Else Begin message, /info, 'Bad time selection, No action taken' Endelse Endif End 'ENTIME_DISPLAY':Begin widget_control, event.id, get_val = temp_string t0 = time_string(temp_string) If(event.type Le 2) Then Begin If(is_string(t0)) Then Begin t1 = time_double(t0) widget_control, event.top, get_uval = state state.en_time = t1 widget_control, event.top, set_uval = state, /no_copy Endif Else Begin message, /info, 'Bad time selection, No action taken' Endelse Endif End Endcase Return End Pro thm_ui_call_tplot, master_widget_id, tplot_master ;build master widget tplot_master = widget_base(/row, title = 'TPLOT Data Processing Widget', $ /tlb_frame_attr) ;button widget buttons = widget_base(tplot_master, /col, /align_center, frame = 5) ;build controls widget controls = widget_base(tplot_master, /col, /align_center, frame = 5) ;plot button plotbut = widget_button(buttons, val = ' Plot it', uval = 'PLOT', $ /align_center) ;average subtraction button subavgbut = widget_button(buttons, val = ' Subtract Average', uval = 'SUBAVG', $ /align_center) ;median subtraction button submedbut = widget_button(buttons, val = ' Subtract Median', uval = 'SUBMED', $ /align_center) ;tsmooth2 button smoothbut = widget_button(buttons, val = ' Smooth Data', uval = 'SMOOTH', $ /align_center) ;average button avgbut = widget_button(buttons, val = ' Time Average', uval = 'AVG', $ /align_center) ;clip button clipbut = widget_button(buttons, val = ' Clip', uval = 'CLIP', $ /align_center) ;dflag button deflagbut = widget_button(buttons, val = ' Deflag', uval = 'DEFLAG', $ /align_center) ;dspike button spikebut = widget_button(buttons, val = ' Clean Spikes', uval = 'SPIKE', $ /align_center) ;deriv button derivbut = widget_button(buttons, val = ' Time Derivative', uval = 'DERIV', $ /align_center) ;exit button exitbut = widget_button(buttons, val = ' Exit ', uval = 'EXIT', $ /align_center) ;options widget optionsbase = widget_base(controls, /col, /align_right, frame = 5) ;ylimit button ylimbut = widget_button(optionsbase, val = ' Ylimit', $ uval = 'YLIMIT', /align_center) ;zlimit button zlimbut = widget_button(optionsbase, val = ' Zlimit', $ uval = 'ZLIMIT', /align_center) ;spectrogram button specbut = widget_button(optionsbase, val = ' Set/Unset Spectrogram', $ uval = 'SPEC', /align_center) ;window_size button winszbut = widget_button(optionsbase, val = ' Set Plot Window Size', $ uval = 'SETWNSZ', /align_center) ;window_number button winnobut = widget_button(optionsbase, val = ' Set Plot Window Number', $ uval = 'SETWNNO', /align_center) ;time selection widget timebase = widget_base(controls, /col, /align_right, frame = 5) ;tlimit button tlimitbut = widget_button(timebase, val = ' Tlimit ', $ uval = 'TLIMIT', /align_center) ;tlimit reset button tlimitresetbut = widget_button(timebase, val = ' Reset Tlimit ', $ uval = 'RESET_TLIMIT', /align_center) ;Get the start and end times from the master widget widget_control, master_widget_id, get_uval = wstate, /no_copy t0 = wstate.st_time & t1 = wstate.en_time ; Some things won't work unless there has already been a tplot called If(ptr_valid(wstate.active_vnames)) Then Begin tplot, thm_ui_temp_arr2str(*wstate.active_vnames) Endif Else tplot, '*' tplot_options, 'title', '' widget_control, master_widget_id, set_uval = wstate, /no_copy ; sttime text sttime_display = widget_text(timebase, /edit, $ uval = 'STTIME_DISPLAY', $ val = time_string(t0), $ xsize = 20, /all_events) ; entime button entime_display = widget_text(timebase, /edit, $ uval = 'ENTIME_DISPLAY', $ val = time_string(t1), $ xsize = 20, /all_events) ; State structure state = {tplot_master:tplot_master, $ exitbut:exitbut, $ ;exit button id plotbut:plotbut, $ ;plot button id subavgbut:subavgbut, $ ;subtract average button submedbut:submedbut, $ ;subtract median button avgbut:avgbut, $ ;average button smoothbut:smoothbut, $ ;smooth button id derivbut:derivbut, $ ;derivative button id spikebut:spikebut, $ ;de-spiking button clipbut:clipbut, $ ;clip button deflagbut:deflagbut, $ ;deflag button ylimbut:ylimbut, $ ;ylimit button zlimbut:zlimbut, $ ;zlimit button specbut:specbut, $ ;toggle -- spectrogram winszbut:winszbut, $ ;window size button winnobut:winnobut, $ ;window size button tlimitbut:tlimitbut, $ ;tlimit button id tlimitresetbut:tlimitresetbut, $ ;tlimit_reset button id sttime_display:sttime_display, $ ;start_time display id entime_display:entime_display, $ ;end_time display id st_time:t0, $ ;start_time, double en_time:t1, $ ;end_time windowsize:[640, 480], $ ;last stored window size current_wno:0, $ ;the current plotting window master_id:master_widget_id} ;the id of the calling widget widget_control, tplot_master, set_uval = state, /no_copy widget_control, tplot_master, /realize xmanager, 'thm_ui_call_tplot', tplot_master, /no_block Return End