minor updates and bug fixes in angle scan processing and data explorer

This commit is contained in:
2019-02-10 14:31:06 +01:00
parent b2f4816629
commit 3235d52212
6 changed files with 594 additions and 36 deletions

View File

@ -537,7 +537,7 @@ end
/// calculate the output using all enabled processing filters.
///
/// the diffractogram is calculated, to display the graph, call @ref asp_display_graph.
/// the diffractogram is calculated, to display the graph, call @ref asp_display_output.
///
function asp_calculate_output()
dfref saveDF = GetDataFolderDFR()
@ -552,6 +552,7 @@ function asp_calculate_output()
nvar folding=output_folding
nvar horizon=output_horizon
nvar graph_mode
do_init_process(0)
do_crop_alpha(0)
@ -569,25 +570,57 @@ function asp_calculate_output()
values = pol <= horizon ? values : nan
endif
interpolate_hemi_scan("")
SetDataFolder saveDF
end
/// display the output diffractogram in a new graph
/// display the output diffractogram
///
function asp_display_output()
dfref df = $(package_path)
/// this function either displays the current working data from the angle scan panel data folder,
/// or hologram data from a specified other data folder.
/// in either case, the graph is displayed using the current projection, mode, color table and contrast settings of the angle scan panel.
///
/// @param data_df data folder where the diffractogram data is located.
/// default: the folder of the angle scan panel package.
///
/// @param data_name name of the diffractogram data.
/// this is normally the name of a sub-folder that contains the data.
/// default: the name specified in the output_name variable in the package data folder.
///
function /s asp_display_output([data_df, data_name])
dfref data_df
string data_name
dfref pkg_df = $(package_path)
svar /sdfr=pkg_df output_name
svar /sdfr=pkg_df output_graphname
nvar /sdfr=pkg_df graph_projection
nvar /sdfr=pkg_df graph_mode
svar /sdfr=pkg_df graph_colortable
nvar /sdfr=pkg_df graph_contrast
svar /sdfr=df output_name
svar /sdfr=df output_graphname
nvar /sdfr=df graph_projection
nvar /sdfr=df graph_mode
if (ParamIsDefault(data_df))
dfref data_df = pkg_df
endif
if (ParamIsDefault(data_name))
data_name = output_name
endif
dfref saveDF = GetDataFolderDFR()
setdatafolder $(package_path)
output_graphname = output_name
output_graphname = display_hemi_scan(output_name, projection=graph_projection, graphtype=graph_mode, graphname=output_graphname)
setdatafolder data_df
string graphname = data_name
graphname = display_hemi_scan(data_name, projection=graph_projection, graphtype=graph_mode, graphname=graphname)
if (ParamIsDefault(data_df))
output_graphname = graphname
endif
SetDataFolder saveDF
asp_update_graph()
if (strlen(graphname) && (wintype(graphname) == 1))
set_contrast(graph_contrast, graph_contrast, graphname=graphname, colortable=graph_colortable)
endif
return graphname
end
/// update graphs with new color table or contrast
@ -647,9 +680,19 @@ end
/// the destination folder does not need to exist.
/// existing data in the destination folder is overwritten.
///
function asp_duplicate_output(dest_name)
/// @param do_graph switch to duplicate the graph window as well (1).
/// default: 0 (do not create a graph)
///
/// @return name of the graph window
///
function /s asp_duplicate_output(dest_name, [do_graph])
string dest_name
variable do_graph
if (ParamIsDefault(do_graph))
do_graph = 0
endif
dfref df = $(package_path)
svar /sdfr=df source_path
svar /sdfr=df output_name
@ -657,14 +700,20 @@ function asp_duplicate_output(dest_name)
wave raw_data = $source_path
dfref saveDF = GetDataFolderDFR()
dfref dest_df = GetWavesDataFolderDFR(raw_data)
setdatafolder dest_df
dfref raw_df = GetWavesDataFolderDFR(raw_data)
setdatafolder raw_df
newdatafolder /o /s $dest_name
dfref dest_df = GetDataFolderDFR()
setdatafolder df
duplicate_hemi_scan(output_name, dest_df, "")
string graphname = ""
if (do_graph)
graphname = asp_display_output(data_df=raw_df, data_name=dest_name)
endif
SetDataFolder saveDF
return graphname
end
/// save the output diffractogram to an igor text file
@ -777,12 +826,14 @@ function asp_show_panel()
return 0
endif
NewPanel /K=1 /N=anglescan_panel /W=(200,100,479,1027) as "angle scan processing"
NewPanel /K=1 /N=anglescan_panel /W=(200,100,479,854) as "angle scan processing"
panel_name = s_name
GroupBox gb_source, title="data source"
Button b_source_select, size={50,20},proc=PearlAnglescanPanel#bp_source_select,title="select..."
Button b_source_select, help={"select the source wave, e.g. ReducedData1. it must be in the original scan data folder along with the attr folder and the manipulator positions."}
Button b_source_select, help={"select the source wave, e.g. ReducedData1. it must be in the scan or region data folder. the attr folder with the manipulator waves must be in the same folder or one level up."}
Button b_source_update, size={50,20},proc=PearlAnglescanPanel#bp_source_update,title="update"
Button b_source_update, help={"reload the process data from the previous source (link displayed below)"}
TitleBox tb_source_path, size={240,21}
TitleBox tb_source_path,variable= root:packages:pearl_anglescan_panel:source_path
@ -799,6 +850,10 @@ function asp_show_panel()
SetVariable sv_alpha_offset, size={90,16},bodyWidth=60,title="alpha"
SetVariable sv_alpha_offset,value= root:packages:pearl_anglescan_panel:alpha_offset
SetVariable sv_alpha_offset, help={"alpha value that corresponds to normal emission (if the sample normal is properly aligned)."}
Button b_save_prefs, size={80,20},proc=PearlAnglescanPanel#bp_save_prefs,title="save prefs"
Button b_save_prefs, help={"save settings as preferences."}
Button b_load_prefs, size={80,20},proc=PearlAnglescanPanel#bp_load_prefs,title="load prefs"
Button b_load_prefs, help={"load settings from preferences."}
GroupBox gb_crop_alpha, title="crop alpha"
CheckBox cb_crop_alpha_enable, size={50,14}, title="enable"
@ -878,8 +933,8 @@ function asp_show_panel()
PopupMenu pm_graph_projection, mode=2, popvalue="stereographic", value= #"\"equidistant;stereographic;equal area;gnomonic;orthographic;\""
PopupMenu pm_graph_projection, help={"projection (theta mapping) mode"}
PopupMenu pm_graph_mode, size={129,21}, bodyWidth=100, proc=PearlAnglescanPanel#pmp_graph_mode,title="mode"
PopupMenu pm_graph_mode, mode=2, popvalue="polar plot", value= #"\"none;polar plot;none;image;\""
PopupMenu pm_graph_mode, help={"graph mode"}
PopupMenu pm_graph_mode, mode=2, popvalue="dots", value= #"\"none;dots;none;image;\""
PopupMenu pm_graph_mode, help={"graph type: dots = coloured dots on circles; image = interpolated matrix"}
Button b_output_calc, size={80,20}, proc=PearlAnglescanPanel#bp_output_calc, title="calc + display"
Button b_output_calc, help={"execute data processing with the enabled filters and display the diffractogram."}
Button b_output_duplicate, size={80,20}, proc=PearlAnglescanPanel#bp_output_duplicate, title="duplicate ..."
@ -910,9 +965,9 @@ static function arrange_controls()
svar /sdfr=df panel_name
variable gb_space = 2
variable gb_internal_top = 20
variable gb_internal_bot = 8
variable line_space = 26
variable gb_internal_top = 16
variable gb_internal_bot = 4
variable line_space = 22
variable cb_adj = 2
variable sv_adj = 2
@ -933,6 +988,7 @@ static function arrange_controls()
GroupBox gb_source,pos={4,gb_top}
gb_ht = gb_internal_top
Button b_source_select,pos={17, gb_top + gb_ht + b_adj},size={50,20}
Button b_source_update, pos={67, gb_top + gb_ht + b_adj},size={50,20}
gb_ht += line_space
TitleBox tb_source_path,pos={18, gb_top + gb_ht + tb_adj},size={240,21}
gb_ht += line_space
@ -943,8 +999,10 @@ static function arrange_controls()
GroupBox gb_offsets,pos={4,gb_top}
gb_ht = gb_internal_top
SetVariable sv_theta_offset,pos={46, gb_top + gb_ht + sv_adj},size={88,16}
Button b_save_prefs,pos={186, gb_top + gb_ht + b_adj},size={80,20}
gb_ht += line_space
SetVariable sv_tilt_offset,pos={60, gb_top + gb_ht + sv_adj},size={74,16}
Button b_load_prefs,pos={186, gb_top + gb_ht + b_adj},size={80,20}
gb_ht += line_space
SetVariable sv_phi_offset,pos={56, gb_top + gb_ht + sv_adj},size={78,16}
gb_ht += line_space
@ -1047,6 +1105,9 @@ static function arrange_controls()
gb_ht += line_space
gb_ht += gb_internal_bot
GroupBox gb_graph, size={272,gb_ht}
gb_top += gb_ht + gb_space
//MoveWindow 200, 100, 479, 100 + gb_top
end
/// update the popup menus to reflect the values of the global variables
@ -1077,6 +1138,34 @@ static function update_menus()
endif
end
static function bp_load_prefs(ba) : ButtonControl
STRUCT WMButtonAction &ba
switch( ba.eventCode )
case 2: // mouse up
load_prefs()
break
case -1: // control being killed
break
endswitch
return 0
End
static function bp_save_prefs(ba) : ButtonControl
STRUCT WMButtonAction &ba
switch( ba.eventCode )
case 2: // mouse up
save_prefs()
break
case -1: // control being killed
break
endswitch
return 0
End
static function bp_source_select(ba) : ButtonControl
STRUCT WMButtonAction &ba
@ -1103,6 +1192,27 @@ static function bp_source_select(ba) : ButtonControl
return 0
End
static function bp_source_update(ba) : ButtonControl
STRUCT WMButtonAction &ba
switch( ba.eventCode )
case 2: // mouse up
dfref packdf = $package_path
svar /sdfr=packdf source_path
wave /z w = $source_path
if (waveexists(w))
asp_import_raw(w)
else
DoAlert 0, "can't find source data."
endif
break
case -1: // control being killed
break
endswitch
return 0
End
static function bp_norm_alpha_check(ba) : ButtonControl
STRUCT WMButtonAction &ba
@ -1250,10 +1360,12 @@ static function bp_output_duplicate(ba) : ButtonControl
switch( ba.eventCode )
case 2: // mouse up
string dest_folder
variable do_graph = 1
prompt dest_folder, "destination folder name (relative to data source)"
doprompt "duplicate", dest_folder
prompt do_graph, "duplicate graph (yes = 1, no = 0)"
doprompt "duplicate", dest_folder, do_graph
if (!v_flag)
asp_duplicate_output(dest_folder)
asp_duplicate_output(dest_folder, do_graph=do_graph)
endif
break
case -1: // control being killed