1 #pragma rtGlobals=3// Use modern global access method and strict wave access. 3 #pragma IgorVersion = 6.2 4 #pragma ModuleName = PearlAnglescanPanel 5 #include "pearl-anglescan-process" 6 #include "pearl-pmsco-import" 47 static const string package_path =
"root:packages:pearl_anglescan_panel:";
49 static const string prefs_objects =
"theta_offset;tilt_offset;phi_offset;alpha_offset;crop_alpha_enable;crop_alpha_value;norm_alpha_enable;norm_alpha_mode;norm_alpha_smoothing;norm_phi_enable;norm_phi_mode;norm_phi_thetarange;norm_theta_enable;norm_theta_mode;norm_theta_smoothing;norm_thetaphi_enable;norm_thetaphi_mode;norm_theta_smoothing;output_folding;output_horizon;graph_mode;graph_projection;graph_colortable;graph_contrast;";
54 dfref savedf = GetDataFolderDFR()
59 if (nvar_exists(init_done))
70 variable /g init_done = 1
78 dfref savedf = getdatafolderdfr()
80 newdatafolder /o/s packages
81 newdatafolder /o/s $package_name
84 string /g graphname =
"graph_anglescan_panel" 87 variable /g theta_offset = 0
88 variable /g tilt_offset = 0
89 variable /g phi_offset = 0
90 variable /g alpha_offset = 0
91 variable /g crop_alpha_enable = 0
92 variable /g crop_alpha_value = 25
93 variable /g norm_alpha_enable = 0
94 variable /g norm_alpha_mode = 4
95 variable /g norm_alpha_smoothing = 0.25
96 variable /g norm_theta_enable = 0
97 variable /g norm_theta_mode = 4
98 variable /g norm_theta_smoothing = 0.25
99 variable /g norm_thetaphi_enable = 0
100 variable /g norm_thetaphi_mode = 4
101 variable /g norm_thetaphi_smoothing = 0.25
102 variable /g norm_phi_enable = 0
103 variable /g norm_phi_mode = 4
104 variable /g norm_phi_thetarange = 20
105 string /g output_name =
"holo1" 106 variable /g output_folding = 1
107 variable /g output_horizon = 88
108 variable /g graph_mode = 1
110 string /g graph_colortable =
"grays" 111 variable /g graph_contrast = 2
114 string /g source_path =
"" 115 string /g export_folderpath =
"root:" 116 variable /g export_format = 1
119 string /g panel_name =
"" 120 string /g preview_graphname =
"" 121 string /g dist_x_graphname =
"" 122 string /g dist_y_graphname =
"" 123 string /g output_graphname =
"" 126 make /n=(10,10) /o raw_data, process_data
127 make /o dist_x, dist_x_smoo
128 make /o dist_y, dist_y_smoo
138 dfref saveDF = GetDataFolderDFR()
140 string fullPath = SpecialDirPath(
"Packages", 0, 0, 0)
142 NewPath/O/C/Q tempPackagePrefsPath, fullPath
143 fullPath +=
":preferences.pxp" 145 SetDataFolder root:packages
146 SetDataFolder $package_name
149 KillPath/Z tempPackagePrefsPath
162 dfref saveDF = GetDataFolderDFR()
166 NewDataFolder /O/S packages
167 NewDataFolder /O/S $package_name
168 string fullPath = SpecialDirPath(
"Packages", 0, 0, 0)
171 GetFileFolderInfo /Q /Z fullPath
173 fullPath +=
":preferences.pxp" 174 GetFileFolderInfo /Q /Z fullPath
176 LoadData /O /R /Q fullPath
200 dfref saveDF = GetDataFolderDFR()
201 dfref datadf = GetWavesDataFolderDFR(raw_data)
202 dfref attrdf = datadf:attr
203 if (!DataFolderRefStatus(attrdf))
206 dfref parentdf = GetDataFolderDFR()
207 dfref attrdf = parentdf:attr
214 source_path = GetWavesDataFolder(raw_data, 2)
216 duplicate /o raw_data, raw, process_data
218 wave /sdfr=attrdf /z ManipulatorTheta
219 wave /sdfr=attrdf /z ManipulatorTilt
220 wave /sdfr=attrdf /z ManipulatorPhi
221 if (WaveExists(ManipulatorTheta) && WaveExists(ManipulatorTilt) && WaveExists(ManipulatorPhi))
222 duplicate /o attrdf:ManipulatorTheta, raw_theta, process_theta
223 duplicate /o attrdf:ManipulatorTilt, raw_tilt, process_tilt
224 duplicate /o attrdf:ManipulatorPhi, raw_phi, process_phi
226 DoAlert 0,
"Can't find manipulator angle waves.\rCheck that the attr folder exists, or provide values in the following table." 227 make /n=(dimsize(raw_data, 1)) /o raw_theta, raw_tilt, raw_phi
228 make /n=(dimsize(raw_data, 1)) /o process_theta, process_tilt, process_phi
229 edit /k=1 raw_theta, raw_tilt, raw_phi
232 make /o /n=(dimsize(raw_data, 0)) dist_x, dist_x_smoo
233 make /o /n=(dimsize(raw_data, 1)) dist_y, dist_y_smoo
244 wave /sdfr=df process_data
245 svar /sdfr=df preview_graphname
247 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
249 DoWindow /F $preview_graphname
254 nvar /sdfr=df graph_contrast
255 svar /sdfr=df graph_colortable
256 set_contrast(graph_contrast, graph_contrast, graphname=preview_graphname, colortable=graph_colortable)
267 variable xdist, ydist
272 wave /sdfr=df dist_x_smoo
273 wave /sdfr=df dist_y_smoo
274 svar /sdfr=df dist_x_graphname
275 svar /sdfr=df dist_y_graphname
278 if (strlen(dist_x_graphname) && (wintype(dist_x_graphname) == 1))
279 DoWindow /F $dist_x_graphname
281 display /k=1 /n=graph_asp_dist_x dist_x, dist_x_smoo
282 dist_x_graphname = s_name
283 ModifyGraph /w=$dist_x_graphname mode(dist_x)=2
284 ModifyGraph /w=$dist_x_graphname lsize(dist_x)=2
285 ModifyGraph /w=$dist_x_graphname rgb(dist_x)=(0,0,0)
290 if (strlen(dist_y_graphname) && (wintype(dist_y_graphname) == 1))
291 DoWindow /F $dist_y_graphname
293 display /k=1 /n=graph_asp_dist_y dist_y, dist_y_smoo
294 dist_y_graphname = s_name
295 ModifyGraph /w=$dist_y_graphname mode(dist_y)=2
296 ModifyGraph /w=$dist_y_graphname lsize(dist_y)=2
297 ModifyGraph /w=$dist_y_graphname rgb(dist_y)=(0,0,0)
316 wave /sdfr=df raw_theta
317 wave /sdfr=df raw_tilt
318 wave /sdfr=df raw_phi
319 nvar /sdfr=df theta_offset
320 nvar /sdfr=df tilt_offset
321 nvar /sdfr=df phi_offset
322 nvar /sdfr=df alpha_offset
324 duplicate /o raw, df:process_data
325 duplicate /o raw_theta, df:process_theta
326 duplicate /o raw_tilt, df:process_tilt
327 duplicate /o raw_phi, df:process_phi
329 wave /sdfr=df process_data
330 wave /sdfr=df process_theta
331 wave /sdfr=df process_tilt
332 wave /sdfr=df process_phi
334 process_theta = raw_theta - theta_offset
335 process_tilt = raw_tilt - tilt_offset
336 process_phi = raw_phi - phi_offset
337 setscale /p x dimoffset(raw, 0) - alpha_offset, dimdelta(raw, 0), waveunits(raw, 0), process_data
351 static variable
do_crop_alpha(variable check, variable force = defaultValue){
355 if (ParamIsDefault(force))
360 wave /sdfr=df process_data
361 nvar /sdfr=df crop_alpha_enable
362 nvar /sdfr=df crop_alpha_value
364 if ((force || crop_alpha_enable) && (crop_alpha_value > abs(dimdelta(process_data, 0))))
365 crop_strip(process_data, -crop_alpha_value, +crop_alpha_value)
380 static variable
do_norm_alpha(variable check, variable force = defaultValue){
384 if (ParamIsDefault(force))
388 dfref saveDF = GetDataFolderDFR()
390 wave /sdfr=df process_data
391 nvar /sdfr=df norm_alpha_enable
392 nvar /sdfr=df norm_alpha_mode
393 nvar /sdfr=df norm_alpha_smoothing
395 if (force || norm_alpha_enable)
396 dfref temp_df = newfreedatafolder()
397 setdatafolder temp_df
398 normalize_strip_x(process_data, smooth_method=norm_alpha_mode, smooth_factor=norm_alpha_smoothing, check=check)
402 duplicate /o check_dist, df:dist_x
403 duplicate /o check_smoo, df:dist_x_smoo
421 static variable
do_norm_phi(variable check, variable force = defaultValue){
425 if (ParamIsDefault(force))
429 dfref saveDF = GetDataFolderDFR()
431 wave /sdfr=df process_data
432 wave /sdfr=df process_theta
433 wave /sdfr=df process_phi
434 nvar /sdfr=df norm_phi_enable
435 nvar /sdfr=df norm_phi_mode
436 nvar /sdfr=df norm_phi_thetarange
438 if (force || norm_phi_enable)
439 dfref temp_df = newfreedatafolder()
440 setdatafolder temp_df
441 normalize_strip_phi(process_data, process_theta, process_phi, theta_range=norm_phi_thetarange, check=check)
445 duplicate /o check_dist, df:dist_y
446 duplicate /o check_smoo, df:dist_y_smoo
464 static variable
do_norm_theta(variable check, variable force = defaultValue){
468 if (ParamIsDefault(force))
472 dfref saveDF = GetDataFolderDFR()
474 wave /sdfr=df process_data
475 wave /sdfr=df process_theta
476 nvar /sdfr=df norm_theta_enable
477 nvar /sdfr=df norm_theta_mode
478 nvar /sdfr=df norm_theta_smoothing
480 if (force || norm_theta_enable)
481 dfref temp_df = newfreedatafolder()
482 setdatafolder temp_df
483 normalize_strip_theta(process_data, process_theta, smooth_method=norm_theta_mode, smooth_factor=norm_theta_smoothing, check=check)
487 duplicate /o check_dist, df:dist_y
488 duplicate /o check_smoo, df:dist_y_smoo
510 if (ParamIsDefault(force))
514 dfref saveDF = GetDataFolderDFR()
516 wave /sdfr=df process_data
517 wave /sdfr=df process_theta
518 wave /sdfr=df process_phi
519 nvar /sdfr=df norm_thetaphi_enable
520 nvar /sdfr=df norm_thetaphi_mode
521 nvar /sdfr=df norm_thetaphi_smoothing
523 if (force || norm_thetaphi_enable)
524 dfref temp_df = newfreedatafolder()
525 setdatafolder temp_df
526 normalize_strip_thetaphi(process_data, process_theta, process_phi, smooth_method=norm_thetaphi_mode, smooth_factor=norm_thetaphi_smoothing, check=check)
530 duplicate /o check_dist, df:dist_y
531 duplicate /o check_smoo, df:dist_y_smoo
543 dfref saveDF = GetDataFolderDFR()
553 nvar folding=output_folding
554 nvar horizon=output_horizon
563 pizza_service_2(process_data, output_name, process_theta, process_tilt, process_phi, folding=folding, nograph=1)
565 setdatafolder $output_name
569 values = pol <= horizon ? values : nan
580 svar /sdfr=df output_name
581 svar /sdfr=df output_graphname
582 nvar /sdfr=df graph_projection
583 nvar /sdfr=df graph_mode
585 dfref saveDF = GetDataFolderDFR()
587 output_graphname = output_name
588 output_graphname =
display_hemi_scan(output_name, projection=graph_projection, graphtype=graph_mode, graphname=output_graphname)
600 svar /sdfr=df preview_graphname
601 svar /sdfr=df output_graphname
602 svar /sdfr=df graph_colortable
603 nvar /sdfr=df graph_contrast
605 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
606 set_contrast(graph_contrast, graph_contrast, graphname=preview_graphname, colortable=graph_colortable)
608 if (strlen(output_graphname) && (wintype(output_graphname) == 1))
609 set_contrast(graph_contrast, graph_contrast, graphname=output_graphname, colortable=graph_colortable)
618 svar /sdfr=df preview_graphname
619 svar /sdfr=df output_graphname
620 svar /sdfr=df dist_x_graphname
621 svar /sdfr=df dist_y_graphname
623 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
624 killwindow $preview_graphname
626 if (strlen(output_graphname) && (wintype(output_graphname) == 1))
627 killwindow $output_graphname
629 if (strlen(dist_x_graphname) && (wintype(dist_x_graphname) == 1))
630 killwindow $dist_x_graphname
632 if (strlen(dist_y_graphname) && (wintype(dist_y_graphname) == 1))
633 killwindow $dist_y_graphname
636 preview_graphname =
"" 637 output_graphname =
"" 638 dist_x_graphname =
"" 639 dist_y_graphname =
"" 654 svar /sdfr=df source_path
655 svar /sdfr=df output_name
656 svar /sdfr=df output_graphname
657 wave raw_data = $source_path
659 dfref saveDF = GetDataFolderDFR()
660 dfref dest_df = GetWavesDataFolderDFR(raw_data)
661 setdatafolder dest_df
662 newdatafolder /o /s $dest_name
663 dfref dest_df = GetDataFolderDFR()
674 svar /sdfr=df output_name
676 dfref saveDF = GetDataFolderDFR()
691 svar /sdfr=df output_name
692 wave /sdfr=df process_data
694 dfref saveDF = GetDataFolderDFR()
697 string s_int =
"values" 699 string s_polar = s_prefix +
"pol" 700 string s_azim = s_prefix +
"az" 702 pmsco_save_scan(
"",
"", num2str(ekin), s_polar, s_azim,
"", s_int,
"", sdfr=data_df)
773 svar /sdfr=df panel_name
775 if (strlen(panel_name) && (wintype(panel_name) == 7))
776 DoWindow /F $panel_name
780 NewPanel /K=1 /N=anglescan_panel /W=(200,100,479,1027) as
"angle scan processing" 783 GroupBox gb_source, title=
"data source" 785 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."}
786 TitleBox tb_source_path, size={240,21}
787 TitleBox tb_source_path,variable= root:packages:pearl_anglescan_panel:source_path
789 GroupBox gb_offsets, title=
"offsets" 790 SetVariable sv_theta_offset, size={88,16},bodyWidth=60,title=
"theta" 791 SetVariable sv_theta_offset,value= root:packages:pearl_anglescan_panel:theta_offset
792 SetVariable sv_theta_offset, help={
"manipulator theta value that corresponds to normal emission."}
793 SetVariable sv_tilt_offset, size={74,16},bodyWidth=60,title=
"tilt" 794 SetVariable sv_tilt_offset,value= root:packages:pearl_anglescan_panel:tilt_offset
795 SetVariable sv_tilt_offset, help={
"manipulator tilt value that corresponds to normal emission."}
796 SetVariable sv_phi_offset, size={78,16},bodyWidth=60,title=
"phi" 797 SetVariable sv_phi_offset,value= root:packages:pearl_anglescan_panel:phi_offset
798 SetVariable sv_phi_offset, help={
"manipulator phi value that should map to the 3 o'clock angle."}
799 SetVariable sv_alpha_offset, size={90,16},bodyWidth=60,title=
"alpha" 800 SetVariable sv_alpha_offset,value= root:packages:pearl_anglescan_panel:alpha_offset
801 SetVariable sv_alpha_offset, help={
"alpha value that corresponds to normal emission (if the sample normal is properly aligned)."}
803 GroupBox gb_crop_alpha, title=
"crop alpha" 804 CheckBox cb_crop_alpha_enable, size={50,14}, title=
"enable" 805 CheckBox cb_crop_alpha_enable, help={
"enable cropping at +/- alpha"}
806 CheckBox cb_crop_alpha_enable,variable= root:packages:pearl_anglescan_panel:crop_alpha_enable
807 SetVariable sv_crop_alpha_value, size={90,16},bodyWidth=60,title=
"angle" 808 SetVariable sv_crop_alpha_value,limits={0,30,1},value= root:packages:pearl_anglescan_panel:crop_alpha_value
809 SetVariable sv_crop_alpha_value, help={
"alpha (detection angle) cropping angle"}
811 Button b_crop_alpha_preview, help={
"show a preview of the cropped dataset."}
813 GroupBox gb_norm_alpha, title=
"normalize alpha" 814 CheckBox cb_norm_alpha_enable, size={50,14}, title=
"enable" 815 CheckBox cb_norm_alpha_enable,variable= root:packages:pearl_anglescan_panel:norm_alpha_enable
816 CheckBox cb_norm_alpha_enable, help={
"enable normalization of the alpha distribution"}
818 PopupMenu pm_norm_alpha_mode, mode=5, popvalue=
"loess", value= #
"\"none;binomial;boxcar;scienta;loess;\"" 819 PopupMenu pm_norm_alpha_mode, help={
"alpha normalization method. recommended: loess"}
820 SetVariable sv_norm_alpha_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 821 SetVariable sv_norm_alpha_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_alpha_smoothing
822 SetVariable sv_norm_alpha_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
824 Button b_norm_alpha_check, help={
"show a graph of the normalization function"}
826 Button b_norm_alpha_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
828 GroupBox gb_norm_phi, title=
"normalize phi" 829 CheckBox cb_norm_phi_enable, size={50,14}, title=
"enable" 830 CheckBox cb_norm_phi_enable,variable= root:packages:pearl_anglescan_panel:norm_phi_enable
831 CheckBox cb_norm_phi_enable, help={
"enable normalization of the phi distribution to reduce the effect of wobble"}
832 SetVariable sv_norm_phi_range, size={118,16}, bodyWidth=60, title=
"theta range" 833 SetVariable sv_norm_phi_range, limits={0,90,1}, value= root:packages:pearl_anglescan_panel:norm_phi_thetarange
834 SetVariable sv_norm_phi_range, help={
"theta range (from normal) to factor into the normalization function"}
836 Button b_norm_phi_check, help={
"show a graph of the normalization function"}
838 Button b_norm_phi_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
840 GroupBox gb_norm_theta, title=
"normalize theta" 841 CheckBox cb_norm_theta_enable, size={50,14},title=
"enable" 842 CheckBox cb_norm_theta_enable, variable= root:packages:pearl_anglescan_panel:norm_theta_enable
843 CheckBox cb_norm_theta_enable, help={
"enable normalization of the theta distribution (integrated over phi)"}
845 PopupMenu pm_norm_theta_mode,mode=5,popvalue=
"loess",value= #
"\"none;binomial;boxcar;polynomial;loess;\"" 846 PopupMenu pm_norm_theta_mode, help={
"theta normalization method. recommended: loess"}
847 SetVariable sv_norm_theta_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 848 SetVariable sv_norm_theta_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_theta_smoothing
849 SetVariable sv_norm_theta_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
851 Button b_norm_theta_check, help={
"show a graph of the normalization function"}
853 Button b_norm_theta_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
855 GroupBox gb_norm_thetaphi, size={272,97},title=
"normalize (theta,phi)" 856 CheckBox cb_norm_thetaphi_enable, size={50,14},title=
"enable" 857 CheckBox cb_norm_thetaphi_enable, variable= root:packages:pearl_anglescan_panel:norm_thetaphi_enable
858 CheckBox cb_norm_thetaphi_enable, help={
"enable normalization of the (theta, phi) distribution."}
860 PopupMenu pm_norm_thetaphi_mode, mode=5, popvalue=
"loess", value= #
"\"none;none;none;none;loess;\"" 861 PopupMenu pm_norm_thetaphi_mode, help={
"theta normalization method. recommended: loess"}
862 SetVariable sv_norm_thetaphi_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 863 SetVariable sv_norm_thetaphi_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_thetaphi_smoothing
864 SetVariable sv_norm_thetaphi_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
866 Button b_norm_thetaphi_check, help={
"show a graph of the normalization function"}
868 Button b_norm_thetaphi_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
870 GroupBox gb_output, title=
"output" 871 SetVariable sv_output_folding, size={95,16}, bodyWidth=60, title=
"folding" 872 SetVariable sv_output_folding, limits={1,20,1}, value= root:packages:pearl_anglescan_panel:output_folding
873 SetVariable sv_output_folding, help={
"n-fold rotational average. 1=no averaging."}
874 SetVariable sv_output_horizon, size={98,16}, bodyWidth=60, title=
"horizon" 875 SetVariable sv_output_horizon, limits={1,90,1}, value= root:packages:pearl_anglescan_panel:output_horizon
876 SetVariable sv_output_horizon, help={
"highest theta to display"}
878 PopupMenu pm_graph_projection, mode=2, popvalue=
"stereographic", value= #
"\"equidistant;stereographic;equal area;gnomonic;orthographic;\"" 879 PopupMenu pm_graph_projection, help={
"projection (theta mapping) mode"}
881 PopupMenu pm_graph_mode, mode=2, popvalue=
"polar plot", value= #
"\"none;polar plot;none;image;\"" 882 PopupMenu pm_graph_mode, help={
"graph mode"}
884 Button b_output_calc, help={
"execute data processing with the enabled filters and display the diffractogram."}
886 Button b_output_duplicate, help={
"copy the result to an arbitrary data folder."}
888 Button b_output_itx, help={
"save the result to an igor text file (itx)."}
890 Button b_output_etpi, help={
"save the result to a pmsco angle scan file (etpi)."}
892 GroupBox gb_graph, title=
"graph" 894 PopupMenu pm_graph_colortable, mode=0, value= #
"\"*COLORTABLEPOPNONAMES*\"" 895 PopupMenu pm_graph_colortable, help={
"color table to use in pseudocolor graphs."}
896 SetVariable sv_graph_contrast, size={119,16}, bodyWidth=60, title=
"contrast (%)" 897 SetVariable sv_graph_contrast, limits={0,25,1}, value= root:packages:pearl_anglescan_panel:graph_contrast
898 SetVariable sv_graph_contrast, help={
"contrast value (percentile)."}
900 Button b_graph_update, help={
"update the existing graph."}
902 Button b_graph_png, help={
"save the graph in png format."}
910 svar /sdfr=df panel_name
912 variable gb_space = 2
913 variable gb_internal_top = 20
914 variable gb_internal_bot = 8
915 variable line_space = 26
933 GroupBox gb_source,pos={4,gb_top}
934 gb_ht = gb_internal_top
935 Button b_source_select,pos={17, gb_top + gb_ht + b_adj},size={50,20}
937 TitleBox tb_source_path,pos={18, gb_top + gb_ht + tb_adj},size={240,21}
939 gb_ht += gb_internal_bot
940 GroupBox gb_source, size={272,gb_ht}
942 gb_top += gb_ht + gb_space
943 GroupBox gb_offsets,pos={4,gb_top}
944 gb_ht = gb_internal_top
945 SetVariable sv_theta_offset,pos={46, gb_top + gb_ht + sv_adj},size={88,16}
947 SetVariable sv_tilt_offset,pos={60, gb_top + gb_ht + sv_adj},size={74,16}
949 SetVariable sv_phi_offset,pos={56, gb_top + gb_ht + sv_adj},size={78,16}
951 SetVariable sv_alpha_offset,pos={44, gb_top + gb_ht + sv_adj},size={90,16}
953 gb_ht += gb_internal_bot
954 GroupBox gb_offsets, size={272,gb_ht}
956 gb_top += gb_ht + gb_space
957 GroupBox gb_crop_alpha,pos={4,gb_top}
958 gb_ht = gb_internal_top
959 CheckBox cb_crop_alpha_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
961 SetVariable sv_crop_alpha_value,pos={44, gb_top + gb_ht + sv_adj},size={90,16}
962 Button b_crop_alpha_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
964 gb_ht += gb_internal_bot
965 GroupBox gb_crop_alpha, size={272,gb_ht}
967 gb_top += gb_ht + gb_space
968 GroupBox gb_norm_alpha,pos={4,gb_top}
969 gb_ht = gb_internal_top
970 CheckBox cb_norm_alpha_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
972 PopupMenu pm_norm_alpha_mode,pos={36, gb_top + gb_ht + pm_adj},size={138,21}
973 Button b_norm_alpha_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
975 SetVariable sv_norm_alpha_smoothing,pos={22, gb_top + gb_ht + sv_adj},size={112,16}
976 Button b_norm_alpha_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
978 gb_ht += gb_internal_bot
979 GroupBox gb_norm_alpha, size={272,gb_ht}
981 gb_top += gb_ht + gb_space
982 GroupBox gb_norm_phi,pos={4,gb_top}
983 gb_ht = gb_internal_top
984 CheckBox cb_norm_phi_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
985 Button b_norm_phi_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
987 SetVariable sv_norm_phi_range,pos={15, gb_top + gb_ht + sv_adj},size={118,16}
988 Button b_norm_phi_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
990 gb_ht += gb_internal_bot
991 GroupBox gb_norm_phi, size={272,gb_ht}
993 gb_top += gb_ht + gb_space
994 GroupBox gb_norm_theta,pos={4,gb_top}
995 gb_ht = gb_internal_top
996 CheckBox cb_norm_theta_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
998 PopupMenu pm_norm_theta_mode,pos={35, gb_top + gb_ht + pm_adj},size={138,21}
999 Button b_norm_theta_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1001 SetVariable sv_norm_theta_smoothing,pos={21, gb_top + gb_ht + sv_adj},size={112,16}
1002 Button b_norm_theta_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1004 gb_ht += gb_internal_bot
1005 GroupBox gb_norm_theta, size={272,gb_ht}
1007 gb_top += gb_ht + gb_space
1008 GroupBox gb_norm_thetaphi,pos={4,gb_top}
1009 gb_ht = gb_internal_top
1010 CheckBox cb_norm_thetaphi_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
1012 PopupMenu pm_norm_thetaphi_mode,pos={35, gb_top + gb_ht + pm_adj},size={138,21}
1013 Button b_norm_thetaphi_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1015 SetVariable sv_norm_thetaphi_smoothing,pos={21, gb_top + gb_ht + sv_adj},size={112,16}
1016 Button b_norm_thetaphi_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1018 gb_ht += gb_internal_bot
1019 GroupBox gb_norm_thetaphi, size={272,gb_ht}
1021 gb_top += gb_ht + gb_space
1022 GroupBox gb_output,pos={4,gb_top}
1023 gb_ht = gb_internal_top
1024 SetVariable sv_output_folding,pos={38, gb_top + gb_ht + sv_adj},size={95,16}
1025 Button b_output_calc,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1027 SetVariable sv_output_horizon,pos={35, gb_top + gb_ht + sv_adj},size={98,16}
1028 Button b_output_duplicate,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1030 PopupMenu pm_graph_projection,pos={24, gb_top + gb_ht + pm_adj},size={149,21}
1031 Button b_output_itx,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1033 PopupMenu pm_graph_mode,pos={44, gb_top + gb_ht + pm_adj},size={129,21}
1034 Button b_output_etpi,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1036 gb_ht += gb_internal_bot
1037 GroupBox gb_output, size={272,gb_ht}
1039 gb_top += gb_ht + gb_space
1040 GroupBox gb_graph,pos={4,gb_top}
1041 gb_ht = gb_internal_top
1042 PopupMenu pm_graph_colortable,pos={21, gb_top + gb_ht + pm_adj},size={152,21}
1043 Button b_graph_update,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1045 SetVariable sv_graph_contrast,pos={14, gb_top + gb_ht + sv_adj},size={119,16}
1046 Button b_graph_png,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1048 gb_ht += gb_internal_bot
1049 GroupBox gb_graph, size={272,gb_ht}
1056 svar /sdfr=df panel_name
1057 if (wintype(panel_name) == 7)
1059 nvar /sdfr=df norm_alpha_mode
1060 m = norm_alpha_mode + 1
1061 PopupMenu pm_norm_alpha_mode win=$panel_name, mode=m
1062 nvar /sdfr=df norm_theta_mode
1063 m = norm_theta_mode + 1
1064 PopupMenu pm_norm_theta_mode win=$panel_name, mode=m
1065 nvar /sdfr=df norm_thetaphi_mode
1066 m = norm_thetaphi_mode + 1
1067 PopupMenu pm_norm_thetaphi_mode win=$panel_name, mode=m
1068 nvar /sdfr=df graph_mode
1070 PopupMenu pm_graph_mode win=$panel_name, mode=m
1071 nvar /sdfr=df graph_projection
1072 m = graph_projection + 1
1073 PopupMenu pm_graph_projection win=$panel_name, mode=m
1074 svar /sdfr=df graph_colortable
1075 m = 1 + WhichListItem(graph_colortable, CTabList())
1076 PopupMenu pm_graph_colortable win=$panel_name, mode=m
1081 STRUCT WMButtonAction &ba
1083 switch( ba.eventCode )
1085 dfref dfBefore = GetDataFolderDFR()
1086 Execute /q/z
"CreateBrowser prompt=\"Select 2D holo scan wave\", showWaves=1, showVars=0, showStrs=0" 1087 dfref dfAfter = GetDataFolderDFR()
1088 SetDataFolder dfBefore
1090 SVAR list = S_BrowserList
1092 if ((flag != 0) && (ItemsInList(list) >= 1))
1093 string wname = StringFromList(0, list)
1107 STRUCT WMButtonAction &ba
1109 switch( ba.eventCode )
1121 STRUCT WMButtonAction &ba
1123 switch( ba.eventCode )
1135 STRUCT WMButtonAction &ba
1137 switch( ba.eventCode )
1149 STRUCT WMButtonAction &ba
1151 switch( ba.eventCode )
1163 STRUCT WMButtonAction &ba
1165 switch( ba.eventCode )
1177 STRUCT WMButtonAction &ba
1179 switch( ba.eventCode )
1191 STRUCT WMButtonAction &ba
1193 switch( ba.eventCode )
1205 STRUCT WMButtonAction &ba
1207 switch( ba.eventCode )
1219 STRUCT WMButtonAction &ba
1221 switch( ba.eventCode )
1233 STRUCT WMButtonAction &ba
1235 switch( ba.eventCode )
1248 STRUCT WMButtonAction &ba
1250 switch( ba.eventCode )
1253 prompt dest_folder,
"destination folder name (relative to data source)" 1254 doprompt
"duplicate", dest_folder
1267 STRUCT WMButtonAction &ba
1269 switch( ba.eventCode )
1272 wave /sdfr=df process_data
1274 ekin = NumberByKey(
"KineticEnergy", note(process_data),
"=",
"\r")
1275 prompt ekin,
"kinetic energy" 1276 doprompt
"save etpi", ekin
1289 STRUCT WMButtonAction &ba
1291 switch( ba.eventCode )
1303 STRUCT WMButtonAction &ba
1305 switch( ba.eventCode )
1317 STRUCT WMButtonAction &ba
1319 switch( ba.eventCode )
1322 svar /sdfr=df source_path
1323 svar /sdfr=df output_graphname
1324 if (WinType(output_graphname) == 1)
1325 SavePICT /WIN=$output_graphname /E=-5 /B=144 /TRAN=0
1336 STRUCT WMPopupAction &pa
1338 switch( pa.eventCode )
1341 nvar /sdfr=df norm_alpha_mode
1342 norm_alpha_mode = pa.popNum - 1
1352 STRUCT WMPopupAction &pa
1354 switch( pa.eventCode )
1357 nvar /sdfr=df norm_theta_mode
1358 norm_theta_mode = pa.popNum - 1
1368 STRUCT WMPopupAction &pa
1370 switch( pa.eventCode )
1373 nvar /sdfr=df norm_thetaphi_mode
1374 norm_thetaphi_mode = pa.popNum - 1
1384 STRUCT WMPopupAction &pa
1386 switch( pa.eventCode )
1389 nvar /sdfr=df graph_mode
1390 graph_mode = pa.popNum - 1
1400 STRUCT WMPopupAction &pa
1402 switch( pa.eventCode )
1405 nvar /sdfr=df graph_projection
1406 graph_projection = pa.popNum - 1
1416 STRUCT WMPopupAction &pa
1418 switch( pa.eventCode )
1421 svar /sdfr=df graph_colortable
1422 graph_colortable = StringFromList(pa.popNum - 1, CTabList())
static variable bp_norm_phi_preview(WMButtonAction *ba)
variable pizza_service_2(wave data, string nickname, wave m_theta, wave m_tilt, wave m_phi, variable npolar=defaultValue, variable nograph=defaultValue, variable folding=defaultValue, variable xpdplot=defaultValue)
create a pizza plot from a measured (energy-integrated) data strip
variable normalize_strip_theta(wave strip, wave theta, variable theta_offset=defaultValue, variable smooth_method=defaultValue, variable smooth_factor=defaultValue, variable check=defaultValue)
divide the strip by the average polar distribution.
static variable do_init_process(variable check)
initialize the process data with a copy of the raw data.
static variable preview_norm_alpha()
variable asp_calculate_output()
calculate the output using all enabled processing filters.
static variable check_norm_alpha()
variable asp_import_raw(wave raw_data)
import raw data
variable crop_strip(wave strip, variable xlo, variable xhi)
crop a strip at the sides.
variable ad_update_profiles(wave image)
update a profiles graph with new data.
variable asp_duplicate_output(string dest_name)
copy the output data to a new folder
variable asp_save_output_itx()
save the output diffractogram to an igor text file
string display_hemi_scan(string nickname, variable projection=defaultValue, variable graphtype=defaultValue, variable do_ticks=defaultValue, variable do_grids=defaultValue, string graphname=defaultValue)
display a plot of a hemispherical angle scan.
static variable pmp_graph_colortable(WMPopupAction *pa)
static variable save_prefs()
save persistent package data to the preferences file.
static variable bp_graph_update(WMButtonAction *ba)
dfr find_hemi_data(string nickname, string *prefix, string *intwave)
finds the folder, prefix and name of holo waves given their nick name
static variable bp_norm_alpha_preview(WMButtonAction *ba)
static variable preview_crop_alpha()
static variable pmp_norm_alpha_mode(WMPopupAction *pa)
static variable init_package()
static variable preview_norm_theta()
static variable bp_norm_thetaphi_check(WMButtonAction *ba)
static variable bp_norm_theta_preview(WMButtonAction *ba)
static variable do_crop_alpha(variable check, variable force=defaultValue)
alpha-crop the process data.
static const string package_path
data folder path
static variable bp_crop_alpha_preview(WMButtonAction *ba)
static variable do_norm_thetaphi(variable check, variable force=defaultValue)
theta,phi-normalize the process data.
static variable bp_output_etpi(WMButtonAction *ba)
variable asp_display_dist_check(variable xdist, variable ydist)
display a graph window of the distribution checks.
static variable bp_graph_png(WMButtonAction *ba)
static variable pmp_graph_mode(WMPopupAction *pa)
static variable preview_norm_phi()
static variable pmp_norm_theta_mode(WMPopupAction *pa)
static variable do_norm_phi(variable check, variable force=defaultValue)
phi-normalize the process data.
static variable bp_norm_thetaphi_preview(WMButtonAction *ba)
static variable do_norm_theta(variable check, variable force=defaultValue)
theta-normalize the process data.
static variable check_norm_phi()
static const string prefs_objects
semicolon-separated list of persistent variable, string, and wave names
variable asp_show_panel()
create the angle scan processing panel
static variable bp_output_calc(WMButtonAction *ba)
static variable arrange_controls()
static variable bp_norm_theta_check(WMButtonAction *ba)
variable save_hemi_scan(string nickname, string pathname, string filename)
save a hemispherical scan to an Igor text file
variable normalize_strip_phi(wave strip, wave theta, wave phi, variable theta_offset=defaultValue, variable theta_range=defaultValue, variable check=defaultValue)
divide the strip by a sine function in phi (wobble correction).
variable normalize_strip_thetaphi(wave strip, wave theta, wave phi, variable theta_offset=defaultValue, variable smooth_method=defaultValue, variable smooth_factor=defaultValue, variable check=defaultValue)
divide the strip by a smooth polar-azimuthal distribution.
const variable kProjStereo
static variable update_menus()
update the popup menus to reflect the values of the global variables
static variable bp_output_itx(WMButtonAction *ba)
variable asp_close_graphs()
close all graphs created by the angle scan panel
static variable do_norm_alpha(variable check, variable force=defaultValue)
alpha-normalize the process data.
string ad_display_profiles(wave image, string filter=defaultValue)
open a new profiles graph window.
static variable load_prefs()
load persistent package data from the preferences file.
static variable check_norm_theta()
variable set_contrast(variable pcmin, variable pcmax, string graphname=defaultValue, string colortable=defaultValue)
set the pseudocolor contrast by percentile.
variable asp_display_previews()
display a graph window of the processed data.
variable asp_save_output_etpi(variable ekin)
save the output diffractogram to a PMSCO ETPI file
static variable bp_output_duplicate(WMButtonAction *ba)
static variable bp_norm_alpha_check(WMButtonAction *ba)
static variable check_norm_thetaphi()
static variable bp_norm_phi_check(WMButtonAction *ba)
static variable bp_source_select(WMButtonAction *ba)
static variable AfterCompiledHook()
initialize package data once when the procedure is first loaded
variable asp_display_output()
display the output diffractogram in a new graph
variable duplicate_hemi_scan(string source_nickname, dfref dest_folder, string dest_nickname, variable xpdplot=defaultValue)
duplicate a hemispherical scan dataset.
static variable pmp_norm_thetaphi_mode(WMPopupAction *pa)
static variable preview_norm_thetaphi()
static const string package_name
package name is used as data folder name
variable asp_update_graph()
update graphs with new color table or contrast
interactive processing of angle scanned XPD data.
static variable pmp_graph_projection(WMPopupAction *pa)
variable normalize_strip_x(wave strip, variable smooth_method=defaultValue, variable smooth_factor=defaultValue, variable check=defaultValue)
divide the strip by the average X distribution.