update data explorer: axis scale and labels in preview
This commit is contained in:
parent
86cf328961
commit
a87975d1e6
@ -21,8 +21,8 @@ License
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
The source code of PEARL Procedures is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) at <https://git.psi.ch/pearl-public/igor-procs>.
|
The source code of PEARL Procedures is available under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) at <https://git.psi.ch/pearl-public/igor-procs>.
|
||||||
Users of PEARL Procedures are requested to coordinate and share the development of the code with the original author.
|
|
||||||
Please read and respect the respective license agreements.
|
Please read and respect the respective license agreements.
|
||||||
|
Please share your extensions of the code with the original author.
|
||||||
|
|
||||||
Author
|
Author
|
||||||
------
|
------
|
||||||
|
@ -171,7 +171,6 @@ function /s ad_display_profiles(image, [filter])
|
|||||||
duplicate /o image, $viewname /wave=view
|
duplicate /o image, $viewname /wave=view
|
||||||
make /n=(3,3)/o xprofiles // NX x 3 wave with 3 one-dimensional profiles along Y dimension
|
make /n=(3,3)/o xprofiles // NX x 3 wave with 3 one-dimensional profiles along Y dimension
|
||||||
make /n=(3,3)/o yprofiles // NY x 3 wave with 3 one-dimensional profiles along X dimension
|
make /n=(3,3)/o yprofiles // NY x 3 wave with 3 one-dimensional profiles along X dimension
|
||||||
make /n=(1)/o hist // histogram
|
|
||||||
string /g view_filter
|
string /g view_filter
|
||||||
string /g view_filter_options
|
string /g view_filter_options
|
||||||
view_filter = filter
|
view_filter = filter
|
||||||
@ -193,16 +192,13 @@ function /s ad_display_profiles(image, [filter])
|
|||||||
graphname = s_name
|
graphname = s_name
|
||||||
AppendToGraph /w=$graphname /L=xprofiles xprofiles[*][0],xprofiles[*][1],xprofiles[*][2]
|
AppendToGraph /w=$graphname /L=xprofiles xprofiles[*][0],xprofiles[*][1],xprofiles[*][2]
|
||||||
AppendToGraph /w=$graphname /VERT/B=yprofiles yprofiles[*][0],yprofiles[*][1],yprofiles[*][2]
|
AppendToGraph /w=$graphname /VERT/B=yprofiles yprofiles[*][0],yprofiles[*][1],yprofiles[*][2]
|
||||||
AppendToGraph /w=$graphname /R=hist/B=yprofiles hist
|
|
||||||
AppendImage /w=$graphname view
|
AppendImage /w=$graphname view
|
||||||
string imgname = StringFromList(0, ImageNameList(graphname, ";"))
|
string imgname = StringFromList(0, ImageNameList(graphname, ";"))
|
||||||
ModifyImage /w=$graphname $imgname ctab= {*,*,BlueGreenOrange,0}
|
ModifyImage /w=$graphname $imgname ctab= {*,*,BlueGreenOrange,0}
|
||||||
ModifyGraph /w=$graphname rgb(xprofiles)=(39168,0,0),rgb(yprofiles)=(39168,0,0)
|
ModifyGraph /w=$graphname rgb(xprofiles)=(39168,0,0),rgb(yprofiles)=(39168,0,0)
|
||||||
ModifyGraph /w=$graphname rgb(xprofiles#1)=(0,26112,0),rgb(yprofiles#1)=(0,26112,0)
|
ModifyGraph /w=$graphname rgb(xprofiles#1)=(0,26112,0),rgb(yprofiles#1)=(0,26112,0)
|
||||||
ModifyGraph /w=$graphname rgb(xprofiles#2)=(0,9472,39168),rgb(yprofiles#2)=(0,9472,39168)
|
ModifyGraph /w=$graphname rgb(xprofiles#2)=(0,9472,39168),rgb(yprofiles#2)=(0,9472,39168)
|
||||||
ModifyGraph /w=$graphname rgb(hist)=(43520,43520,43520)
|
ModifyGraph /w=$graphname mirror(xprofiles)=2,mirror(bottom)=3,mirror(yprofiles)=2,mirror(left)=3
|
||||||
ModifyGraph /w=$graphname mode(hist)=5,hbFill(hist)=2
|
|
||||||
ModifyGraph /w=$graphname mirror(xprofiles)=0,mirror(bottom)=3,mirror(yprofiles)=3,mirror(left)=3
|
|
||||||
ModifyGraph /w=$graphname nticks=3
|
ModifyGraph /w=$graphname nticks=3
|
||||||
ModifyGraph /w=$graphname minor=1
|
ModifyGraph /w=$graphname minor=1
|
||||||
ModifyGraph /w=$graphname axThick=0.5
|
ModifyGraph /w=$graphname axThick=0.5
|
||||||
@ -210,21 +206,33 @@ function /s ad_display_profiles(image, [filter])
|
|||||||
ModifyGraph /w=$graphname btLen=4
|
ModifyGraph /w=$graphname btLen=4
|
||||||
ModifyGraph /w=$graphname freePos(xprofiles)=0
|
ModifyGraph /w=$graphname freePos(xprofiles)=0
|
||||||
ModifyGraph /w=$graphname freePos(yprofiles)=0
|
ModifyGraph /w=$graphname freePos(yprofiles)=0
|
||||||
ModifyGraph /w=$graphname freePos(hist)=0
|
|
||||||
ModifyGraph /w=$graphname axisEnab(xprofiles)={0.64,1}
|
ModifyGraph /w=$graphname axisEnab(xprofiles)={0.64,1}
|
||||||
ModifyGraph /w=$graphname axisEnab(hist)={0.64,1}
|
|
||||||
ModifyGraph /w=$graphname axisEnab(bottom)={0,0.6}
|
ModifyGraph /w=$graphname axisEnab(bottom)={0,0.6}
|
||||||
ModifyGraph /w=$graphname axisEnab(yprofiles)={0.64,1}
|
ModifyGraph /w=$graphname axisEnab(yprofiles)={0.64,1}
|
||||||
ModifyGraph /w=$graphname axisEnab(left)={0,0.6}
|
ModifyGraph /w=$graphname axisEnab(left)={0,0.6}
|
||||||
ModifyGraph /w=$graphname zero(left)=8
|
ModifyGraph /w=$graphname zero(left)=8
|
||||||
ModifyGraph /w=$graphname margin(left)=40,margin(bottom)=30,margin(top)=20,margin(right)=40
|
ModifyGraph /w=$graphname margin(left)=40,margin(bottom)=30,margin(top)=20,margin(right)=40
|
||||||
ModifyGraph /w=$graphname gfSize=10
|
ModifyGraph /w=$graphname gfSize=10
|
||||||
Label /w=$graphname xprofiles "value (\\U)"
|
|
||||||
Label /w=$graphname bottom "X (\\U)"
|
// axis labels
|
||||||
Label /w=$graphname yprofiles "value (\\U)"
|
string labels = note(image)
|
||||||
Label /w=$graphname left "Y (\\U)"
|
string lab
|
||||||
Label /w=$graphname hist "\\Epixels"
|
lab = StringByKey("AxisLabelX", labels, "=", "\r")
|
||||||
SetAxis /w=$graphname /A /E=1 hist
|
if (!strlen(lab))
|
||||||
|
lab = "X"
|
||||||
|
endif
|
||||||
|
Label /w=$graphname bottom lab + " (\\U)"
|
||||||
|
lab = StringByKey("AxisLabelY", labels, "=", "\r")
|
||||||
|
if (!strlen(lab))
|
||||||
|
lab = "Y"
|
||||||
|
endif
|
||||||
|
Label /w=$graphname left lab + " (\\U)"
|
||||||
|
lab = StringByKey("AxisLabelD", labels, "=", "\r")
|
||||||
|
if (!strlen(lab))
|
||||||
|
lab = "value"
|
||||||
|
endif
|
||||||
|
Label /w=$graphname xprofiles lab + " (\\U)"
|
||||||
|
Label /w=$graphname yprofiles lab + " (\\U)"
|
||||||
|
|
||||||
// legend
|
// legend
|
||||||
if (show_legend)
|
if (show_legend)
|
||||||
@ -233,13 +241,18 @@ function /s ad_display_profiles(image, [filter])
|
|||||||
AppendText /w=$graphname "\\s(xprofiles#2)\tROI average"
|
AppendText /w=$graphname "\\s(xprofiles#2)\tROI average"
|
||||||
AppendText /w=$graphname "min\t\\{" + s_viewdf + "graph_min}"
|
AppendText /w=$graphname "min\t\\{" + s_viewdf + "graph_min}"
|
||||||
AppendText /w=$graphname "max\t\\{" + s_viewdf + "graph_max}"
|
AppendText /w=$graphname "max\t\\{" + s_viewdf + "graph_max}"
|
||||||
AppendText /w=$graphname "avg\t\\{" + s_viewdf + "graph_avg}"
|
|
||||||
AppendText /w=$graphname "sum\t\\{" + s_viewdf + "graph_sum}"
|
AppendText /w=$graphname "sum\t\\{" + s_viewdf + "graph_sum}"
|
||||||
|
AppendText /w=$graphname "avg\t\\{" + s_viewdf + "graph_avg}"
|
||||||
AppendText /w=$graphname "sdev\t\\{" + s_viewdf + "graph_sdev}"
|
AppendText /w=$graphname "sdev\t\\{" + s_viewdf + "graph_sdev}"
|
||||||
else
|
else
|
||||||
TextBox /w=$graphname /C/N=text_sum/F=0/B=1/X=1.00/Y=1.00 "sum \\{" + s_viewdf + "graph_sum}"
|
TextBox /w=$graphname /C/N=text0 /F=0 /B=1 /X=1.00 /Y=1.00
|
||||||
TextBox /w=$graphname /C/N=text_avg/F=0/B=1/X=1.00/Y=6.00 "avg \\{" + s_viewdf + "graph_avg}"
|
lab = StringByKey("Dataset", labels, "=", "\r")
|
||||||
TextBox /w=$graphname /C/N=text_sdev/F=0/B=1/X=1.00/Y=11.00 "sdev \\{" + s_viewdf + "graph_sdev}"
|
if (strlen(lab))
|
||||||
|
AppendText /w=$graphname lab
|
||||||
|
endif
|
||||||
|
AppendText /w=$graphname "sum\t\\{" + s_viewdf + "graph_sum}"
|
||||||
|
AppendText /w=$graphname "avg\t\\{" + s_viewdf + "graph_avg}"
|
||||||
|
AppendText /w=$graphname "sdev\t\\{" + s_viewdf + "graph_sdev}"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
// interactive elements
|
// interactive elements
|
||||||
@ -1116,12 +1129,31 @@ function ad_brick_slicer(data)
|
|||||||
variable /g y_autoinc = 0
|
variable /g y_autoinc = 0
|
||||||
variable /g z_autoinc = 0
|
variable /g z_autoinc = 0
|
||||||
|
|
||||||
|
// axis labels
|
||||||
|
string labels = note(data)
|
||||||
|
string xlabel = StringByKey("AxisLabelX", labels, "=", "\r")
|
||||||
|
if (!strlen(xlabel))
|
||||||
|
xlabel = "X"
|
||||||
|
endif
|
||||||
|
string ylabel = StringByKey("AxisLabelY", labels, "=", "\r")
|
||||||
|
if (!strlen(ylabel))
|
||||||
|
ylabel = "Y"
|
||||||
|
endif
|
||||||
|
string zlabel = StringByKey("AxisLabelZ", labels, "=", "\r")
|
||||||
|
if (!strlen(zlabel))
|
||||||
|
zlabel = "Z"
|
||||||
|
endif
|
||||||
|
string dlabel = StringByKey("Dataset", labels, "=", "\r")
|
||||||
|
if (!strlen(dlabel))
|
||||||
|
dlabel = NameOfWave(data)
|
||||||
|
endif
|
||||||
|
|
||||||
// this section copied from slicer panel
|
// this section copied from slicer panel
|
||||||
NewPanel /k=1 /W=(500,600,890,940) /N=SlicerPanel as "Brick Slicer"
|
NewPanel /k=1 /W=(500,600,890,940) /N=SlicerPanel as "Brick Slicer"
|
||||||
string /g slicer_panelname = S_name
|
string /g slicer_panelname = S_name
|
||||||
string panel = s_name
|
string panel = s_name
|
||||||
|
|
||||||
GroupBox g_xslice win=$panel,pos={8,8},size={376,96},title="X Slice"
|
GroupBox g_xslice win=$panel,pos={8,8},size={376,96},title=xlabel
|
||||||
Slider sl_xslice_position win=$panel,pos={16,32},size={240,56},proc=PearlAreaDisplay#slp_slice_position
|
Slider sl_xslice_position win=$panel,pos={16,32},size={240,56},proc=PearlAreaDisplay#slp_slice_position
|
||||||
Slider sl_xslice_position win=$panel,limits={0,100,1},variable=x_slice_pos,vert= 0
|
Slider sl_xslice_position win=$panel,limits={0,100,1},variable=x_slice_pos,vert= 0
|
||||||
SetVariable sv_xslice_position win=$panel,pos={20,80},size={92,16},proc=PearlAreaDisplay#svp_slice_position,title="X"
|
SetVariable sv_xslice_position win=$panel,pos={20,80},size={92,16},proc=PearlAreaDisplay#svp_slice_position,title="X"
|
||||||
@ -1141,7 +1173,7 @@ function ad_brick_slicer(data)
|
|||||||
Button b_xslice_stop win=$panel,pos={336,48},size={20,20},proc=PearlAreaDisplay#bp_move_slice,title="\\W616"
|
Button b_xslice_stop win=$panel,pos={336,48},size={20,20},proc=PearlAreaDisplay#bp_move_slice,title="\\W616"
|
||||||
Button b_xslice_stop win=$panel,help={"stop animation"}
|
Button b_xslice_stop win=$panel,help={"stop animation"}
|
||||||
|
|
||||||
GroupBox g_yslice win=$panel,pos={8,108},size={376,96},title="Y Slice"
|
GroupBox g_yslice win=$panel,pos={8,108},size={376,96},title=ylabel
|
||||||
Slider sl_yslice_position win=$panel,pos={16,132},size={240,56},proc=PearlAreaDisplay#slp_slice_position
|
Slider sl_yslice_position win=$panel,pos={16,132},size={240,56},proc=PearlAreaDisplay#slp_slice_position
|
||||||
Slider sl_yslice_position win=$panel,limits={0,100,1},variable=y_slice_pos,vert= 0
|
Slider sl_yslice_position win=$panel,limits={0,100,1},variable=y_slice_pos,vert= 0
|
||||||
SetVariable sv_yslice_position win=$panel,pos={20,180},size={92,16},proc=PearlAreaDisplay#svp_slice_position,title="Y"
|
SetVariable sv_yslice_position win=$panel,pos={20,180},size={92,16},proc=PearlAreaDisplay#svp_slice_position,title="Y"
|
||||||
@ -1161,7 +1193,7 @@ function ad_brick_slicer(data)
|
|||||||
Button b_yslice_stop win=$panel,pos={336,148},size={20,20},proc=PearlAreaDisplay#bp_move_slice,title="\\W616"
|
Button b_yslice_stop win=$panel,pos={336,148},size={20,20},proc=PearlAreaDisplay#bp_move_slice,title="\\W616"
|
||||||
Button b_yslice_stop win=$panel,help={"stop animation"}
|
Button b_yslice_stop win=$panel,help={"stop animation"}
|
||||||
|
|
||||||
GroupBox g_zslice win=$panel,pos={8,208},size={376,96},title="Z Slice"
|
GroupBox g_zslice win=$panel,pos={8,208},size={376,96},title=zlabel
|
||||||
Slider sl_zslice_position win=$panel,pos={16,232},size={240,56},proc=PearlAreaDisplay#slp_slice_position
|
Slider sl_zslice_position win=$panel,pos={16,232},size={240,56},proc=PearlAreaDisplay#slp_slice_position
|
||||||
Slider sl_zslice_position win=$panel,limits={0,100,1},variable=z_slice_pos,vert= 0
|
Slider sl_zslice_position win=$panel,limits={0,100,1},variable=z_slice_pos,vert= 0
|
||||||
SetVariable sv_zslice_position win=$panel,pos={20,280},size={92,16},proc=PearlAreaDisplay#svp_slice_position,title="Z"
|
SetVariable sv_zslice_position win=$panel,pos={20,280},size={92,16},proc=PearlAreaDisplay#svp_slice_position,title="Z"
|
||||||
@ -1181,7 +1213,7 @@ function ad_brick_slicer(data)
|
|||||||
Button b_zslice_stop win=$panel,pos={336,248},size={20,20},proc=PearlAreaDisplay#bp_move_slice,title="\\W616"
|
Button b_zslice_stop win=$panel,pos={336,248},size={20,20},proc=PearlAreaDisplay#bp_move_slice,title="\\W616"
|
||||||
Button b_zslice_stop win=$panel,help={"stop animation"}
|
Button b_zslice_stop win=$panel,help={"stop animation"}
|
||||||
|
|
||||||
TitleBox t_slicerpath win=$panel,pos={8,316},size={128,20},disable=2,title=GetDataFolder(1,viewdf)
|
TitleBox t_slicerpath win=$panel,pos={8,316},size={128,20},disable=2,title=dlabel
|
||||||
//SetVariable setvar0 win=$panel,pos={240,316},size={120,16},title="slab thickness"
|
//SetVariable setvar0 win=$panel,pos={240,316},size={120,16},title="slab thickness"
|
||||||
//SetVariable setvar0 win=$panel,limits={1,inf,1},value=slab_thickness
|
//SetVariable setvar0 win=$panel,limits={1,inf,1},value=slab_thickness
|
||||||
|
|
||||||
|
@ -613,3 +613,36 @@ threadsafe function calc_y_profile_mins(image)
|
|||||||
yminlocs[ix] = v_minloc
|
yminlocs[ix] = v_minloc
|
||||||
endfor
|
endfor
|
||||||
end
|
end
|
||||||
|
|
||||||
|
/// collect profiles from a multi-scan.
|
||||||
|
///
|
||||||
|
/// @warning experimental: name and interface of this function may change.
|
||||||
|
///
|
||||||
|
function ad_collect_multiscan_y(dataset, positions, destwave, [noavg])
|
||||||
|
wave dataset
|
||||||
|
wave positions
|
||||||
|
wave destwave
|
||||||
|
variable noavg
|
||||||
|
|
||||||
|
variable tol = (wavemax(positions) - wavemin(positions)) / numpnts(positions) / 100
|
||||||
|
|
||||||
|
duplicate /free positions, positions_sorted
|
||||||
|
sort positions_sorted, positions_sorted
|
||||||
|
duplicate /free positions_sorted, positions_diff
|
||||||
|
differentiate /p /meth=2 positions_sorted /d=positions_diff
|
||||||
|
positions_diff[0] = 1
|
||||||
|
extract /free positions_sorted, positions_unique, positions_diff > tol
|
||||||
|
variable n_unique = numpnts(positions_unique)
|
||||||
|
redimension /n=(dimsize(dataset, 0), n_unique) destwave
|
||||||
|
|
||||||
|
variable i
|
||||||
|
variable nx, ny
|
||||||
|
for (i = 0; i < n_unique; i += 1)
|
||||||
|
extract /free dataset, data_extract, abs(positions[q] - positions_unique[i]) < tol
|
||||||
|
nx = dimsize(dataset, 0)
|
||||||
|
ny = dimsize(data_extract, 0) / nx
|
||||||
|
redimension /n=(nx, ny) data_extract
|
||||||
|
wave profile = ad_profile_x(data_extract, -inf, inf, "", noavg=noavg)
|
||||||
|
destwave[][i] = profile[p]
|
||||||
|
endfor
|
||||||
|
end
|
||||||
|
@ -759,18 +759,21 @@ static function /s show_preview_graph(data, [xdata])
|
|||||||
svar s_profiles_graph
|
svar s_profiles_graph
|
||||||
svar s_preview_file
|
svar s_preview_file
|
||||||
svar s_preview_source
|
svar s_preview_source
|
||||||
|
svar s_preview_trace_graph
|
||||||
|
|
||||||
|
if ((strlen(s_profiles_graph) > 0) && (WinType(s_profiles_graph) == 1))
|
||||||
|
KillWindow $s_profiles_graph
|
||||||
|
endif
|
||||||
|
if ((strlen(s_preview_trace_graph) > 0) && (WinType(s_preview_trace_graph) == 1))
|
||||||
|
KillWindow $s_preview_trace_graph
|
||||||
|
endif
|
||||||
|
|
||||||
string graphname
|
string graphname
|
||||||
if (wavedims(data) == 2)
|
if (wavedims(data) == 2)
|
||||||
if ((strlen(s_profiles_graph) > 0) && (WinType(s_profiles_graph) == 1))
|
|
||||||
ad_update_profiles(data)
|
|
||||||
else
|
|
||||||
s_profiles_graph = ad_display_profiles(data)
|
s_profiles_graph = ad_display_profiles(data)
|
||||||
ModifyGraph /w=$s_profiles_graph /z wbRGB=(48640,56832,60160)
|
ModifyGraph /w=$s_profiles_graph /z wbRGB=(48640,56832,60160)
|
||||||
endif
|
|
||||||
graphname = s_profiles_graph
|
graphname = s_profiles_graph
|
||||||
elseif (wavedims(data) == 1)
|
elseif (wavedims(data) == 1)
|
||||||
svar s_preview_trace_graph
|
|
||||||
duplicate /o data, preview_trace
|
duplicate /o data, preview_trace
|
||||||
if (!ParamIsDefault(xdata))
|
if (!ParamIsDefault(xdata))
|
||||||
duplicate /o xdata, preview_trace_x
|
duplicate /o xdata, preview_trace_x
|
||||||
@ -779,20 +782,8 @@ static function /s show_preview_graph(data, [xdata])
|
|||||||
preview_trace_x = x
|
preview_trace_x = x
|
||||||
setscale d 0, 0, WaveUnits(data, 0), preview_trace_x
|
setscale d 0, 0, WaveUnits(data, 0), preview_trace_x
|
||||||
endif
|
endif
|
||||||
if ((strlen(s_preview_trace_graph) == 0) || (WinType(s_preview_trace_graph) != 1))
|
s_preview_trace_graph = display_preview_trace(preview_trace_x, preview_trace)
|
||||||
display /n=pearl_explorer_1d /k=1 preview_trace vs preview_trace_x as "Preview"
|
|
||||||
s_preview_trace_graph = s_name
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph wbRGB=(48640,56832,60160)
|
ModifyGraph /w=$s_preview_trace_graph wbRGB=(48640,56832,60160)
|
||||||
ModifyGraph /w=$s_preview_trace_graph rgb[0]=(0,0,0)
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph grid=2
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph mirror=1
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph minor=1
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph axThick=0.5
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph gridRGB=(52224,52224,52224)
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph gridHair=0
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph tick=0
|
|
||||||
ModifyGraph /w=$s_preview_trace_graph btLen=4
|
|
||||||
endif
|
|
||||||
graphname = s_preview_trace_graph
|
graphname = s_preview_trace_graph
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
@ -808,6 +799,39 @@ static function /s show_preview_graph(data, [xdata])
|
|||||||
return graphname
|
return graphname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
static function /s display_preview_trace(xtrace, ytrace)
|
||||||
|
wave xtrace
|
||||||
|
wave ytrace
|
||||||
|
|
||||||
|
display /n=pearl_explorer_1d /k=1 ytrace vs xtrace as "Preview"
|
||||||
|
string graphname = s_name
|
||||||
|
ModifyGraph /w=$graphname rgb[0]=(0,0,0)
|
||||||
|
ModifyGraph /w=$graphname grid=2
|
||||||
|
ModifyGraph /w=$graphname mirror=1
|
||||||
|
ModifyGraph /w=$graphname minor=1
|
||||||
|
ModifyGraph /w=$graphname axThick=0.5
|
||||||
|
ModifyGraph /w=$graphname gridRGB=(52224,52224,52224)
|
||||||
|
ModifyGraph /w=$graphname gridHair=0
|
||||||
|
ModifyGraph /w=$graphname tick=0
|
||||||
|
ModifyGraph /w=$graphname btLen=4
|
||||||
|
|
||||||
|
// axis labels
|
||||||
|
string labels = note(ytrace)
|
||||||
|
string lab
|
||||||
|
lab = StringByKey("AxisLabelX", labels, "=", "\r")
|
||||||
|
if (!strlen(lab))
|
||||||
|
lab = "X"
|
||||||
|
endif
|
||||||
|
Label /w=$graphname bottom lab + " (\\U)"
|
||||||
|
lab = StringByKey("AxisLabelD", labels, "=", "\r")
|
||||||
|
if (!strlen(lab))
|
||||||
|
lab = "value"
|
||||||
|
endif
|
||||||
|
Label /w=$graphname left lab + " (\\U)"
|
||||||
|
|
||||||
|
return s_name
|
||||||
|
end
|
||||||
|
|
||||||
static function load_selected_files([options])
|
static function load_selected_files([options])
|
||||||
string options
|
string options
|
||||||
|
|
||||||
@ -1426,6 +1450,9 @@ static function bp_dataset_folder(ba) : ButtonControl
|
|||||||
string cmd
|
string cmd
|
||||||
sprintf cmd, "setdatafolder root:%s", PossiblyQuoteName(dataset)
|
sprintf cmd, "setdatafolder root:%s", PossiblyQuoteName(dataset)
|
||||||
execute /q /z cmd
|
execute /q /z cmd
|
||||||
|
cmd = "setdatafolder :scan_1"
|
||||||
|
execute /q /z cmd
|
||||||
|
sprintf cmd, "setdatafolder %s", GetDataFolder(1)
|
||||||
print cmd
|
print cmd
|
||||||
endif
|
endif
|
||||||
break
|
break
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
|
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
|
||||||
#pragma IgorVersion = 6.2
|
#pragma IgorVersion = 6.36
|
||||||
#pragma ModuleName = PearlPShellImport
|
#pragma ModuleName = PearlPShellImport
|
||||||
#pragma version = 1.02
|
#pragma version = 1.02
|
||||||
#include <HDF5 Browser>
|
#include <HDF5 Browser>
|
||||||
@ -537,6 +537,7 @@ function /s psh5_load_scan_meta(fileID, scanpath)
|
|||||||
ScanReadables[0] = "ScientaSpectrum"
|
ScanReadables[0] = "ScientaSpectrum"
|
||||||
wavenames = AddListItem("ScanReadables", wavenames, ";", inf)
|
wavenames = AddListItem("ScanReadables", wavenames, ";", inf)
|
||||||
endif
|
endif
|
||||||
|
wavenames = ReplaceString(";;", wavenames, ";")
|
||||||
|
|
||||||
return wavenames
|
return wavenames
|
||||||
end
|
end
|
||||||
@ -699,6 +700,21 @@ function /s psh5_load_scan_preview(fileID, scanpath, [set_scale])
|
|||||||
wave /z data = $dataname
|
wave /z data = $dataname
|
||||||
if (waveexists(data))
|
if (waveexists(data))
|
||||||
if (set_scale)
|
if (set_scale)
|
||||||
|
setdatafolder dataDF
|
||||||
|
string positioners
|
||||||
|
string positioner
|
||||||
|
string positionerpath
|
||||||
|
positioners = psh5_load_scan_meta(fileID, scanpath)
|
||||||
|
wave /t /z ScanWritables
|
||||||
|
if (waveexists(ScanWritables) && (numpnts(ScanWritables) >= 1))
|
||||||
|
positioner = ScanWritables[0]
|
||||||
|
if (strlen(positioner) > 0)
|
||||||
|
positionerpath = scanpath + "/" + positioner
|
||||||
|
positionerpath = ReplaceString("//", positionerpath, "/")
|
||||||
|
HDF5LoadData /O /Q /Z fileID, positionerpath
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
setdatafolder dataDF
|
setdatafolder dataDF
|
||||||
newdatafolder /o/s attr
|
newdatafolder /o/s attr
|
||||||
killwaves /a/z
|
killwaves /a/z
|
||||||
@ -1008,18 +1024,24 @@ function ps_set_dimlabels(data)
|
|||||||
setdimlabel 2, -1, $kScanDimLabel, data
|
setdimlabel 2, -1, $kScanDimLabel, data
|
||||||
endif
|
endif
|
||||||
break
|
break
|
||||||
case "ScientaSpectrum":
|
|
||||||
setdimlabel 0, -1, $kEnergyDimLabel, data
|
|
||||||
break
|
|
||||||
case "ImageAngleDistribution":
|
case "ImageAngleDistribution":
|
||||||
case "ScientaAngleDistribution":
|
case "ScientaAngleDistribution":
|
||||||
|
if (WaveDims(data) >= 2)
|
||||||
setdimlabel 0, -1, $kScanDimLabel, data
|
setdimlabel 0, -1, $kScanDimLabel, data
|
||||||
setdimlabel 1, -1, $kAngleDimLabel, data
|
setdimlabel 1, -1, $kAngleDimLabel, data
|
||||||
|
else
|
||||||
|
setdimlabel 0, -1, $kAngleDimLabel, data
|
||||||
|
endif
|
||||||
break
|
break
|
||||||
|
case "ScientaSpectrum":
|
||||||
case "ImageEnergyDistribution":
|
case "ImageEnergyDistribution":
|
||||||
case "ScientaEnergyDistribution":
|
case "ScientaEnergyDistribution":
|
||||||
|
if (WaveDims(data) >= 2)
|
||||||
setdimlabel 0, -1, $kScanDimLabel, data
|
setdimlabel 0, -1, $kScanDimLabel, data
|
||||||
setdimlabel 1, -1, $kEnergyDimLabel, data
|
setdimlabel 1, -1, $kEnergyDimLabel, data
|
||||||
|
else
|
||||||
|
setdimlabel 0, -1, $kEnergyDimLabel, data
|
||||||
|
endif
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
setdimlabel 0, -1, $kScanDimLabel, data
|
setdimlabel 0, -1, $kScanDimLabel, data
|
||||||
@ -1040,8 +1062,8 @@ function ps_scale_datasets()
|
|||||||
dfref attrDF = :attr
|
dfref attrDF = :attr
|
||||||
|
|
||||||
make /n=3 /free lo, hi
|
make /n=3 /free lo, hi
|
||||||
make /n=3 /t /free un
|
make /n=3 /t /free ax, un
|
||||||
ps_detect_scale(lo, hi, un)
|
ps_detect_scale(ax, lo, hi, un)
|
||||||
|
|
||||||
wave /t /z /SDFR=dataDF ScanReadables
|
wave /t /z /SDFR=dataDF ScanReadables
|
||||||
if (WaveExists(ScanReadables))
|
if (WaveExists(ScanReadables))
|
||||||
@ -1051,7 +1073,7 @@ function ps_scale_datasets()
|
|||||||
for (isr = 0; isr < nsr; isr += 1)
|
for (isr = 0; isr < nsr; isr += 1)
|
||||||
wave /z /SDFR=dataDF wsr = $ScanReadables[isr]
|
wave /z /SDFR=dataDF wsr = $ScanReadables[isr]
|
||||||
if (WaveExists(wsr))
|
if (WaveExists(wsr))
|
||||||
ps_scale_dataset_2(wsr, lo, hi, un)
|
ps_scale_dataset_2(wsr, ax, lo, hi, un)
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
@ -1078,9 +1100,9 @@ function ps_scale_dataset(data)
|
|||||||
setdatafolder dataDF
|
setdatafolder dataDF
|
||||||
|
|
||||||
make /n=3 /free lo, hi
|
make /n=3 /free lo, hi
|
||||||
make /n=3 /t /free un
|
make /n=3 /t /free ax, un
|
||||||
ps_detect_scale(lo, hi, un)
|
ps_detect_scale(ax, lo, hi, un)
|
||||||
ps_scale_dataset_2(data, lo, hi, un)
|
ps_scale_dataset_2(data, ax, lo, hi, un)
|
||||||
|
|
||||||
setdatafolder saveDF
|
setdatafolder saveDF
|
||||||
end
|
end
|
||||||
@ -1096,7 +1118,7 @@ end
|
|||||||
/// @arg `lo[%%energy]` analyser energy dimension.
|
/// @arg `lo[%%energy]` analyser energy dimension.
|
||||||
/// @arg `lo[%%angle]` analyser angle dimension.
|
/// @arg `lo[%%angle]` analyser angle dimension.
|
||||||
/// @arg `lo[%%scan]` scan dimension.
|
/// @arg `lo[%%scan]` scan dimension.
|
||||||
/// @arg `lo[%%data]` data dimension (units).
|
/// @arg `lo[%%data]` data dimension.
|
||||||
///
|
///
|
||||||
/// the function tries to read the following waves,
|
/// the function tries to read the following waves,
|
||||||
/// and may fall back to more or less reasonable default values if they are not found.
|
/// and may fall back to more or less reasonable default values if they are not found.
|
||||||
@ -1108,15 +1130,18 @@ end
|
|||||||
/// @arg `ScanWritables`
|
/// @arg `ScanWritables`
|
||||||
/// @arg wave referenced by `ScanWritables[0]`
|
/// @arg wave referenced by `ScanWritables[0]`
|
||||||
///
|
///
|
||||||
|
/// @param ax text wave to receive the axis labels.
|
||||||
|
///
|
||||||
/// @param lo wave to receive the lower limits.
|
/// @param lo wave to receive the lower limits.
|
||||||
///
|
///
|
||||||
/// @param hi wave to receive the upper limits.
|
/// @param hi wave to receive the upper limits.
|
||||||
///
|
///
|
||||||
/// @param un text wave to receive the unit labels.
|
/// @param un text wave to receive the unit labels.
|
||||||
///
|
///
|
||||||
/// @return the function results are written to the lo, hi, un waves.
|
/// @return the function results are written to the lo, hi, un, and ax waves.
|
||||||
///
|
///
|
||||||
function ps_detect_scale(lo, hi, un)
|
function ps_detect_scale(ax, lo, hi, un)
|
||||||
|
wave /t ax
|
||||||
wave lo
|
wave lo
|
||||||
wave hi
|
wave hi
|
||||||
wave /t un
|
wave /t un
|
||||||
@ -1124,28 +1149,32 @@ function ps_detect_scale(lo, hi, un)
|
|||||||
dfref dataDF = GetDataFolderDFR()
|
dfref dataDF = GetDataFolderDFR()
|
||||||
dfref attrDF = :attr
|
dfref attrDF = :attr
|
||||||
|
|
||||||
redimension /n=4 lo, hi, un
|
redimension /n=4 lo, hi, un, ax
|
||||||
setdimlabel 0, 0, $kEnergyDimLabel, lo, hi, un
|
setdimlabel 0, 0, $kEnergyDimLabel, lo, hi, un, ax
|
||||||
setdimlabel 0, 1, $kAngleDimLabel, lo, hi, un
|
setdimlabel 0, 1, $kAngleDimLabel, lo, hi, un, ax
|
||||||
setdimlabel 0, 2, $kScanDimLabel, lo, hi, un
|
setdimlabel 0, 2, $kScanDimLabel, lo, hi, un, ax
|
||||||
setdimlabel 0, 3, $kDataDimLabel, lo, hi, un
|
setdimlabel 0, 3, $kDataDimLabel, lo, hi, un, ax
|
||||||
|
|
||||||
// default values
|
// default values
|
||||||
lo[%$kEnergyDimLabel] = 0
|
lo[%$kEnergyDimLabel] = 0
|
||||||
hi[%$kEnergyDimLabel] = 1
|
hi[%$kEnergyDimLabel] = 1
|
||||||
un[%$kEnergyDimLabel] = "eV"
|
un[%$kEnergyDimLabel] = "eV"
|
||||||
|
ax[%$kEnergyDimLabel] = "Ekin"
|
||||||
|
|
||||||
lo[%$kAngleDimLabel] = -1
|
lo[%$kAngleDimLabel] = -1
|
||||||
hi[%$kAngleDimLabel] = 1
|
hi[%$kAngleDimLabel] = 1
|
||||||
un[%$kAngleDimLabel] = ""
|
un[%$kAngleDimLabel] = "arb."
|
||||||
|
un[%$kAngleDimLabel] = "slice"
|
||||||
|
|
||||||
lo[%$kScanDimLabel] = 0
|
lo[%$kScanDimLabel] = 0
|
||||||
hi[%$kScanDimLabel] = 1
|
hi[%$kScanDimLabel] = 1
|
||||||
un[%$kScanDimLabel] = ""
|
un[%$kScanDimLabel] = "arb."
|
||||||
|
ax[%$kScanDimLabel] = "scan"
|
||||||
|
|
||||||
lo[%$kDataDimLabel] = 0
|
lo[%$kDataDimLabel] = 0
|
||||||
hi[%$kDataDimLabel] = 0
|
hi[%$kDataDimLabel] = 0
|
||||||
un[%$kDataDimLabel] = "arb."
|
un[%$kDataDimLabel] = "arb."
|
||||||
|
ax[%$kDataDimLabel] = "value"
|
||||||
|
|
||||||
wave /SDFR=attrDF /T /Z LensMode
|
wave /SDFR=attrDF /T /Z LensMode
|
||||||
wave /SDFR=attrDF /Z ChannelBegin = ScientaChannelBegin
|
wave /SDFR=attrDF /Z ChannelBegin = ScientaChannelBegin
|
||||||
@ -1160,14 +1189,17 @@ function ps_detect_scale(lo, hi, un)
|
|||||||
lo[%$kAngleDimLabel] = -45/2
|
lo[%$kAngleDimLabel] = -45/2
|
||||||
hi[%$kAngleDimLabel] = +45/2
|
hi[%$kAngleDimLabel] = +45/2
|
||||||
un[%$kAngleDimLabel] = "deg"
|
un[%$kAngleDimLabel] = "deg"
|
||||||
|
ax[%$kAngleDimLabel] = "angle"
|
||||||
break
|
break
|
||||||
case "Angular60":
|
case "Angular60":
|
||||||
lo[%$kAngleDimLabel] = -60/2
|
lo[%$kAngleDimLabel] = -60/2
|
||||||
hi[%$kAngleDimLabel] = +60/2
|
hi[%$kAngleDimLabel] = +60/2
|
||||||
un[%$kAngleDimLabel] = "deg"
|
un[%$kAngleDimLabel] = "deg"
|
||||||
|
ax[%$kAngleDimLabel] = "angle"
|
||||||
break
|
break
|
||||||
case "Transmission":
|
case "Transmission":
|
||||||
un[%$kAngleDimLabel] = "arb."
|
un[%$kAngleDimLabel] = "arb."
|
||||||
|
ax[%$kAngleDimLabel] = "offset"
|
||||||
break
|
break
|
||||||
endswitch
|
endswitch
|
||||||
endif
|
endif
|
||||||
@ -1190,6 +1222,7 @@ function ps_detect_scale(lo, hi, un)
|
|||||||
if (WaveExists(scanner))
|
if (WaveExists(scanner))
|
||||||
lo[%$kScanDimLabel] = scanner[0]
|
lo[%$kScanDimLabel] = scanner[0]
|
||||||
hi[%$kScanDimLabel] = scanner[numpnts(scanner)-1]
|
hi[%$kScanDimLabel] = scanner[numpnts(scanner)-1]
|
||||||
|
ax[%$kScanDimLabel] = NameOfWave(scanner)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
end
|
end
|
||||||
@ -1211,14 +1244,23 @@ end
|
|||||||
/// @param data data wave to be scaled.
|
/// @param data data wave to be scaled.
|
||||||
/// dimension labels (index -1) must be set to match the limit waves.
|
/// dimension labels (index -1) must be set to match the limit waves.
|
||||||
///
|
///
|
||||||
|
/// @param ax axis labels.
|
||||||
|
/// the axis labels are written to the wave note in the format `AxisLabel%%s=%%s`
|
||||||
|
/// where `X`, `Y`, `Z`, `D` is substituted for the first place holder
|
||||||
|
/// and the label for the second one.
|
||||||
|
///
|
||||||
/// @param lo lower limits.
|
/// @param lo lower limits.
|
||||||
|
/// the lower limits are applied using the SetScale operation.
|
||||||
///
|
///
|
||||||
/// @param hi upper limits.
|
/// @param hi upper limits.
|
||||||
|
/// the upper limits are applied using the SetScale operation.
|
||||||
///
|
///
|
||||||
/// @param un unit labels.
|
/// @param un unit labels.
|
||||||
|
/// the unit labels are applied using the SetScale operation.
|
||||||
///
|
///
|
||||||
function ps_scale_dataset_2(data, lo, hi, un)
|
function ps_scale_dataset_2(data, ax, lo, hi, un)
|
||||||
wave data
|
wave data
|
||||||
|
wave /t ax
|
||||||
wave lo
|
wave lo
|
||||||
wave hi
|
wave hi
|
||||||
wave /t un
|
wave /t un
|
||||||
@ -1227,19 +1269,24 @@ function ps_scale_dataset_2(data, lo, hi, un)
|
|||||||
sdim = GetDimLabel(data, 0, -1)
|
sdim = GetDimLabel(data, 0, -1)
|
||||||
if (strlen(sdim))
|
if (strlen(sdim))
|
||||||
setscale /i x lo[%$sdim], hi[%$sdim], un[%$sdim], data
|
setscale /i x lo[%$sdim], hi[%$sdim], un[%$sdim], data
|
||||||
|
Note data, "AxisLabelX=" + ax[%$sdim]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sdim = GetDimLabel(data, 1, -1)
|
sdim = GetDimLabel(data, 1, -1)
|
||||||
if (strlen(sdim))
|
if (strlen(sdim))
|
||||||
setscale /i y lo[%$sdim], hi[%$sdim], un[%$sdim], data
|
setscale /i y lo[%$sdim], hi[%$sdim], un[%$sdim], data
|
||||||
|
Note data, "AxisLabelY=" + ax[%$sdim]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
sdim = GetDimLabel(data, 2, -1)
|
sdim = GetDimLabel(data, 2, -1)
|
||||||
if (strlen(sdim))
|
if (strlen(sdim))
|
||||||
setscale /i z lo[%$sdim], hi[%$sdim], un[%$sdim], data
|
setscale /i z lo[%$sdim], hi[%$sdim], un[%$sdim], data
|
||||||
|
Note data, "AxisLabelZ=" + ax[%$sdim]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
setscale d 0, 0, un[%$kDataDimLabel], data
|
setscale d 0, 0, un[%$kDataDimLabel], data
|
||||||
|
Note data, "AxisLabelD=" + ax[%$kDataDimLabel]
|
||||||
|
Note data, "Dataset=" + NameOfWave(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
/// load and reduce the ScientaImage dataset of the first scan of a PShell data file.
|
/// load and reduce the ScientaImage dataset of the first scan of a PShell data file.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user