function viewing_axis @common_blocks.inc widget_control,SLICE_BGROUP, get_value=dim return, dim end pro load_file_by_name, name @common_blocks.inc if (name ne '') then begin slash_is_at = StrPos(name, '/',/reverse_search) data_dir = STRMID(name, 0, slash_is_at+1) read_all_grid_info, [name] time_index = N_elements(times)-1 select_current_grids set_list_widget_values endif widget_control, base2, sensitive = 1 end pro erase_cm_window @common_blocks.inc cw = !D.window widget_control, get_value = win_index, draw_cm ; make it the current graphics window wset, win_index erase wset, cw return end ;+ ; NAME: AMRSlicer is the heart of Jaques who is enzo`s best friend. ; PURPOSE: Visualization of AMR data ; MODIFICATION HISTORY: ; Tom Abel : June 1998 - ;- FUNCTION Rvalue, Eid WIDGET_CONTROL,Eid,GET_VALUE=value RETURN, value END pro create_composite_row @common_blocks.inc row_id = (size(composite_rows))[2] row_name = string(FORMAT='(I2.2)', row_id) newbase = WIDGET_BASE(COMPOSITE_BASE, /COLUMN, FRAME=3, MAP=0) b = WIDGET_BASE(newbase, /ROW) newminus = WIDGET_BUTTON(b, VALUE=' - ', UVALUE='COMPOSITE_ROW_MINUS_'+row_name) newcombo = WIDGET_COMBOBOX(b, VALUE=string(indgen(n_images)), UVALUE='COMPOSITE_ROW_SEL_'+row_name, /DYNAMIC_RESIZE) newminus = WIDGET_BUTTON(b, VALUE='Preview', UVALUE='COMPOSITE_ROW_PREVIEW_'+row_name) newslider = CW_WAVELENGTHSLIDER(newbase, TITLE='Wavelength', VALUE=656, MAXIMUM=780, MINIMUM=380, $ UVALUE='COMPOSITE_ROW_LAMBDA_'+row_name, /DRAG, FORMAT='(I0)') composite_rows = [[composite_rows], [newbase, newcombo, newminus]] end PRO J_Event, Event @common_blocks.inc COMMON VOLUME_DATA, cube_data, shade_data, shades ; allow one to call this routine with string and carry out what the ; corresponding action would have been taken by the GUI if size(event, /type) ne 7 then begin ; its a real event if (TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_TRACKING') then $ if event.enter eq 1 then begin ; help, event, /struct ; switching between windows --------------------------------- parent = event.id while parent ne 0 do begin eve = parent parent = widget_info(eve, /parent) endwhile if currentWindowID ne eve then begin save_name = image_log_directory+'jaques-state-'+strcompress(currentWindowID, /remove_all)+'.sav' save, /comm, /variables, filename=save_name load_name = image_log_directory+'jaques-state-'+strcompress(eve, /remove_all)+'.sav' res = findfile(load_name) if res[0] ne '' then begin if verbose then print, 'restoring state ... ' restore, load_name ; , /verbose if verbose then print, 'restored state' endif ; currentWindowID = eve return endif ; end of window switching --------------------------------- endif WIDGET_CONTROL,Event.Id,GET_UVALUE=Ev endif else Ev = Event if N_elements(ev) eq 0 then ev = '' if size(event, /type) eq 8 then $ if wtab eq event.id then begin if event.tab eq 0 then begin J_event, 'NO_VEL' J_event, 'NO_PARTICLES' J_event, 'NO_HISTOGRAMS' return endif if event.tab eq 1 then Ev = 'VEL_BUTTON' if event.tab eq 2 then Ev = 'PARTICLES_BUTTON' if event.tab eq 3 then Ev = 'HISTOGRAMS' endif ; set the appropriate graphics window widget_control, get_value = win_index, draw_area wset, win_index fresh_image = 0 ;IF ev.id eq draw THEN BEGIN ; ev = WIDGET_EVENT([base, draw]) ; IF N_elements(ev.press) gt 0 THEN BEGIN ; if ev.press eq 2 then goto, zoom_in ; END ELSE BEGIN ; print, Ev IF (STRPOS(ev, 'Zoom') ge 0) THEN BEGIN If Verbose Then Print, 'Event for ZOOM' windx = DOUBLE(slice_size(2)-slice_size(0)) if (EV eq 'Zoom.pick') THEN BEGIN zoom_in: widget_control, base2, sensitive = 0 Q = CW_DEFSQUARE(draw_area, xy_sl_size, slice_size(2)-slice_size(0)) if (N_ELEMENTS(Q) ge 9) THEN BEGIN wind = DOUBLE(Q(*,0:3))/DOUBLE(xy_sl_size) left_x = min(wind(0,*)) left_y = min(wind(1,*)) right_x = max(wind(0,*)) right_y = max(wind(1,*)) if verbose then print, 'wind:',wind windx = slice_size(2)-slice_size(0) windy = slice_size(3)-slice_size(1) if verbose then print, 'windy:', windy slice_size[2] = DOUBLE(slice_size[0] + windx*right_x) slice_size[3] = DOUBLE(slice_size[1] + windy*right_y) slice_size[0] = DOUBLE(slice_size[0] + windx*left_x) slice_size[1] = DOUBLE(slice_size[1] + windy*left_y) ; redefine center: mi = min(slice_size[2:3]- slice_size[0:1]) If mi lt 1e-20 then begin print, 'picked zero extent region ..' return endif ENDIF else return os = where(slice_ori lt 1.e-15) center[os] = DOUBLE(slice_size[2:3]+slice_size[0:1])/2.D slh = 0.5D * (slice_size(2)-slice_size(0)) print, 'os:', os END ELSE BEGIN factor = 1. CASE Ev OF 'Zoom.in by 2': factor = 1.D/2.D 'Zoom.in by 4': factor = 1.D/4.D 'Zoom.in by 10': factor = 1./10.D 'Zoom.in by 100': factor = 1./100.D 'Zoom.in by 1000': factor = 1./1000.D 'Zoom.out by 2': factor = 2.D 'Zoom.out by 5': factor = 5.D 'Zoom.out by 10': factor = 10.D ELSE: ENDCASE os = where(slice_ori lt 1.e-19) slh = factor*0.5D * (slice_size(2)-slice_size(0)) ENDELSE IF (EV EQ 'Zoom.top') THEN begin extent = (DomainRightEdge-DomainLeftEdge) slh = 0.5*max(extent) os = where(slice_ori lt 1.e-15) depth_value = extent[viewing_axis()] center[os] = 0.5d* (DomainRightEdge+DomainLeftEdge)[os] endif goto, set_sidelength_update_slider END IF (STRPOS(Ev, 'Find max') GE 0) THEN BEGIN ; widget_control, base2, sensitive = 0 widget_control, /hourglass sl = (slice_size[2]-slice_size[0]) find_max_value, Ev, grid_in_cube(grid_info, center, sl, 512, /noresolution), $ list_str(var_index), xyz_vector center = DOUBLE(xyz_vector) slh = (slice_size[2]-slice_size[0])/2 os = (where(slice_ori eq 0.))[0:1] slice_ori = center slice_ori[os] = 0. goto, set_sidelength_update_slider END IF (STRPOS(Ev, 'COMPOSITE_ROW_') GE 0) THEN BEGIN junk = '' composite_row_id = 0L reads, Ev, FORMAT="(A"+string(FORMAT="(I0)", strlen(Ev)-2)+",I2.2)", junk, composite_row_id Ev = STRMID(Ev, 0, strlen(Ev)-3) ENDIF CASE Ev OF 'draw_area':BEGIN if last_was eq 3 then break ; print, 'event.press', event.press if (substracting_vel lt 1) THEN BEGIN if event.press NE 0 then begin x = event.x/DOUBLE(xy_sl_size)*(slice_size(2)-slice_size(0)) y = event.y/DOUBLE(xy_sl_size)*(slice_size(3)-slice_size(1)) pofi = DBLARR(4) pofi[0:2] = center[*] if N_elements((*image_stack(image_index).image_d)) gt 2000 then begin pofi[3] = (*image_stack(image_index).image_d)[max([event.x-1,0]),max([event.y-1,0])] if shouldbe_logged(image_stack(image_index).title) then begin pofi[3] = 10.^pofi[3] * get_unit(image_stack[image_index].title) endif endif else pofi[3] = 0 if verbose then print, pofi[0:2], ' Value:',pofi[3] os = where(slice_ori lt 1.e-15) pofi(os[0:1]) = [x,y]+slice_size(0:1) update_slice_text, slice_text, slice_size, center,image_stack(image_index).title, pofi, $ /show_pofi, show_grid=grid_info If (event.press eq 2) then begin ; middle click to recenter to this point center[*] = pofi[0:2] slh = (slice_size(2)-slice_size(0))/2. print, 'now centered on point : ' ,center goto, set_sidelength_update_slider end If (event.press eq 4) then begin ; right click to cycle through slice directions i_s = (where(slice_ori gt 1e-30) + 1)[0] if i_s gt 2 then i_s = 0 slice_value = center[i_s] if abs(slice_value) lt 1e-15 then slice_value = 1e-15 ; do not let it be exactly zero slice_ori = [0., 0., 0.] slice_ori[i_s] = slice_value os = where([0,1,2] ne i_s) slh = (slice_size[2]-slice_size[0])/2. goto, set_sidelength_update_slider endif END END ELSE BEGIN IF N_elements(event.press) gt 0 THEN BEGIN if (event.press eq 1) then begin x = event.x y = event.y if verbose then print, 'x, y, event.press:',x, y, event.press cons_vel = [vel_one(x,y), vel_two(x,y)] if verbose then print, 'cons_vel :',cons_vel endif ; cancel ? if (event.press eq 4) then substracting_vel = 0 ENDIF ENDELSE END ; histograms: 'BGROUPCUMHISTOPTION': hi.cumoption = event.value 'BGROUPLOGHISTOPTION': hi.logoption = event.value 'HISTOGRAM_FIELD1_LIST': hi.field1 = histnames[Event.index] 'HISTOGRAM_FIELD2_LIST': hi.field2 = histnames[Event.index] 'HISTOGRAM_WEIGHT_LIST': hi.weight = histnames[Event.index] 'BGROUPHISTOPTION': hi.option = event.value 'BGROUPHISTOPTION2': hi.option2 = event.value 'HIST_MINIMUM1': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp hi.min1 =tmp if verbose then print, tmp END 'HIST_MAXIMUM1': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp hi.max1 = tmp if verbose then print, tmp END 'HIST_MINIMUM2': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp hi.min2 = tmp if verbose then print, tmp END 'HIST_MAXIMUM2': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp hi.max2 = tmp if verbose then print, tmp END 'HIST_NBINS1': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp hi.nbins1 = tmp if verbose then print, tmp END 'HIST_NBINS2': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp hi.nbins2 = tmp if verbose then print, tmp END 'IS value': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=tmp is_value=tmp(1) END 'BTNS': BEGIN EVV = Event.Value CASE EVV OF 'Compute': BEGIN create_view, Xmax=(cube_dim-1),$ YMAX=(cube_dim-1),ZMAX=cube_dim-1,$ AX=0.,AY=0.,AZ=0., $ WINX=xy_sl_size-1,WINY=xy_sl_size-1, ZOOM=0.57 Print, 'Event for compute polys' compute_em, draw_cm, xy_sl_size,$ SHADE_EM=shade_state.this_state display_iso END "Weigh": BEGIN Print, 'Event for WEIGH' Print, 'Note: that this makes only sense' Print, 'if the volume data is a over density !' zones_in = N_ELEMENTS(WHERE(Cube_data ge IS_VALUE)) side_length = DOUBLE(slice_size(2)-slice_size(0)) s = size(Cube_data) zones_tot= s(5) cube_dim = s(1) del_x = side_length/cube_dim dens = 10.^Cube_data mass_tot = TOTAL(dens) * del_x^3 mass_in = TOTAL(dens(WHERE(Cube_data GT IS_VALUE)))* $ del_x^3. mass_out = mass_tot - mass_in PRINT, 'zones inside:', zones_in PRINT, 'mass outside:',mass_out PRINT, 'zones, mass total:', zones_tot, mass_tot PRINT, $ 'mass inside (mean density * simulation volume (com Mpc^3):', $ mass_in Print, 'this is in SolarMass per (boxlength/comoving Kpc)^3' Print, 'so multiply by 2.76 10^11 M_sun/Mpc^3 * '+ $ 'Omega_matter * h^2 (sim sidelength)^3' Print, 'for first structure formation (128kpc):', mass_in*.128^3.*2.76e11/4. END '(Re)Read': BEGIN widget_control, /hourglass construct_cube, cube_data, list_str[var_index], MIN=min_v, MAX=max_v max_v = 0.99*max_v is_value = 0.4*max_v is_slider = [min_v, is_value, max_v] widget_control, IS_val, set_value = is_slider END 'IDL SLICER': BEGIN h_cube_data = PTR_NEW(cube_data, /NO_COPY) slicer3, h_cube_data, GROUP=TOP_BASE ; slicer END ELSE: print, 'unrecognized button event' END ENDCASE 'ORI': BEGIN display_iso END "VELRead": BEGIN ; make sure the original velocity field will be plotted first cons_vel = [0., 0.] widget_control, /hourglass END "VELNormal": BEGIN if (vel_normal eq 0) then begin widget_control, Event.id, SET_VALUE="Normalized" vel_normal = 1 endif else begin widget_control, Event.id, SET_VALUE="Raw data" vel_normal=0 endelse END "VELPlot": BEGIN read_velocities IF N_ELEMENTS(vel_one) gt 1 THEN BEGIN widget_control, /hourglass show_image XP=FIX((INDGEN(FLOOR(xy_sl_size/vel.skip))+1) $ *vel.skip-1.) U = DBLARR(N_ELEMENTS(XP),N_ELEMENTS(XP)) V = U FOR i=0,N_ELEMENTS(XP)-1 DO BEGIN U(*,i) =vel_one(XP,XP(i))-cons_vel(0) V(*,i) =vel_two(XP,XP(i))-cons_vel(1) ENDFOR leng = sqrt(U^2+V^2) if (vel_normal eq 0) then leng = max(leng) !p.noclip=0 !p.position=[0,0,xy_sl_size,xy_sl_size] !p.ticklen = 0. ; myvel, u,v, nsteps=100, nvecs= 5e4/(vel.skip^2), Length=vel.amplify, COLOR=vel.color MYVELOVECT, U/leng,V/leng, XP, XP, xrange=[0,xy_sl_size],yrange=[0,xy_sl_size], $ LENGTH=vel.amplify, /NOERASE, /DEVICE, COLOR=vel.color fresh_image = 1 END ELSE BEGIN print, 'no velocity data!' print, 'must read in velocities first!' END END "VELLines": BEGIN read_velocities widget_control, /hourglass show_image XP=INDGEN(xy_sl_size-4)+2 U = DBLARR(N_ELEMENTS(XP),N_ELEMENTS(XP)) V = U FOR i=0,N_ELEMENTS(XP)-1 DO BEGIN U(*,i) =(vel_one(XP,XP(i))-cons_vel(0)) V(*,i) =vel_two(XP,XP(i))-cons_vel(1) ENDFOR leng = sqrt(U^2+V^2) if (vel_normal eq 0) then leng = max(leng) !p.noclip=0 print, max(vel_one-cons_vel(0)),max(vel_two-cons_vel(1)) !p.position=[0,0,xy_sl_size,xy_sl_size] !p.ticklen = 0. !x.range=[0,1] !y.range=[0,1] myvel, u/leng,v/leng, nsteps=100, nvecs= 5e4/(vel.skip^2), $ Length=vel.amplify, COLOR=vel.color fresh_image = 1 END "VELSubstract": Begin if (N_ELEMENTS(vel_one) gt 1) then begin if verbose then begin dum = STRARR(7) dum(0) = "Please klick at a point in " dum(1) = "the drawing window (left button)" dum(2) = "The velocity at that point will be " dum(3 ) = "substracted the next time you plot " dum(4) = "the velocity vectors. " dum(5) = "Cancel: right mouse button" dum(6) = "Press Reset to get original vel. field" xdisplayfile, ' ', TEXT=dum, GROUP=TOP_BASE, $ TITLE='INFORMATION', HEIGHT=7, WIDTH = 40 endif substracting_vel = 1 END ELSE BEGIN print, 'no velocity data!' print, 'must read in velocities first!' ENDELSE END "VELReset": Begin cons_vel = [0., 0.] END 'Vel_skip':BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=skip_h vel.skip=skip_h END 'Vel_amp':BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=amplify_h vel.amplify =amplify_h(1) END "VEL_COL_SEL":BEGIN vel.color = event.value END 'BGROUP10': BEGIN print, event CASE Event.Value OF 0: begin If Verbose Then Print,'Button x Pressed' i_s = 0 slice_value = center(i_s) slice_ori = [slice_value, 0, 0] end 1: begin If Verbose Then Print,'Button y Pressed' i_s = 1 slice_value = center(i_s) slice_ori = [0, slice_value, 0] end 2: begin If Verbose Then Print,'Button z Pressed' i_s = 2 slice_value = center(i_s) slice_ori = [0, 0, slice_value] end ELSE: Message,'Unknown button pressed' ENDCASE ; adjust sidelenth such that the center point remains in the center os = where([0,1,2] ne Event.value) slh = 0.5D*(slice_size[2]-slice_size[0]) set_sidelength_update_slider: ; slh = min([slh, 1.D - center[os[0]], 1.D - center[os[1]], center[os[0]], center[os[1]]]) slice_size[0] = center[os[0]]-slh slice_size[1] = center[os[1]]-slh slice_size[2] = center[os[0]]+slh slice_size[3] = center[os[1]]+slh ; slider = [(slice_value-slh)>1e-6, slice_value, (slice_value+slh)<(1-1e-6)] dim = viewing_axis() slice_value = slice_value < domainrightedge[dim] slice_value = slice_value > domainleftedge[dim] slider = [domainleftedge[dim],slice_value,domainrightedge[dim]] widget_control, slice_val_w, set_value = slider i_s = 3 - total(os) widget_control, slice_bgroup, set_value=i_s widget_control, slice_val_w, set_value = slider widget_control, depth_val_w, set_value=[domainleftedge[dim],depth_value,domainrightedge[dim]] widget_control, base2, sensitive = 1 update_slice_text, slice_text, slice_size, center,image_stack(image_index).title vel.read = 0 END 'SLICE_VAL': BEGIN slice_value = (Rvalue(Event.id))[1] If Verbose Then Print, 'Event for slice_val ', slice_value ind = where(slice_ori gt 1.e-15) slice_ori(ind) = slice_value vel.read = 0 END 'DEPTH_VAL': BEGIN depth_value = (Rvalue(Event.id))[1] ; If Verbose Then Print, 'Event for depth_val ', depth_value if N_elements(grid_info) eq 0 then use_dim = 32 else use_dim=grid_info[0].dim[0] depth_value = nearest_valid_depth_value(depth_value,use_dim) dim = viewing_axis() widget_control, depth_val_w, set_value=[domainleftedge[dim],depth_value,domainrightedge[dim]] END 'X_SIZE': BEGIN xy_sl_size = RVALUE(Event.id) xy_sl_size = max([250, xy_sl_size]) ; make sure nobody tries to plot velocities again vel_one = 0. vel_two = 0. If Verbose Then Print, 'Event for x_size:', xy_sl_size widget_control, draw_area, $ draw_xsize=xy_sl_size, draw_ysize=xy_sl_size widget_control, base2, scr_ysize=xy_sl_size+100 draw_current_cm, draw_cm, wxysize, min_data, max_data END 'SMOOTH_VALUE': BEGIN WIDGET_CONTROL,Event.id, get_value=tmp smoothing = tmp(1) END 'BGROUP_INTER': BEGIN CASE Event.Value OF 0: begin If Verbose Then Print,'Button none Pressed' interpolate_i = 0 end 1: begin If Verbose Then Print,'Button linear Pressed' interpolate_i = 1 end 2: begin If Verbose Then Print,'Button quintic Pressed' interpolate_i = 2 end 3: begin If Verbose Then Print,'Button grid Pressed' interpolate_i = 3 end ELSE: Message,'Unknown button pressed' ENDCASE ; if the last was a slice or projections, redraw with interpolation IF ((last_was eq 1) or (last_was eq 2) and (image_stack(image_index).title NE '')) THEN BEGIN widget_control, /hourglass result = render_image() construct_image, result show_image fresh_image = 1 ENDIF END 'CYCLE_RENDER_OPTION': begin interpolate_i += 1 interpolate_i = interpolate_i mod 4 widget_control, BGROUP_INT, set_value=interpolate_i widget_control, /hourglass result = render_image() construct_image, result show_image fresh_image = 1 end 'CLEAR FILE LIST': BEGIN file_list = 'file list from .mhierarchy' END 'PREVIOUS TIME STEP': BEGIN widget_control, base2, sensitive = 0 ntimes = N_ELEMENTS(times) ; if only one file loaded try to see whether the file with a lower number exists file_name = grid_info[0].hier_file if Ntimes eq 1 then begin regular = 0 if strpos(file_name, '.hierarchy') gt 3 then begin regular = 1 timenum = strmid(file_name, strpos(file_name, '.hierarchy')-4, 4) ; 4 digit number endif else $ timenum = strmid(file_name, strpos(file_name, 'snapshot_')+9, 3) ; 3 digit number sp = strsplit(file_name, timenum, /extract, /regex) ns = N_elements(sp) step = 1 exists = '' while ((step lt 100) and (exists[0] eq '')) do begin ; findS = sp[0:ns-2] + STRING(max([LONG(timenum)-step,0]), FORMAT='(i4.4)') if regular then $ findS = sp[0:ns-2] + STRING(max([LONG(timenum)-step,0]), FORMAT='(i4.4)') $ else $ findS = sp[0:ns-1] + STRING(max([LONG(timenum)-step,0]), FORMAT='(i3.3)') step += 1 protofname = strjoin(findS) exists = findfile(protofname) endwhile if exists[0] ne '' then begin print, 'found previous time step file:', protofname if regular then file_name = protofname+'.hierarchy' $ else file_name = protofname file_list = file_name goto, read_file endif else begin print, 'no previous time step found!' Widget_control, base2, sensitive = 1 endelse endif else begin ; else use existing list time_index = time_index-1 > 0 file_name = file_list[time_index] select_current_grids set_list_widget_values Widget_control, base2, sensitive = 1 endelse END 'NEXT TIME STEP': BEGIN widget_control, base2, sensitive = 0 ntimes = N_ELEMENTS(times) ; if only one file loaded try to see whether the file with a higher number exists file_name = grid_info[0].hier_file regular = 0 if Ntimes eq 1 then begin if strpos(file_name, '.hierarchy') gt 3 then begin regular = 1 timenum = strmid(file_name, strpos(file_name, '.hierarchy')-4, 4) ; 4 digit number endif else $ timenum = strmid(file_name, strpos(file_name, 'snapshot_')+9, 3) ; 3 digit number sp = strsplit(file_name, timenum, /extract, /regex) ns = N_elements(sp) step = 1 exists = '' while ((step lt 100) and (exists[0] eq '')) do begin if regular then $ findS = sp[0:ns-2] + STRING(LONG(timenum)+step, FORMAT='(i4.4)') $ else $ findS = sp[0:ns-1] + STRING(LONG(timenum)+step, FORMAT='(i3.3)') step += 1 protofname = strjoin(findS) exists = findfile(protofname) endwhile if exists[0] ne '' then begin print, 'found next time step file:', protofname if regular then file_name = protofname+'.hierarchy' $ else file_name = protofname file_list = file_name goto, read_file endif else begin print, 'no further time step found!' Widget_control, base2, sensitive = 1 endelse endif else begin ; else use the existing list time_index = min([time_index+1, Ntimes-1]) file_name = file_list[time_index] select_current_grids set_list_widget_values Widget_control, base2, sensitive = 1 endelse END 'WATCH NEXT TIME STEP': BEGIN print, 'watching for next time step to become available.' print, ' will redraw once its written.' print, ' type a c or C on the commandline to stop watching.' stopit = 0 while((stopit ne 1)) do begin ofname = file_name check_cancel, stopit=STOPIT if STOPIT then begin stopit = 0 return endif j_event, 'NEXT TIME STEP' if (file_name ne ofname) then begin wait, 2 j_event, 'DRAW_BUTTON' endif endwhile END 'NEXT VARIABLE': BEGIN nvar = N_elements(list_str) var_index = (var_index+1) mod nvar widget_control, variable_list_widget, set_combobox_select = var_index END 'PREVIOUS VARIABLE': BEGIN nvar = N_elements(list_str) var_index = (var_index-1) if var_index eq -1 then var_index = nvar-1 widget_control, variable_list_widget, set_combobox_select = var_index END 'WRITE FILE LIST': BEGIN widget_control, base2, sensitive = 0 nfiles = N_ELEMENTS(file_list) ind = where(file_test(file_list, /READ) ne 0) if (ind[0] ne -1) then begin file_list = file_list[ind] if verbose then print, 'found ', N_elements(file_list), ' readable files.' list_file_name = dialog_pickfile(FILTER = '*.mhierarchy', $ Path=newp, $ DIALOG_PARENT=BASE2, $ TITLE = 'select a filename with .mhierarchy file to write.', $ /NOCONFIRM, /WRITE) if (list_file_name ne '') then begin if (not strmatch(list_file_name, '*.mhierarchy')) then $ list_file_name += '.mhierarchy' OPENW, unit, list_file_name, /GET_LUN, ERROR=error IF error LT 0 THEN $ print, 'Can not write the file:', list_file_name else $ print, 'wrote file list to: ', list_file_name ; Count how many lines of text to save lineCount = (SIZE(file_list))(1) FOR lineIndex = 0, lineCount-1 DO $ ; Write each line to the file PRINTF, unit, file_list[lineIndex] FREE_LUN, unit ; Free and close the file unit. endif endif vel.read = 0 widget_control, base2, sensitive = 1 END 'SLICE ITOOL': BEGIN draw_current_cm, draw_cm, wxysize, $ image_stack[image_index].min_data, $ image_stack[image_index].max_data, $ return_strings=rstring tvlct, r, g, b, /get ts = shouldbe_logged(list_str[var_index]) ? "log " : "" ts += list_str[var_index] ts = strJOIN(rstring[1:*]+' ') axes =['x','y','z'] ds = [slice_size[2]-slice_size[0], slice_size[3]-slice_size[1]] image_dimension = ds * get_unit('Length', value=ds[0], ulabel=ulabel) iamge_location = [0.,0.] other = where(slice_ori le 1e-30) xtitle=axes[other[0]] ytitle=axes[other[1]] secondaxis = 0 if hi.myturn then begin fields = [hi.field1, hi.field2, hi.weight] notnone = where(fields ne 'none' and fields ne '') Nnotnone = N_ELEMENTS(notnone) secmin = min(mh[where(mh gt 0.)]) CASE Nnotnone of 1: BEGIN iplot, obin1, (mh) > secmin, xlog=shouldbe_logged(hi.field1), $ /ylog, psym=10, $ xtitle=hi.titlestring1, ytitle='dN', $ xrange=hi.xrange, $ xstyle=1, ystyle=1, $ charsize=4, thick=2, $ ticklen=.02, title=strJoin(rstring[*]+' '), $ viewtitle = strJoin(rstring[*]+' ') return END 2: BEGIN if fields[2] eq 'none' or fields[2] eq '' then goto, two_d_histogram iplot, obin1, (mh) >secmin, xlog=shouldbe_logged(hi.field1), $ /ylog, psym=10, $ xtitle=hi.titlestring1, ytitle='dN', $ xrange=hi.xrange, $ xstyle=1, ystyle=1, $ charsize=4, thick=2, title=strJoin(rstring[*]+' '), $ viewtitle = strJoin(rstring[*]+' ') return end 3: BEGIN two_d_histogram: if shouldbe_logged(hi.field1) then onelog = 1 else onelog = 0 if shouldbe_logged(hi.field2) then twolog = 1 else twolog = 0 xr = hi.xrange yr = hi.yrange image_dimension = [xr[1]-xr[0], yr[1]-yr[0]] image_location = [xr[0], yr[0]] xtitle = (onelog ? 'log '+hi.field1 : hi.field1) + $ ' ['+get_unit(hi.field1, /ulabel)+']' ytitle = (twolog ? 'log '+hi.field2 : hi.field2) + $ ' ['+get_unit(hi.field2, /ulabel)+']' secondaxis = 1 END ELSE: print, 'somthings wrong in show_histogram ..' ENDCASE END idata = (*(image_stack[image_index].image_d)) ; idata = tvrd(TRUE=1) units = get_unit(image_stack[image_index].title) if shouldbe_logged(image_stack[image_index].title) then begin units = alog10(units) idata += units endif iimage, idata, /disable_splash_screen, RGB=[[r],[g],[b]], $ title=ts, view_title=ts, $ /INSERT_COLORBAR, scale_isotropic=1 , image_dimensions=image_dimension, $ image_location=image_location, xtitle=xtitle, ytitle=ytitle, ymargin=0.01 tool = itGetCurrent(tool=oTool) idxaxis = otool->FindIdentifiers('*axis',/operations,count=count) if secondaxis then void = otool->DoAction(idxaxis[1]) void = otool->DoAction(idxaxis[2]) ;obtain window reference: ; changes the title font size oWin=oTool->GetCurrentWindow() ;move title location and increase font size: view_id = '*view_'+STRTRIM(1, 2)+'*text' view_title_id = oTool->FindIdentifiers(view_id) view_title_obj = oTool->GetByIdentifier(view_title_id) void = view_title_obj->GetPropertyByIdentifier('FONT_SIZE', font_size) void = oTool->DoSetProperty(view_title_id, 'FONT_SIZE', font_size*1.5) void = view_title_obj->GetPropertyByIdentifier('LOCATIONS', locations) locations[1] = locations[1]*0.9 void = oTool->DoSetProperty(view_title_id, 'LOCATIONS', locations) if secondaxis then begin view_id = '*view*axis' view_a_id = oTool->FindIdentifiers(view_id) void = oTool->DoSetProperty(view_a_id, 'AXIS_TITLE', xtitle) endif view_id = '*view*axis_1' view_a_id = oTool->FindIdentifiers(view_id) void = oTool->DoSetProperty(view_a_id, 'AXIS_TITLE', ytitle) ; change text size for color bar annotation view_id = '*view*colorbar' view_cb_id = oTool->FindIdentifiers(view_id) view_cb_obj = oTool->GetByIdentifier(view_cb_id) ; void = view_cb_obj->GetPropertyByIdentifier('FONT_SIZE', font_size) ; void = oTool->DoSetProperty(view_cb_id, 'FONT_SIZE', font_size*1.5) ; void = view_cb_obj->GetPropertyByIdentifier('Title', title) ; hstring = STRJOIN(STRSPLIT(rstring[0], '!9n!X', /EXTRACT,ESCAPE='')) ; if N_elements(hstring) gt 1 then rstring[0] = hstring[0]+'Sun'+hstring[1] void = oTool->DoSetProperty(view_cb_id, 'Axis_Title', rstring[0]) ; void = oTool->DoSetProperty(view_cb_id, 'ORIENTATION', 1) ;add action to undo/redo system: oTool->CommitActions ;clear selections: oWin->ClearSelections END 'SDVISION': SDvision, group=top_base 'AMIRA EXPORT': BEGIN if parti.myturn eq 1 then begin export_particles_for_ralf endif else begin construct_amira_export endelse END 'CURRENT AMIRA EXPORT': BEGIN if parti.myturn eq 1 then begin export_particles_for_ralf, /only_current endif else begin construct_amira_export, /only_current endelse END 'PARTIVEW EXPORT': BEGIN export_amr_boxes_to_partiview END 'CURRENT PARTIVEW EXPORT': BEGIN export_amr_boxes_to_partiview, /only_current END 'PARTIVEW PARTICLE EXPORT': BEGIN export_particles_to_partiview END 'CURRENT PARTICLE PARTIVEW EXPORT': BEGIN export_particles_to_partiview, /only_current END 'AN_CM': BEGIN ANNOTATE, DRAWABLE=draw_cm END 'AN_DRAW': BEGIN ANNOTATE, DRAWABLE=draw_area END 'EDITOR': BEGIN myeditor END 'Calculator': BEGIN mycalc END 'XPALETTE': BEGIN xpalette, GROUP=TOP_BASE END 'MOVIE': BEGIN widget_control, base2, sensitive = 0 ntimes = N_ELEMENTS(times) old_data_dir = data_dir old_log = image_log old_log_num = image_log_number old_log_string = image_log_string image_log = 1 image_log_number = 0L image_log_string = image_stack[image_index].title+"-frame" ; delete all existing frames spawn, 'rm '+image_log_directory+image_log_string+'*' starttime = 0L ofname = '' if N_elements(times) gt 1 then begin if time_index lt ntimes-1 then starttime = time_index for time_index=starttime,ntimes-1,astep DO BEGIN select_current_grids check_cancel, stopit=stopit set_list_widget_values if stopit then begin stopit = 0 break endif if last_was eq 0 then j_event, 'SHOW_CHART' if last_was eq 1 then j_event, 'DRAW_BUTTON' if last_was eq 2 then j_event, 'PROJECT' if last_was eq 3 then j_event, 'DRAW_BUTTON' if last_was eq 4 then j_event, 'PROJECTABS' if last_was eq 5 then j_event, 'PROJECTHII' if verbose then print, 'memory use in Gb', memory()/1024./1e6 endfor end else begin while ofname ne strmid(file_name, 0, strpos(file_name,'.',/reverse_search)) do begin select_current_grids check_cancel, stopit=stopit set_list_widget_values if stopit then begin stopit = 0 break endif if last_was eq 0 then j_event, 'SHOW_CHART' if last_was eq 1 then j_event, 'DRAW_BUTTON' if last_was eq 2 then j_event, 'PROJECT' if last_was eq 3 then j_event, 'DRAW_BUTTON' if last_was eq 4 then j_event, 'PROJECTABS' if last_was eq 5 then j_event, 'PROJECTHII' if verbose then print, 'memory use in Gb', memory()/1024./1e6 print, 'ofname:', $ ofname print, strmid(file_name, 0, strpos(file_name,'.',/reverse_search)) ofname = strmid(file_name, 0, strpos(file_name,'.',/reverse_search)) for i=0,astep-1 do j_event, 'NEXT TIME STEP' wait, .2 endwhile endelse time_index = N_elements(times)-1 image_log = old_log image_log_number = old_log_num image_log_string = old_log_string data_dir = old_data_dir widget_control, base2, sensitive = 1 END 'VAR_LIST': BEGIN If Verbose Then Print, 'Event for variable list' If Verbose Then Print, 'index:', Event.index var_index = Event.index END 'WEIGHT_LIST': BEGIN If Verbose Then Print, 'Event for weight list' If Verbose Then Print, 'index:', Event.index weight_index = Event.index END 'LINE_LIST': BEGIN line_index = Event.index END 'TIME_LIST': BEGIN If Verbose Then Print, 'Event for TIME list' If Verbose Then Print, 'index:', Event.index time_index = Event.index if times[0] eq -1. then goto, open_file slash_is_at = StrPos(file_name, '/',/reverse_search) data_dir = STRMID(file_name, 0, slash_is_at+1) select_current_grids set_list_widget_values widget_control, base2, sensitive = 1 END 'HELP': BEGIN If Verbose Then Print, 'Event for HELP' ; online_help, ; BOOK='http://jacques.enzotools.org/doc/Jacques/Jacques.html' spawn, ' open http://jacques.enzotools.org/doc/Jacques/Jacques.html' print, 'go to: http://jacques.enzotools.org/doc/Jacques/Jacques.html' print, 'for help and check out, the README, WHATS_NEW, and TODO files' print, 'in the distribution for more information.' END 'About': BEGIN dum = STRARR(5) dum(0) = "Jacques is enzo's best friend" dum(1) = "Author: Tom Abel 1998-" dum(2) = "Jacques is distributed in the hope it is helpful...." dum(3) = "For scientific app's I ask for an Acknowledgement" dum(4) = "send bug reports to tabel@stanford.edu" dummy = dialog_message(dum, /INFORMATION) END 'DRAW_BUTTON': BEGIN if verbose then Print, 'Event for DRAW' erase_cm_window widget_control, /hourglass if hi.myturn eq 1 then begin construct_histogram, data last_was = 3 endif else if parti.myturn eq 1 then begin data = render_particle_data() last_was = 1 print, 'do the particles', size(data) endif else if vel.myturn eq 1 then begin j_event, 'VELPlot' end else begin data = construct_interpolated_slice_data() last_was = 1 endelse print, size(data) if (((size(data))[0] eq 2) and (not vel.myturn)) then begin construct_image, data show_image endif fresh_image = 1 END 'PROJECT': BEGIN if verbose then Print, 'Event for PROJECT' erase_cm_window widget_control, /hourglass if hi.myturn eq 1 then begin construct_histogram, data, /all last_was = 3 endif else begin construct_orthogonal_projection, data last_was = 2 if parti.myturn eq 1 then begin pdata = render_particle_data() ; data[ind] = max(data) ; data[ind] = pdata[ind] last_was = 2 end if (size(data))[0] eq 2 then begin construct_image, data if N_elements(pdata) eq N_elements((*image_stack[image_index].image_d)) then begin ; combine particles with projection imi = min(pdata[where(pdata gt min(pdata))], max=ima) dmi = min((*image_stack[image_index].image_d), max=dma) ; dma = sqrt(dmi*dma) ; stop particle colors in the geometric mean of min and max of grid data im = (pdata-imi)/(ima-imi)*(dma-dmi)+dmi ind = where(im gt dmi, count) > 0 if count eq 0 then ind = lindgen(N_elements(im)) print, imi, ima, dmi, dma if parti.myturn eq 1 then (*image_stack[image_index].image_d)[ind] = im[ind] im = 0. endif show_image endif if (vel.myturn) then j_event, 'VELPlot' fresh_image = 1 endelse END 'PROJECTABS': BEGIN goto, skip if verbose then Print, 'Event for PROJECT with Absorption' widget_control, /hourglass set_spectral_palette, (line_emissivity(/AVAILABLE_LINES))[line_index].lambda data = construct_projection_with_absorption() skip: fieldnames = list_str[var_index] ; if ((weighted gt 0) ) then begin ; weightfield= list_str[weight_index-1] ; fieldnames = [fieldnames, weightfield] ; weightindex = (where(fieldnames eq weightfield))[0] ; endif data = construct_projection(FIELD=fieldnames, interpolation=interpolate_i) last_was = 4 if parti.myturn eq 1 then begin pdata = render_particle_data() ind = where(pdata ne min(pdata)) > 0 data[ind] = max(data) end construct_image, data, TITLE=(line_emissivity(/AVAILABLE_LINES))[line_index].name + ' Intensity' show_image fresh_image = 1 END 'PROJECTHII': BEGIN if verbose then Print, 'Event for PROJECT HII REGION' widget_control, /hourglass last_was = 5 data = make_HII_picture() construct_image, data, TITLE='Simulated Optical Intensity', /TRUE show_image fresh_image = 1 END 'FASTMODE_BUTTON': BEGIN CASE fastmode OF 1: BEGIN fastmode = 2 print, 'Set mode to faster.' widget_control, Event.id, SET_VALUE='Fastest mode' END 2: BEGIN fastmode = 4 print, 'Set mode to fastest.' widget_control, Event.id, SET_VALUE='Fine mode' END ELSE: BEGIN fastmode = 1 print, 'Set mode to fine.' widget_control, Event.id, SET_VALUE='Faster mode' END ENDCASE END 'SHOW_CHART': BEGIN draw_grids, 2, $ draw_cm, grid_info, slice_ori, slice_size, xy_sl_size, image=image last_was = 0 construct_image, image show_image fresh_image=1 END 'SHOW_BOXES': BEGIN draw_grids, 1, $ draw_cm, grid_info, slice_ori, slice_size, xy_sl_size END 'PART_POS': begin widget_control, /hourglass read_positions, pimage, 0 construct_image, pimage show_image fresh_image=1 end 'PLOT_PARTICLES': begin widget_control, /hourglass idata =*(image_stack[image_index].image_d) flag = [image_stack[image_index].min_data,image_stack[image_index].max_data] image = render_particle_data() construct_image, image show_image fresh_image=1 end 'PLOT_POWERSPECTRUM': BEGIN widget_control, /hourglass construct_cube, datacube, fieldname print, ' =', mean(datacube^2) ; if vel.myturn eq 0 then ps = PowerSpectrum_3D(datacube, ; obin=obin) else $ if vel.myturn eq 0 then $ power3d, reform(datacube[*,*,*]), $ wavenumbers=obin, spectrum=ps,average=1,debug=verbose $ else begin ; ps1 = PowerSpectrum_3D(reform(datacube[*,*,*,0]), obin=obin) ; ps2 = PowerSpectrum_3D(reform(datacube[*,*,*,1])) ; ps3 = PowerSpectrum_3D(reform(datacube[*,*,*,2])) ; ps = ps1 + ps2 + ps3 ; print, ' =', mean(total(datacube,4)^2) power3d, reform(datacube[*,*,*,0]), $ reform(datacube[*,*,*,1]), $ reform(datacube[*,*,*,2]), $ wavenumbers=obin, spectrum=ps,average=1,debug=verbose endelse ; ps *= obin^(5./3.) print, 'Total(obin^2*ps*4*pi)+ps[0]:', Total(obin^2*ps*4*!dpi)+ps[0] last_was = 6 construct_image, 0, TITLE=fieldname show_image END 'PARTICLE_EVERY':BEGIN oldv = parti.every WIDGET_CONTROL,Event.id,GET_VALUE=skip_h parti.every=skip_h react_to_every_particle_change, oldv, parti.every END 'PARTICLE_SIZE': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=skip_h parti.size=skip_h END 'PARTICLE_TYPE': BEGIN WIDGET_CONTROL,Event.id,GET_VALUE=skip_h parti.type=skip_h END 'SHOW_PEAKS': BEGIN show_peaks END 'CM_BUTTON': BEGIN If Verbose Then Print, 'Event for Color Map' xloadct, GROUP=TOP_BASE END 'VIEW_HIERARCHY': BEGIN If Verbose Then Print, 'Event for VIEW_HIERARCHY' if N_ELEMENTS(grid_info(0)) gt 0 THEN $ myeditor, grid_info(0).hier_file $ ELSE message, 'No grid info' END 'VIEW_PARAMETER': BEGIN If Verbose Then Print, 'Event for VIEW_PARAMETER' if N_ELEMENTS(grid_info(0)) gt 0 THEN BEGIN par_file = strmid(grid_info(0).hier_file, 0, $ STRPOS(grid_info(0).hier_file,'.hierarchy')) myeditor, par_file END ELSE message, 'No grid info' END 'INFO_BUTTON': BEGIN Print, 'Event for INFO' Print, 'xy_sl_size:', xy_sl_size Print, 'size(grid_info)', size(grid_info) Print, 'slice_ori:', slice_ori Print, 'slice_size:', slice_size Print, 'data_dir:', data_dir print, 'lengthunit:', lengthunit,' timeunit:', timeunit,' densityunit:',densityunit show_hierarchy_information, grid_info END 'PS_BUTTON': BEGIN IF VERBOSE THEN PRINT, 'Event for dump PS file' dump_ps, draw_area, draw_cm, TOP_BASE, $ [list_str(var_index),'sidelength ='+ $ STRCOMPRESS(string(slice_size(2)-slice_size(0)))] END 'GIF_BUTTON': BEGIN IF VERBOSE THEN PRINT, 'Event for dump GIF image' dump_ps, draw_area, draw_cm, TOP_BASE, $ [list_str(var_index),'sidelength ='+ $ STRCOMPRESS(string(slice_size(2)-slice_size(0)))], /GIF END 'JPEG_BUTTON': BEGIN IF VERBOSE THEN PRINT, 'Event for dump JPEG image' dump_jpeg, draw_area, draw_cm, TOP_BASE, $ [list_str(var_index),'sidelength ='+ $ STRCOMPRESS(string(slice_size(2)-slice_size(0)))] END 'FILE_BUTTON': BEGIN If Verbose Then Print, 'Event for FILE' widget_control, base2, sensitive = 0 widget_control, /hourglass open_file: wds = 0 open_file_dialog, was_dot_sav=wds if wds then return read_file: if (file_name ne '') then begin slash_is_at = StrPos(file_name, '/',/reverse_search) data_dir = STRMID(file_name, 0, slash_is_at+1) data_format = determine_data_format_from_file_name(file_name) if data_format eq 1 then read_speck_file, file_name if data_format eq 2 then read_gadget_file, file_name if data_format eq 4 or data_format eq 5 or data_format eq 6 then $ read_all_grid_info, file_list parti.read[*] = 1 time_index = N_elements(times)-1 select_current_grids set_list_widget_values endif widget_control, base2, sensitive = 1 END "SAVE_STATE": BEGIN save_name = DIALOG_PICKFILE(FILTER = '*.sav', $ TITLE = 'select a .sav file to save current jaques session.' , $ /WRITE) save_state, save_name END "NEW_WINDOW": BEGIN save_name = image_log_directory+'jaques-state-'+strcompress(currentWindowID, /remove_all)+'.sav' save, /comm, /variables, filename=save_name AMRslice, NO_BLOCK=block set_list_widget_values END 'PEAK_BUTTONS': BEGIN If Verbose Then Print, 'Event for PEAK_BUTTONS' this_one = WHERE(peak_ids eq FIX(Event.id)) this_one = this_one(0) current_peak = this_one FOR i=0,max_peak_nr-1 DO $ widget_control, peak_ids(i), set_button=0 widget_control, peak_ids(current_peak), set_button=1 print, 'pressed:', this_one center = DOUBLE(peaks(0:2, this_one)) this_sub = where(slice_ori gt 1.e-15) slice_ori(this_sub(0)) = center(this_sub(0)) slice_value = center(this_sub(0)) slh = DOUBLE(slice_size[2]-slice_size[0])/2 os = where(slice_ori lt 1.e-15) goto, set_sidelength_update_slider END 'READ_PEAKS': BEGIN If Verbose Then Print, 'Event for READ_PEAKS' widget_control, base2, sensitive = 0 help = ['PICK PEAK FILE', 'Select existing peak file or', $ 'specify a new file name to create your own list of peaks'] peak_file_name = dialog_pickfile(GROUP=TOP_BASE, FILTER = '*.peaks;*.dat', $ Path=data_dir+'../FOF', $ TITLE = 'Choose peak file', $ GET_PATH = peak_in_dir) widget_control,peak_opt, map = 0 IF peak_file_name ne '' THEN BEGIN exists = findfile(peak_file_name) print, file_name print, 'exists:',exists if (exists(0) eq '') then BEGIN current_peak_file = peak_file_name myeditor, peak_file_name, /NEW END ELSE BEGIN current_peak_file = peak_file_name read_peaks, peak_file_name, peaks, N_peaks, max_peak_nr if N_peaks gt 0 then begin junk_t = STRCOMPRESS(STRING(INDGEN(N_peaks)), /REMOVE_ALL) FOR i =N_peaks-1, max_peak_nr-1 DO $ widget_control, peak_ids(i), map = 0, $ set_value = '' , set_button=0 FOR i =0, N_peaks-1 DO $ widget_control, peak_ids(i), map = 1, set_value = junk_t(i) endif ENDELSE widget_control,peak_opt, map = 1 ENDIF widget_control, base2, sensitive = 1 END 'REREAD_PEAKS':BEGIN read_peaks, current_peak_file, peaks, N_peaks, max_peak_nr END 'EDIT_PEAKS': BEGIN If Verbose Then Print, 'Event for Edit Peaks' IF current_peak_file eq '' THEN BEGIN PRINT, 'INFO: No current peak file' PRINT, 'Use "read/create peaks" in File menu !' END ELSE BEGIN myeditor, current_peak_file read_peaks, current_peak_file, peaks, N_peaks, max_peak_nr junk_t = STRCOMPRESS(STRING(INDGEN(N_peaks)), /REMOVE_ALL) FOR i =0, max_peak_nr-1 DO $ widget_control, peak_ids(i), map = 0, set_value = '' FOR i =0, N_peaks-1 DO $ widget_control, peak_ids(i), map = 1, set_value = junk_t(i) ENDELSE END 'SLICER_BUTTON': BEGIN !p.t3d = 1. t3d, /reset !p.t(*)=0. !p.t3d = 0. WIDGET_CONTROL, base2, MAP = 1 WIDGET_CONTROL, COMPOSITE_BASE, MAP = 0 WIDGET_CONTROL, ISO_BASE, MAP = 0 WIDGET_CONTROL, BASE2, /REALIZE WIDGET_CONTROL, wISO,sensitive=1 WIDGET_CONTROL, wSLICER,sensitive=0 WIDGET_CONTROL, wCOMPOSITE,sensitive=1 show_image END 'CUBE_DIM': BEGIN WIDGET_CONTROL, Event.id, GET_VALUE = cube_dim END 'ISO_SMOOTH_VALUE':BEGIN WIDGET_CONTROL, Event.id, GET_VALUE = tmp threeD_smoothing=tmp(1) END 'LIGHT_DIRECTION':BEGIN aha = event.value##[1,0,0] shade_state.light_direction(0)=-aha(2) aha = event.value##[0,1,0] shade_state.light_direction(1)=-aha(2) aha = event.value##[0,0,1] shade_state.light_direction(2)=-aha(2) display_iso END 'SHADING_MODEL': BEGIN EVV = Event.Value CASE EVV OF "Light": BEGIN widget_control, shade_state.base(1), map=0 widget_control, shade_state.base(0), map=1,/update shade_state.this_state=0 END "Data": BEGIN widget_control, shade_state.base(0), map=0 widget_control, shade_state.base(1), map=1,/update shade_state.this_state=1 END ELSE: print, 'unrecognized button event' END END 'ISO_VAR_LIST': BEGIN If Verbose Then Print, 'Event for variable list' If Verbose Then Print, 'index:', Event.index shade_state.sds = Event.index+1 END 'SHADE_MINIMUM': BEGIN widget_control, Event.id, get_value=help_val shade_state.min=help_val(1) widget_control, /hourglass compute_em, draw_cm, wxysize,$ SHADE_EM=shade_state.this_state display_iso END 'SHADE_MAXIMUM': BEGIN widget_control, Event.id, get_value=help_val shade_state.max=help_val(1) widget_control, /hourglass compute_em, draw_cm, xy_sl_size,$ SHADE_EM=shade_state.this_state display_iso END 'DATA_SHADING_READ_BUTTON': BEGIN ; read data for shading update_shading END 'ISO_BUTTON': BEGIN ; widget_control, base2, sensitive = 0 widget_control, vel.baseid, MAP = 0 widget_control, base2, MAP = 0 WIDGET_CONTROL, COMPOSITE_BASE, MAP = 0 widget_control, ISO_BASE, MAP = 1 WIDGET_CONTROL, ISO_BASE, /REALIZE widget_control, wISO, sensitive=0 widget_control, wSLICER, sensitive=1 widget_control, wCOMPOSITE, sensitive=1 widget_control, vel.menuid, sensitive=1 widget_control, /hourglass ; initially have only light shading shade_state.this_state = 0 widget_control, base2, sensitive = 1 END 'COMPOSITE_BUTTON': BEGIN WIDGET_CONTROL, COMPOSITE_BASE, MAP = 1 WIDGET_CONTROL, base2, MAP = 0 WIDGET_CONTROL, ISO_BASE, MAP = 0 WIDGET_CONTROL, COMPOSITE_BASE, /REALIZE WIDGET_CONTROL, wISO,sensitive=1 WIDGET_CONTROL, wSLICER,sensitive=1 WIDGET_CONTROL, wCOMPOSITE,sensitive=0 END 'CONTOUR_BUTTON': BEGIN widget_control, /hourglass contour_image END 'NO_VEL':BEGIN widget_control, wTab, set_tab_current=0 widget_control, vel.menuid, set_value='Vel. vectors', $ SET_UVALUE='VEL_BUTTON' vel.myturn = 0 END 'VEL_BUTTON': BEGIN widget_control, wTab, set_tab_current=1 widget_control, vel.menuid, set_value='hide vector', $ SET_UVALUE='NO_VEL' vel.myturn = 1 widget_control, parti_menuid, set_value='Particles Interface', $ SET_UVALUE='PARTICLES_BUTTON' parti.myturn = 0 widget_control, hi.menuid, set_value='Histograms', $ SET_UVALUE='HISTOGRAMS' hi.myturn = 0 END 'PARTICLES_BUTTON': BEGIN if N_elements(where((*parti.names) ne '')) lt 2 then begin print, 'these data have no particle information.' return END widget_control, wTab, set_tab_current=2 widget_control, parti_menuid, set_value='Hide Particles Interface', $ SET_UVALUE='NO_PARTICLES' parti.myturn = 1 widget_control, vel.menuid, set_value='Vel. vectors', $ SET_UVALUE='VEL_BUTTON' vel.myturn = 0 widget_control, hi.menuid, set_value='Histograms', $ SET_UVALUE='HISTOGRAMS' hi.myturn = 0 END 'NO_PARTICLES':BEGIN widget_control, wTab, set_tab_current=0 widget_control, parti_menuid, set_value='Particles Interface', $ SET_UVALUE='PARTICLES_BUTTON' parti.myturn = 0 END 'PARTICLE_NAME_LIST':BEGIN parti.index = event.index END 'HISTOGRAMS': BEGIN widget_control, wTab, set_tab_current=3 widget_control, hi.menuid, set_value='Hide Histogram Interface', $ SET_UVALUE='NO_HISTOGRAMS' hi.myturn = 1 widget_control, vel.menuid, set_value='Vel. vectors', $ SET_UVALUE='VEL_BUTTON' vel.myturn = 0 widget_control, parti_menuid, set_value='Particles Interface', $ SET_UVALUE='PARTICLES_BUTTON' parti.myturn = 0 END 'NO_HISTOGRAMS':BEGIN widget_control, wTab, set_tab_current=0 widget_control, hi.menuid, set_value='Histograms', $ SET_UVALUE='HISTOGRAMS' hi.myturn = 0 END 'BGROUP_VB': BEGIN CASE Event.Value OF 0: begin If Verbose Then Print,'Button V Pressed' vector_field_b = 0 vel.read = 0 cons_vel = [0.,0.] end 1: begin If Verbose Then Print,'Button B Pressed' vector_field_b = 1 vel.read = 0 cons_vel = [0.,0.] end ELSE: Message,'Unknown button pressed' ENDCASE END '4D2_BUTTON': BEGIN If Verbose Then Print, 'Event for dump 4d2' widget_control, base2, sensitive = 0 cube_center = slice_ori cube_center(where(slice_ori lt 1.e-30)) = $ [slice_size(0)+0.5*(slice_size(2)-slice_size(0)), $ slice_size(1)+0.5*(slice_size(3)-slice_size(1))] cube_length = slice_size(2)-slice_size(0) dump_4d2_data, cube_center, cube_length if verbose then print, 'done with dump 4d2 data' widget_control, base2, sensitive = 1 END 'SET_BUTTON': BEGIN unitfactor = get_unit(image_stack[image_index].title) IF image_stack(image_index).title NE '' THEN begin if image_stack[0].is_log then $ mi_ma = alog10([10^image_stack(image_index).min_data, 10^image_stack(image_index).max_data]*unitfactor) $ else mi_ma = [image_stack(image_index).min_data, image_stack(image_index).max_data]*unitfactor END ELSE mi_ma = [0.,1.] widget_control, /hourglass set_mi_ma, TOP_BASE, mi_ma_base_id, MI_MA=mi_ma END 'REFRESH_BUTTON': BEGIN widget_control, /hourglass show_image fresh_image = 1 END 'KEEP_BUTTON': BEGIN image_stack(image_index).image_d = ptr_new(tvrd()) ; FOR i=N_images-1,1,-1 DO image_stack(i) = image_stack(i-1) END 'IMAGE_STACK': BEGIN image_stack[image_index].image_d = ptr_new(tvrd(TRUE=1)) image_stack[image_index].is_true_color = 1 image_stack[image_index].last_was = last_was image_index = FIX(EVENT.value) vel.read = 0 if ptr_valid(image_stack(image_index).image_d) ne '' THEN BEGIN last_was = image_stack[image_index].last_was show_image, /REFRESH END widget_control, event.id, set_value = image_index END 'DONE_BUTTON': BEGIN If Verbose Then Print, 'Event for DONE' widget_control, /DESTROY, Event.top END 'IMAGESIZE': BEGIN widget_control, /hourglass set_large_image_dimensions, TOP_BASE, xysize=xy_sl_size END 'I_IMAGESIZE': BEGIN wxysize = 1.1*wxysize xy_sl_size = wxysize widget_control,draw_area, xsize=wxysize, ysize=wxysize,draw_xsize=xy_sl_size,draw_ysize=xy_sl_size widget_control,draw_cm, xsize=wxysize, draw_xsize=xy_sl_size END 'D_IMAGESIZE': BEGIN wxysize = 0.9 * wxysize xy_sl_size = wxysize widget_control,draw_area, xsize=wxysize, ysize=wxysize,draw_xsize=xy_sl_size,draw_ysize=xy_sl_size widget_control,draw_cm, xsize=wxysize, draw_xsize=xy_sl_size END 'WILLTAKELOG': BEGIN will_take_log END 'IMAGELOG': BEGIN image_log = (image_log eq 0) ? 1 : 0 if verbose then print, 'loggin image:', image_log, ' (0=off, 1=on)' widget_control, imagelogbutton,set_value=imagelogmenustrings[image_log] END 'TOGGLEUNITS': BEGIN useunits = (useunits eq 0) ? 1 : 0 if verbose then print, 'use units', useunits, ' (0=off(code), 1=on(CGS))' widget_control, toggleunitsbutton,set_value=toggleunitsmenustrings[useunits] ; if useunits then unitfactor = get_unit(image.title, /ufactor) show_image draw_current_cm, draw_cm, wxysize, image_stack[image_index].min_data, image_stack[image_index].max_data END 'COMPOSITE_PLUS': BEGIN if composite_count+1 ge (size(composite_rows))[2] then begin WIDGET_CONTROL, event.top, UPDATE=0 create_composite_row WIDGET_CONTROL, composite_rows[0, composite_count+1], /realize WIDGET_CONTROL, composite_rows[0, composite_count+1], MAP=1 WIDGET_CONTROL, event.top, /UPDATE endif else begin row_id = composite_count+1 WIDGET_CONTROL, composite_rows[0, row_id], MAP=1 endelse composite_count += 1 END 'COMPOSITE_ROW_MINUS': BEGIN for i=composite_row_id,composite_count-1 do begin combo_1 = composite_rows[1, i] combo_2 = composite_rows[1, i+1] n = 0L reads, WIDGET_INFO(combo_2, /COMBOBOX_GETTEXT), n WIDGET_CONTROL, combo_1, set_combobox_select=n endfor WIDGET_CONTROL, composite_rows[0, composite_count], MAP=0 composite_count -= 1 END 'COMPOSITE_ROW_PREVIEW': BEGIN reads, WIDGET_INFO(composite_rows[1, composite_row_id], /COMBOBOX_GETTEXT), image_index show_image, INDEX=image_index END ELSE: ENDCASE IF image_log AND fresh_image THEN save_image_log heap_gc ; , /verbose turns out there's lots more to be done to clean up this code ... if (not hi.myturn) and ptr_valid(oj) then oj->delete3Dcache ; setting this highlights the variable tab and we can use arrow keys ; to go up and down the list if (ev ne 'DONE_BUTTON') then widget_control, variable_list_widget, /input_focus RETURN END pro initialize, var, val if N_elements(var) lt 1 then var = val return end PRO AMRslice, NO_BLOCK=block ; GROUP=Group @common_blocks.inc loadct, 0 @~/.jacquesrc if N_elements(block) eq 0 then block=1 initialize, verbose, 0 initialize, stopit, 0 ; initial values initialize, center, [0.5, 0.5, 0.5] initialize, slice_value, center[1] initialize, depth_value, 1. initialize, slice_ori, [0,slice_value,0] initialize, slice_size, [0.D,0.D,1.D,1.D] initialize, lengthunit, 1. initialize, timeunit, 1. initialize, densityunit, 1. initialize, InitialRedshift, 0. initialize, Gamma, 5./3. initialize, DomainLeftEdge, [0.,0.,0.] initialize, DomainRightEdge, [1.,1.,1.] initialize, use_nice_font, 0 screen_size=min(get_screen_size()) initialize, wxysize, screen_size-300 if N_ELEMENTS(wxysize) ne 1 then wxysize = 1100 < ROUND(screen_size*.72/2)*2 ; wxysize = 768 if N_ELEMENTS(xy_sl_size) ne 1 then xy_sl_size = wxysize if N_ELEMENTS(useunits) ne 1 then useunits=0 initialize, temperatureunit, 1. initialize, fastmode, 1 initialize, smoothing, 0.0 initialize, interpolate_i, 0 initialize, last_was, 0 initialize, vector_field_b, 0 initialize, vel_normal, 0 initialize, astep, 1 ; animation step size. 1: every data file, 2: every 2nd etc ; grid_info = grid_in_info initialize, data_dir, '~/' file_name = '' initialize, var_index, 0 initialize, line_index, 0 initialize, list_str, 'no data read yet' initialize, zflag, -1 initialize, time_index, 0 initialize, times, [-1.] initialize, redshifts, [0.D] initialize, cons_vel, [0., 0.] initialize, substracting_vel, 0 ; prepare Imagestack initialize, N_images, 9 image_index = 0 Image_structure = {image, $ title: '', $ hier_file: '', $ image_d: PTR_NEW([0,0]), $ xy_size: 1, $ min_data: 0., $ max_data: 0., $ is_log: 0, $ slice_size: DBLARR(4), $ is_true_color: 0, $ last_was: 0 $ } image_log_string = $ strjoin((strsplit(systime(/utc),/extract))[[1,2,4,0,3]], '-')+'-jaques-log-' initialize, image_log, 0 initialize, image_log_directory, '/tmp/' if image_log then print, 'logging to ', image_log_directory + image_log_string image_log_number = 0L cmap = cmap24() ; peak stuff max_peak_nr = 9 initialize, N_peaks, 5 initialize, peaks, [5e-5,5e-5,0.5] initialize, current_peak_file, '' current_peak = 0 ; iso stuff initialize, cube_dim, 256 initialize, threeD_smoothing, 0.0 read_moltab ; initialize molecular data shade_state= {shade_state, main_base:LONG(0), this_state:0, base:LONG([0,0]), $ sds:0, light_direction:[0.,0.,1.], $ min:0.,max:1.,min_s:LONG(0),max_s:LONG(0), xa:0.,za:0.} help_image = {image, '', '', $ ptr_new(DBLARR(xy_sl_size,xy_sl_size), /no_copy), xy_sl_size, 0., 1., 0, slice_size, 0, 0} image_stack = REPLICATE(help_image, N_images) ; IF N_ELEMENTS(Group) EQ 0 THEN GROUP=0 group = 0 junk = { CW_PDMENU_S, flags:0, name:'' } TOP_BASE = WIDGET_BASE(GROUP_LEADER=Group, $ ROW=1, TAB=1, $ MAP=1, FRAME = 4, $ TITLE="JACQUES - Enzo's Best friend" , $ UVALUE='J', MBAR=wMenuBar, TLB_FRAME_ATTR=1, /TRACKING_EVENTS) currentWindowID = TOP_BASE parent = WIDGET_BASE(TOP_BASE, $ MAP=1, FRAME=4, $ UVALUE='BASE2') ; BASE2 = WIDGET_BASE(parent, /COLUMN, MAP=1, SCR_XSIZE=350,Y_SCROLL_SIZE=wxysize+100, UVALUE='BASE2') ; projector BASE2 = WIDGET_BASE(parent, /COLUMN, MAP=1, UVALUE='BASE2') ISO_BASE = WIDGET_BASE(parent, /COLUMN, MAP=0, UVALUE = 'VALUE_BASE') COMPOSITE_BASE = WIDGET_BASE(parent, /COLUMN, MAP=0, UVALUE = 'COMPOSITE_BASE', ysize=800) BASE4 = WIDGET_BASE(TOP_BASE, $ COLUMN=1, $ MAP=1, FRAME = 4, $ UVALUE='BASE4') Btns123 = ['x', $ 'y', $ 'z' ] i_ind= FIX(where(slice_ori gt 0)) SLICE_BGROUP = CW_BGROUP( BASE2, Btns123, $ SET_VALUE = i_ind[0], $ ROW=1, $ /EXCLUSIVE, $ LABEL_LEFT='Slice: ', $ UVALUE='BGROUP10') hold_base = widget_base(base4, COLUMN=16, Frame = 2) TIME_LIST_WIDGET = WIDGET_COMBOBOX(hold_base, $ VALUE = ['file list from .mhierarchy or by selecting a directory in the open dialog.'], $ UVALUE='TIME_LIST' , xsize=wxysize/2 , /dynamic_resize ) ; peak stuff junk_t = STRARR(max_peak_nr) junk_t(*) = '' junk = widget_label(hold_base, value='Images') junk_t = STRCOMPRESS(STRING(INDGEN(N_images)), /REMOVE_ALL) junk = CW_BGROUP(hold_base, COLUMN = N_images, /EXCLUSIVE, $ junk_t, UVALUE = 'IMAGE_STACK', $ BUTTON_UVALUE = b_uvalues, SET_VALUE = 0) slider_base = Widget_base(base2, COLUMN=2) junk = CW_MYFSLIDER( slider_base, $ MAXIMUM=1.00000, $ MINIMUM=0.00001, $ UVALUE='SLICE_VAL', $ FORMAT='(F13.9)', $ VALUE=slice_value, /EDIT, XSIZE=60) ; TITLE='slice coord', $ slice_val_w = junk junk = CW_MYFSLIDER( slider_base, $ MAXIMUM=1.00000, $ MINIMUM=1e-10, $ UVALUE='DEPTH_VAL', $ FORMAT='(F13.6)', $ VALUE=1, /EDIT, XSIZE=60) ; TITLE='slice coord', $ depth_val_w = junk Btns123 = [ $ 'no', $ 'lin.', $ 'p', $ 'g'] BGROUP_INT = CW_BGROUP( BASE2, Btns123, $ SET_VALUE = interpolate_i, $ ROW=1, $ /EXCLUSIVE, /NO_RELEASE,$ LABEL_LEFT='interpolation:', $ UVALUE='BGROUP_INTER') SLICE_TEXT = WIDGET_TEXT(BASE2, $ YSIZE = 6, UVALUE='SLICE_TEXT') wTab = WIDGET_TAB(Base2) variablebase = WIDGET_BASE(wTab,TITLE='Variables', /COLUMN) dummy = widget_label(variablebase, value='variable:', /align_left) variable_list_widget = WIDGET_COMBOBOX( variablebase, VALUE = List_str, $ UVALUE='VAR_LIST', /dynamic_resize ) widget_control, variable_list_widget, set_combobox_select = var_index dummy = widget_label(variablebase, value='Line:', /align_left) line_str = (line_emissivity(/AVAILABLE_LINES)).name line_list_widget = WIDGET_COMBOBOX( variablebase, VALUE = line_str, $ UVALUE='LINE_LIST', /dynamic_resize ) widget_control, line_list_widget, set_combobox_select = line_index PROJ_BASE = WIDGET_BASE(variablebase, /COLUMN, MAP=1, UVALUE = 'PROJ_BASE',FRAME=1, TITLE='Projections') weight_index = 0 dummy = widget_label(proj_base, value='Projections', /align_left) dummy = widget_label(proj_base, value='weight:', /align_left) weight_list_widget = WIDGET_COMBOBOX( proj_base, $ VALUE = ['none',List_str[*]], $ UVALUE='WEIGHT_LIST', /dynamic_resize ) widget_control, weight_list_widget, set_combobox_select = weight_index VEL_BASE = WIDGET_BASE(wTab, /COLUMN, MAP=1, UVALUE = 'VEL_BASE',FRAME=1, TITLE='Vectors');, /Grid_layout) PART_BASE = WIDGET_BASE(wTab, /COLUMN, MAP=1, UVALUE = 'PART_BASE',FRAME=1, TITLE='Particles');, /grid_layout) HIST_BASE = WIDGET_BASE(wTab, /COLUMN, MAP=1, UVALUE = 'HIST_BASE',FRAME=1, TITLE='Histograms');, /grid_layout) PEAK_BASE = WIDGET_BASE(wTab, /COLUMN, MAP=0, UVALUE = 'PEAKS_BASE',FRAME=1, TITLE='Peaks');, /grid_layout) n = n_elements(junk_t) peak_ids = lonarr(n) junk_base = lonarr(n) for i = 0, n-1 do begin junk_base[i] = WIDGET_BASE(peak_base,/COLUMN,/NONEXCLUSIVE,map=0 ) peak_ids[i] = WIDGET_BUTTON(junk_base(i), value=junk_t(i), UVALUE='PEAK_BUTTONS',$ /DYNAMIC_RESIZE ) endfor junk_t = STRCOMPRESS(STRING(INDGEN(max_peak_nr)), /REMOVE_ALL) FOR i =0, N_peaks-1 DO $ widget_control, peak_ids(i), map = 0, set_value = junk_t(i), set_button=0 peak_opt = Widget_base(peak_base, /ROW, MAP = 0) peak_update = WIDGET_BUTTON(peak_opt, $ VALUE='Reread', UVALUE='REREAD_PEAKS') peak_edit = WIDGET_BUTTON(peak_opt, VALUE='Edit', UVALUE='EDIT_PEAKS') widget_control, peak_base, map=0 DRAW_AREA = WIDGET_DRAW(BASE4, XSIZE = xy_sl_size, YSIZE = xy_sl_size, $ X_SCROLL_SIZE = wxysize, Y_SCROLL_SIZE = wxysize, $ /BUTTON, /MOTION, RETAIN=2, UVALUE = 'draw_area') DRAW_CM = WIDGET_DRAW(BASE4, XSIZE = wxysize, YSIZE = 80, $ /BUTTON, /MOTION, RETAIN=2, /TRACKING_EVENTS,$ UVALUE = 'draw_cm') ; wBase = WIDGET_BASE(TOP_BASE, /COLUMN, SPACE=0) wFileMenu = WIDGET_BUTTON(wMenuBar, VALUE='File', /MENU) wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Open', UVALUE='FILE_BUTTON', $ ACCELERATOR='Ctrl+O') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Save Current State', UVALUE='SAVE_STATE', $ ACCELERATOR='Ctrl+Shift+S') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='New Window', UVALUE='NEW_WINDOW', $ ACCELERATOR='Ctrl+W') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Read/Create peaks', UVALUE='READ_PEAKS') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Save as PS', UVALUE='PS_BUTTON') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Save as Gif', UVALUE='GIF_BUTTON') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Save as jpeg', UVALUE='JPEG_BUTTON',ACCELERATOR='Ctrl+S') wLoadItem = WIDGET_BUTTON(wFileMenu, VALUE='Dump hdf cube (4d2)', UVALUE='4D2_BUTTON') wItem = WIDGET_BUTTON(wFileMenu, VALUE='Export to Amira', UVALUE='AMIRA EXPORT', $ ACCELERATOR='Ctrl+Shift+E') wItem = WIDGET_BUTTON(wFileMenu, VALUE='Export current grids to Amira', UVALUE='CURRENT AMIRA EXPORT', $ ACCELERATOR='Ctrl+E') wItem = WIDGET_BUTTON(wFileMenu, VALUE='Export grids to partiview .amrbox file', UVALUE='PARTIVEW EXPORT') wItem = WIDGET_BUTTON(wFileMenu, VALUE='Export current grids to partiview .amrbox file', UVALUE='CURRENT PARTIVEW EXPORT') wItem = WIDGET_BUTTON(wFileMenu, VALUE='Export particles to partiview .speck file', UVALUE='PARTIVEW PARTICLE EXPORT') wItem = WIDGET_BUTTON(wFileMenu, VALUE='Export current particles to partiview .speck file', UVALUE='CURRENT PARTICLE PARTIVEW EXPORT') wExitItem = WIDGET_BUTTON(wFileMenu, VALUE='Exit', UVALUE='DONE_BUTTON',$ ACCELERATOR="Ctrl+Q") wMenu = WIDGET_BUTTON(wMenuBar, VALUE='View', /MENU) DRAW_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='DRAW_BUTTON',VALUE='Draw',ACCELERATOR="Ctrl+D") PROJ_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='PROJECT',VALUE='Project',ACCELERATOR="Ctrl+Shift+D") PROJABS_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='PROJECTABS',VALUE='Project with Absorption',ACCELERATOR="Ctrl+G") PROJHII_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='PROJECTHII',VALUE='Project HII Picture',ACCELERATOR="Ctrl+Shift+G") FASTMODE_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='FASTMODE_BUTTON',VALUE='Toggle fast mode',ACCELERATOR="Ctrl+M") KEEP_BUTTON = WIDGET_BUTTON( wMenu,UVALUE='KEEP_BUTTON', VALUE='Keep',ACCELERATOR="Ctrl+K") REFRESH_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='REFRESH_BUTTON',VALUE='Refresh',ACCELERATOR="Ctrl+R") REFRESH_BUTTON = WIDGET_BUTTON( wMenu, UVALUE='CYCLE_RENDER_OPTION',VALUE='Cycle render options',ACCELERATOR="Ctrl+Shift+R") wISO = WIDGET_BUTTON(wMenu, VALUE='Isosurface', UVALUE='ISO_BUTTON') wSLICER = WIDGET_BUTTON(wMenu, VALUE='Slicer', UVALUE='SLICER_BUTTON') widget_control, wSLICER,sensitive=0 wCOMPOSITE = WIDGET_BUTTON(wMenu, VALUE='Composite', UVALUE='COMPOSITE_BUTTON') wItem = WIDGET_BUTTON(wMenu, VALUE='Contour plot', UVALUE='CONTOUR_BUTTON', ACCELERATOR='Ctrl+Shift+C') wVEL = WIDGET_BUTTON(wMenu, VALUE='Draw vector field', UVALUE='VEL_BUTTON', ACCELERATOR='Ctrl+V') wpart = WIDGET_BUTTON(wMenu, VALUE='Particles Interface', UVALUE='PARTICLES_BUTTON', ACCELERATOR='Ctrl+P') histmenuid = WIDGET_BUTTON(wMenu, UVALUE='HISTOGRAMS',VALUE='Histograms',ACCELERATOR="Ctrl+H") wItem = WIDGET_BUTTON(wMenu, VALUE='Grid chart', UVALUE='SHOW_CHART', ACCELERATOR='Ctrl+Shift+B') wItem = WIDGET_BUTTON(wMenu, VALUE='Grid boxes', UVALUE='SHOW_BOXES', ACCELERATOR='Ctrl+B') ; wItem = WIDGET_BUTTON(wMenu, VALUE='Particle positions', UVALUE='PART_POS',ACCELERATOR='Ctrl+P') ; wItem = WIDGET_BUTTON(wMenu, VALUE='Particle positions overlayed', UVALUE='PLOT_PARTICLES',ACCELERATOR='Ctrl+Shift+P') wItem = WIDGET_BUTTON(wMenu, VALUE='Plot Powerspectrum', UVALUE='PLOT_POWERSPECTRUM',ACCELERATOR='Ctrl+Shift+P') wItem = WIDGET_BUTTON(wMenu, VALUE='Peaks', UVALUE='SHOW_PEAKS') wItem = WIDGET_BUTTON(wMenu, VALUE='Color Map', UVALUE='CM_BUTTON', ACCELERATOR='Ctrl+C') wItem= WIDGET_BUTTON(wMenu, VALUE='Change Min and Max', UVALUE='SET_BUTTON', ACCELERATOR='Ctrl+Shift+M') wItem = WIDGET_BUTTON(wMenu, VALUE='Data info', UVALUE='INFO_BUTTON', ACCELERATOR='Ctrl+Shift+I') wItem = WIDGET_BUTTON(wMenu, VALUE='Hierarchy file', UVALUE='VIEW_HIERARCHY') wItem = WIDGET_BUTTON(wMenu, $ VALUE='Data parameter file',UVALUE='VIEW_PARAMETER') wMenu = WIDGET_BUTTON(wMenuBar, VALUE='Zoom', /MENU) wItem = WIDGET_BUTTON(wMenu, VALUE='in by 2', UVALUE='Zoom.in by 2', ACCELERATOR='Ctrl+Shift+Z') wItem = WIDGET_BUTTON(wMenu, VALUE='in by 4', UVALUE='Zoom.in by 4') wItem = WIDGET_BUTTON(wMenu, VALUE='in by 10', UVALUE='Zoom.in by 10', ACCELERATOR='Ctrl+Z') wItem = WIDGET_BUTTON(wMenu, VALUE='in by 100', UVALUE='Zoom.in by 100') wItem = WIDGET_BUTTON(wMenu, VALUE='in by 1000', UVALUE='Zoom.in by 1000') wItem = WIDGET_BUTTON(wMenu, VALUE='pick', UVALUE='Zoom.pick') wItem = WIDGET_BUTTON(wMenu, VALUE='out by 2', UVALUE='Zoom.out by 2', ACCELERATOR='Ctrl+Shift+X') wItem = WIDGET_BUTTON(wMenu, VALUE='out by 5', UVALUE='Zoom.out by 5') wItem = WIDGET_BUTTON(wMenu, VALUE='out by 10', UVALUE='Zoom.out by 10', ACCELERATOR='Ctrl+X') wItem = WIDGET_BUTTON(wMenu, VALUE='top', UVALUE='Zoom.top', ACCELERATOR='Ctrl+T') ; ZOOM_BUTTON = CW_PDMENU(wMenuBar, desc, /RETURN_FULL_NAME, $ ; UVALUE='ZOOM_BUTTON', /MBAR, ACCELRATOR='Ctrl-Z') wMenu = WIDGET_BUTTON(wMenuBar, VALUE='Tools', /MENU) wItem = WIDGET_BUTTON(wMenu, VALUE='Find max', UVALUE='Find max', Accelerator='Ctrl+Shift+F') wItem = WIDGET_BUTTON(wMenu, VALUE='Find max on finest level', UVALUE='Find max on finest level', Accelerator='Ctrl+F') wItem = WIDGET_BUTTON(wMenu, VALUE='Previous time step', UVALUE='PREVIOUS TIME STEP', ACCELERATOR='Ctrl+Shift+N') wItem = WIDGET_BUTTON(wMenu, VALUE='Next time step', UVALUE='NEXT TIME STEP', ACCELERATOR='Ctrl+N') wItem = WIDGET_BUTTON(wMenu, VALUE='Watch for Next step', UVALUE='WATCH NEXT TIME STEP', ACCELERATOR='Ctrl+Shift+W') wItem = WIDGET_BUTTON(wMenu, VALUE='Next variable', UVALUE='NEXT VARIABLE', ACCELERATOR='Alt+V') wItem = WIDGET_BUTTON(wMenu, VALUE='Previous variable', UVALUE='PREVIOUS VARIABLE', ACCELERATOR='Alt+Shift+V') wItem = WIDGET_BUTTON(wMenu, VALUE='Clear File list', UVALUE='CLEAR FILE LIST') wItem = WIDGET_BUTTON(wMenu, VALUE='Write file list', UVALUE='WRITE FILE LIST') wItem = WIDGET_BUTTON(wMenu, VALUE='Send to iTools', UVALUE='SLICE ITOOL', ACCELERATOR='Ctrl+I') wItem = WIDGET_BUTTON(wMenu, VALUE='SDvision', UVALUE='SDVISION', ACCELERATOR='Ctrl+Shift+V') wItem = WIDGET_BUTTON(wMenu, VALUE='Annotate CM', UVALUE='AN_CM') wItem = WIDGET_BUTTON(wMenu, VALUE='Annotate Graph', UVALUE='AN_DRAW') wItem = WIDGET_BUTTON(wMenu, VALUE='Examine Text file', UVALUE='EDITOR') wItem = WIDGET_BUTTON(wMenu, VALUE='Calculator', UVALUE='Calculator') wItem = WIDGET_BUTTON(wMenu, VALUE='Xpalette', UVALUE='XPALETTE') wItem = WIDGET_BUTTON(wMenu, VALUE='Animate', UVALUE='MOVIE', ACCELERATOR='Ctrl+Shift+A') wMenu = WIDGET_BUTTON(wMenuBar, VALUE='Options', /MENU) wItem = WIDGET_BUTTON(wMenu, VALUE='Image Size', UVALUE='IMAGESIZE') wItem = WIDGET_BUTTON(wMenu, VALUE='Increase Draw area', UVALUE='I_IMAGESIZE', $ ACCELERATOR='Ctrl+F12') wItem = WIDGET_BUTTON(wMenu, VALUE='Decrease Draw area', UVALUE='D_IMAGESIZE', $ ACCELERATOR='Ctrl+F11') imagelogmenustrings = ['Turn On Logging Images', 'Turn Off Logging Images'] willtakelogbutton = WIDGET_BUTTON(wMenu, VALUE='Choose wich fields to log', UVALUE='WILLTAKELOG', $ ACCELERATOR='Ctrl+L') imagelogbutton = WIDGET_BUTTON(wMenu, VALUE=imagelogmenustrings[image_log], UVALUE='IMAGELOG', $ ACCELERATOR='Ctrl+Shift+L') toggleunitsmenustrings = ['Use CGS units', 'Use code units'] toggleunitsbutton = WIDGET_BUTTON(wMenu, VALUE=toggleunitsmenustrings[image_log], UVALUE='TOGGLEUNITS', $ ACCELERATOR='Ctrl+U') wHelpMenu = WIDGET_BUTTON(wMenuBar, VALUE='Help', /HELP, /MENU) wInfoItem = WIDGET_BUTTON(wHelpMenu, VALUE='Help', UVALUE='HELP') wInfoItem = WIDGET_BUTTON(wHelpMenu, VALUE='About...', UVALUE='About') ; ------------------------------ ISO SURFACE STUFF --------------------------- IS_VAL = CW_myFSLIDER( ISO_BASE, $ MAXIMUM=max_v, $ MINIMUM=min_v,$ UVALUE = 'IS value', $ TITLE='IS value', $ VALUE=is_value, /EDIT) BTNS = ["Compute", 'Weigh','(Re)Read','IDL SLICER'] BGROUP = CW_BGROUP(ISO_BASE, BTNS, $ COLUMN=4, $ UVALUE='BTNS', $ /RETURN_NAME) ; variable shading models isojunk = widget_base(ISO_BASE,/COLUMN,FRAME=3) junk = CW_BGROUP(isojunk, /ROW, /EXCLUSIVE, /NO_REL, LABEL_LEFT='Shading',$ ['Light', 'Data'], $ UVALUE='SHADING_MODEL', SET_VALUE=0, $ /RETURN_NAME) shade_state.main_base = WIDGET_BASE(isojunk) for i=0,1 DO shade_state.base(i) = WIDGET_BASE(shade_state.main_base,$ /COLUMN,/FRAME) fbase = WIDGET_BASE(shade_state.base(0)) fbasetwo = WIDGET_BASE(shade_state.base(1),/column) temp_index = (where(STRPOS(List_str,'emper') ne -1)) IF N_ELEMENTS(temp_index) gt 0 THEN temp_index = temp_index(0) $ ELSE temp_index = 0 ; light model base help = indgen(5)+1 while max(help) lt !D.table_size-3 DO help=(1.1*help) help = Round(help/1.1) junk = CW_ARCBALL(fbase, LABEL='light direction', $ size=100, $ UVALUE = 'LIGHT_DIRECTION', RETAIN = 2, /UPDATE, $ colors = findgen(6)/5*255) junk = WIDGET_COMBOBOX(fbasetwo, VALUE = List_str, $ UVALUE='ISO_VAR_LIST',/dynamic_resize) shade_state.sds = temp_index+1 shade_state.min_s = CW_myFSLIDER(fbasetwo, $ MAXIMUM=5., $ MINIMUM=0.1,$ UVALUE = 'SHADE_MINIMUM', $ TITLE='shade min', $ VALUE=1.) nextbase = WIDGET_BASE(fbasetwo,/COLUMN) shade_state.max_s = CW_myFSLIDER(nextbase, $ MAXIMUM=5., $ MINIMUM=0.1,$ UVALUE = 'SHADE_MAXIMUM', $ TITLE='shade max', $ VALUE=1.) nextbase = WIDGET_BASE(nextbase,/COLUMN) BTNS = 'Read' BGROUP = WIDGET_BUTTON(nextbase, VALUE=BTNS, $ UVALUE='DATA_SHADING_READ_BUTTON') ori = CW_ORIENT(ISO_BASE, FRAME = 3, UVALUE = 'ORI') junk = CW_FIELD(ISO_BASE,VALUE=cube_dim, $ TITLE='Cube dim & smoothing:', $ COLUMN=1, $ INTEGER=1, $ RETURN_EVENTS=1, $ UVALUE='CUBE_DIM') ISO_SMOOTH_VALUE_W = CW_myFSLIDER(ISO_BASE, FORMAT='(F3.1)', $ MAXIMUM=10., $ MINIMUM=0.,$ UVALUE = 'ISO_SMOOTH_VALUE', $ VALUE=threeD_smoothing, /EDIT) ; ----------------------------------------------------------------------- ; --------------------- COMPOSITE STUFF --------------------------------- junk = WIDGET_LABEL(COMPOSITE_BASE,VALUE='Composite Layers from Image Stack') comp_header_base = WIDGET_BASE(COMPOSITE_BASE,/ROW) junk = WIDGET_BUTTON(comp_header_base,UVALUE='COMPOSITE_PLUS',VALUE=' + ') junk = WIDGET_BUTTON(comp_header_base,UVALUE='COMPOSITE_GO',VALUE='Composite') junk = WIDGET_BUTTON(comp_header_base,UVALUE='COMPOSITE_SAVE',VALUE='Push onto stack') composite_rows = REFORM(LONARR(3), 3, 1) composite_count = 0 for i=1,8 do begin create_composite_row endfor ; ----------------------------------------------------------------------- ; --------------------- VELOCITY STUFF ---------------------------------- def_skip = FIX(wxysize/30) > 5 < 40 def_amp = 4. vel_structur = {velocity, skip:10, amplify:4., $ color : 0, baseid:0, menuid:0,myturn:0, read:0} vel ={velocity, def_skip, def_amp, $ !d.table_size-1, VEL_BASE, wVEL, 0, 0} ; junk = WIDGET_LABEL(VEL_BASE,VALUE='velocity vectors') BtnsVB = ['V', 'B'] VBBGROUP = CW_BGROUP( VEL_BASE, BtnsVB, $ SET_VALUE = vector_field_b, $ ROW=1, $ /EXCLUSIVE, /NO_RELEASE,$ LABEL_left='vector field:', $ UVALUE='BGROUP_VB') junk = WIDGET_SLIDER( VEL_BASE, $ /DRAG, $ MAXIMUM=40, $ MINIMUM=3,$ UVALUE = 'Vel_skip', $ TITLE='Skip factor', $ VALUE=vel.skip) junk = CW_myFSLIDER( VEL_BASE, $ MAXIMUM=10., $ MINIMUM=0.001,$ UVALUE = 'Vel_amp', $ TITLE='amplify ', $ VALUE=def_amp, /EDIT) junk = CW_MYCLR_INDEX(VEL_BASE, start_color = 0, NCOLORS=!D.table_size, $ xsize=100,UVALUE="VEL_COL_SEL", LABEL="Color") BTNS = ['Read','Substract','Plot', 'Reset', 'Hide','Normal'] GBASE = WIDGET_BASE(VEL_BASE, COLUMN=3) wb = WIDGET_BUTTON(GBASE, VALUE="Substract", UVALUE="VELSubstract", TOOLTIP="Asks to click a point. The vector at that position will be vector substracted from the entire 2d slice." ) wb = WIDGET_BUTTON(GBASE, VALUE="Reset", UVALUE="VELReset", TOOLTIP="Uses initial vector field. I.e. without the substracted vector defined by SUBSTRACT." ) wb = WIDGET_BUTTON(GBASE, VALUE="Quiver Plot", UVALUE="VELPlot", TOOLTIP="Overplots vector field." ) wb = WIDGET_BUTTON(GBASE, VALUE="Line Plot", UVALUE="VELLines", TOOLTIP="Overplots streamlines." ) wb = WIDGET_BUTTON(GBASE, VALUE="Normal", UVALUE="VELNormal", TOOLTIP="Normalizes the vector field. I.e. every vector just retains the direction but will be one unit long." ) ; ---------- Particle data interaction ---------------------------------- particle_names = '' particle_index = 0 particle_data_fields = 20 pi_structure = {particle_interface, names:PTR_NEW(particle_names), $ index: particle_index, max: 0., min:0., $ color: !d.table_size-1, $ read: BYTARR(particle_data_fields), every:1, size:4, type:0,$ myturn:0, $ d:PTRARR(particle_data_fields) } if N_elements(parti) eq 0 then begin parti = pi_structure if N_elements(particle_names) lt 1 then particle_names = 'no data read yet' endif else particle_names = *(parti.names) plistid = WIDGET_COMBOBOX(PART_BASE, VALUE = 'particle_names', $ UVALUE='PARTICLE_NAME_LIST',/dynamic_resize) parti_listid = plistid parti_baseid = PART_BASE parti_menuid= wpart junk = WIDGET_SLIDER( PART_BASE, $ MAXIMUM=64, $ MINIMUM=1,$ UVALUE = 'PARTICLE_EVERY', $ TITLE='Every', $ VALUE=parti.every) junk = WIDGET_SLIDER( PART_BASE, $ MAXIMUM=50, $ MINIMUM=1,$ UVALUE = 'PARTICLE_SIZE', $ TITLE='Size', $ VALUE=parti.size) junk = WIDGET_SLIDER( PART_BASE, $ MAXIMUM=8, $ MINIMUM=0,$ UVALUE = 'PARTICLE_TYPE', $ TITLE='Type (0=all)', $ VALUE=parti.type) ; ----------------------------------------------------------------------- ; ---------- Histograms data interaction ---------------------------------- hi_structure = {histogram_interface, field1:'', field2:'', $ weight:'', min1:-1e30, min2:-1e30, max1:1e30, max2:1e30,$ nbins1:100, nbins2:100, menuid:0, $ titlestring1:'', titlestring2:'', $ xrange:[0.,1.], yrange:[0.,1.], cumoption:0, logoption:1, $ option:0, option2: 0, $ myturn:0, read:BYTARR(5), listid1:0, listid2:0, weightlistid:0, $ d:PTRARR(5) } ; field1, field2, weight, volume, mass if N_elements(hi) lt 1 then begin hi = hi_structure hi.menuid = histmenuid endif ; type of 1D histogram BGROUP10 = CW_BGROUP( HIST_BASE, ['hist.', 'cum. <', 'cum. >', '| Plot'], $ SET_VALUE = hi.cumoption, $ ROW=1, $ /EXCLUSIVE, $ LABEL_LEFT=' ', $ UVALUE='BGROUPCUMHISTOPTION') dummy = widget_label(hist_base, value='x axis:', /align_left) hi.listid1 = WIDGET_COMBOBOX(hist_BASE, VALUE = 'none', $ UVALUE='HISTOGRAM_FIELD1_LIST', /dynamic_resize) MIN_VALUE = CW_FIELD(HIST_BASE, $ UVALUE = 'HIST_MINIMUM1', $ TITLE='Min', $ VALUE=hi.min1, /FLOATING, /ALL_EVENTS) MAX_VALUE = CW_FIELD(HIST_BASE, $ UVALUE = 'HIST_MAXIMUM1', $ TITLE='Max', $ VALUE=hi.max1, /FLOATING, /ALL_EVENTS) NBINS1_VALUE = CW_FIELD(HIST_BASE, $ UVALUE = 'HIST_NBINS1', $ TITLE='# bins', $ VALUE=hi.nbins1, /LONG, /ALL_EVENTS) dummy = widget_label(hist_base, value='y axis:', /align_left) BGROUP10 = CW_BGROUP( HIST_BASE, ['linear', 'log hist.'], $ SET_VALUE = hi.logoption, $ ROW=1, $ /EXCLUSIVE, $ LABEL_LEFT=' ', $ UVALUE='BGROUPLOGHISTOPTION') hi.listid2 = WIDGET_COMBOBOX(HIST_BASE, VALUE = 'none', $ UVALUE='HISTOGRAM_FIELD2_LIST', /dynamic_resize) MIN_VALUE = CW_FIELD(HIST_BASE, $ UVALUE = 'HIST_MINIMUM2', $ TITLE='Min', $ VALUE=hi.min2, /FLOATING, /ALL_EVENTS) MAX_VALUE = CW_FIELD(HIST_BASE, $ UVALUE = 'HIST_MAXIMUM2', $ TITLE='Max', $ VALUE=hi.max2, /FLOATING, /ALL_EVENTS) NBINS2_VALUE = CW_FIELD(HIST_BASE, $ UVALUE = 'HIST_NBINS2', $ TITLE='# bins', $ VALUE=hi.nbins2, /LONG, /ALL_EVENTS) dummy = widget_label(hist_base, value='Use:', /align_left) hi.weightlistid = WIDGET_COMBOBOX(hist_BASE, VALUE = 'none', $ UVALUE='HISTOGRAM_WEIGHT_LIST', /dynamic_resize) BGROUP10 = CW_BGROUP( HIST_BASE, ['as weight.', 'to average.'], $ SET_VALUE = hi.option, $ ROW=1, $ /EXCLUSIVE, $ LABEL_LEFT=' ', $ UVALUE='BGROUPHISTOPTION') BGROUP10 = CW_BGROUP( HIST_BASE, ['mean', 'no mean'], $ SET_VALUE = hi.option2, $ ROW=1, $ /EXCLUSIVE, $ LABEL_LEFT=' ', $ UVALUE='BGROUPHISTOPTION2') ; ----------------------------------------------------------------------- widget_control, shade_state.base(1), MAP=0 WIDGET_CONTROL, TOP_BASE, /REALIZE ; now get the window number for the draw area draw_current_cm, draw_cm, wxysize, 0., 1. update_slice_text, slice_text, slice_size, center, '' widget_control, get_value = win_index, draw_area ; make it the current graphics window wset, win_index WIDGET_CONTROL, DRAW_AREA, SET_DRAW_VIEW=[(xy_sl_size-wxysize)/2, (xy_sl_size-wxysize)/2] XMANAGER, 'J', TOP_BASE, EVENT_HANDLER='J_Event', NO_BLOCK=block END ; .compile TOOLS/AMRslice.pro