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
208 source_path = GetWavesDataFolder(raw_data, 2)
210 duplicate /o raw_data, raw, process_data
211 duplicate /o attrdf:ManipulatorTheta, raw_theta, process_theta
212 duplicate /o attrdf:ManipulatorTilt, raw_tilt, process_tilt
213 duplicate /o attrdf:ManipulatorPhi, raw_phi, process_phi
215 make /o /n=(dimsize(raw_data, 0)) dist_x, dist_x_smoo
216 make /o /n=(dimsize(raw_data, 1)) dist_y, dist_y_smoo
227 wave /sdfr=df process_data
228 svar /sdfr=df preview_graphname
230 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
232 DoWindow /F $preview_graphname
237 nvar /sdfr=df graph_contrast
238 svar /sdfr=df graph_colortable
239 set_contrast(graph_contrast, graph_contrast, graphname=preview_graphname, colortable=graph_colortable)
250 variable xdist, ydist
255 wave /sdfr=df dist_x_smoo
256 wave /sdfr=df dist_y_smoo
257 svar /sdfr=df dist_x_graphname
258 svar /sdfr=df dist_y_graphname
261 if (strlen(dist_x_graphname) && (wintype(dist_x_graphname) == 1))
262 DoWindow /F $dist_x_graphname
264 display /k=1 /n=graph_asp_dist_x dist_x, dist_x_smoo
265 dist_x_graphname = s_name
266 ModifyGraph /w=$dist_x_graphname mode(dist_x)=2
267 ModifyGraph /w=$dist_x_graphname lsize(dist_x)=2
268 ModifyGraph /w=$dist_x_graphname rgb(dist_x)=(0,0,0)
273 if (strlen(dist_y_graphname) && (wintype(dist_y_graphname) == 1))
274 DoWindow /F $dist_y_graphname
276 display /k=1 /n=graph_asp_dist_y dist_y, dist_y_smoo
277 dist_y_graphname = s_name
278 ModifyGraph /w=$dist_y_graphname mode(dist_y)=2
279 ModifyGraph /w=$dist_y_graphname lsize(dist_y)=2
280 ModifyGraph /w=$dist_y_graphname rgb(dist_y)=(0,0,0)
299 wave /sdfr=df raw_theta
300 wave /sdfr=df raw_tilt
301 wave /sdfr=df raw_phi
302 nvar /sdfr=df theta_offset
303 nvar /sdfr=df tilt_offset
304 nvar /sdfr=df phi_offset
305 nvar /sdfr=df alpha_offset
307 duplicate /o raw, df:process_data
308 duplicate /o raw_theta, df:process_theta
309 duplicate /o raw_tilt, df:process_tilt
310 duplicate /o raw_phi, df:process_phi
312 wave /sdfr=df process_data
313 wave /sdfr=df process_theta
314 wave /sdfr=df process_tilt
315 wave /sdfr=df process_phi
317 process_theta = raw_theta - theta_offset
318 process_tilt = raw_tilt - tilt_offset
319 process_phi = raw_phi - phi_offset
320 setscale /p x dimoffset(raw, 0) - alpha_offset, dimdelta(raw, 0), waveunits(raw, 0), process_data
334 static variable
do_crop_alpha(variable check, variable force = defaultValue){
338 if (ParamIsDefault(force))
343 wave /sdfr=df process_data
344 nvar /sdfr=df crop_alpha_enable
345 nvar /sdfr=df crop_alpha_value
347 if ((force || crop_alpha_enable) && (crop_alpha_value > abs(dimdelta(process_data, 0))))
348 crop_strip(process_data, -crop_alpha_value, +crop_alpha_value)
363 static variable
do_norm_alpha(variable check, variable force = defaultValue){
367 if (ParamIsDefault(force))
371 dfref saveDF = GetDataFolderDFR()
373 wave /sdfr=df process_data
374 nvar /sdfr=df norm_alpha_enable
375 nvar /sdfr=df norm_alpha_mode
376 nvar /sdfr=df norm_alpha_smoothing
378 if (force || norm_alpha_enable)
379 dfref temp_df = newfreedatafolder()
380 setdatafolder temp_df
381 normalize_strip_x(process_data, smooth_method=norm_alpha_mode, smooth_factor=norm_alpha_smoothing, check=check)
385 duplicate /o check_dist, df:dist_x
386 duplicate /o check_smoo, df:dist_x_smoo
404 static variable
do_norm_phi(variable check, variable force = defaultValue){
408 if (ParamIsDefault(force))
412 dfref saveDF = GetDataFolderDFR()
414 wave /sdfr=df process_data
415 wave /sdfr=df process_theta
416 wave /sdfr=df process_phi
417 nvar /sdfr=df norm_phi_enable
418 nvar /sdfr=df norm_phi_mode
419 nvar /sdfr=df norm_phi_thetarange
421 if (force || norm_phi_enable)
422 dfref temp_df = newfreedatafolder()
423 setdatafolder temp_df
424 normalize_strip_phi(process_data, process_theta, process_phi, theta_range=norm_phi_thetarange, check=check)
428 duplicate /o check_dist, df:dist_y
429 duplicate /o check_smoo, df:dist_y_smoo
447 static variable
do_norm_theta(variable check, variable force = defaultValue){
451 if (ParamIsDefault(force))
455 dfref saveDF = GetDataFolderDFR()
457 wave /sdfr=df process_data
458 wave /sdfr=df process_theta
459 nvar /sdfr=df norm_theta_enable
460 nvar /sdfr=df norm_theta_mode
461 nvar /sdfr=df norm_theta_smoothing
463 if (force || norm_theta_enable)
464 dfref temp_df = newfreedatafolder()
465 setdatafolder temp_df
466 normalize_strip_theta(process_data, process_theta, smooth_method=norm_theta_mode, smooth_factor=norm_theta_smoothing, check=check)
470 duplicate /o check_dist, df:dist_y
471 duplicate /o check_smoo, df:dist_y_smoo
493 if (ParamIsDefault(force))
497 dfref saveDF = GetDataFolderDFR()
499 wave /sdfr=df process_data
500 wave /sdfr=df process_theta
501 wave /sdfr=df process_phi
502 nvar /sdfr=df norm_thetaphi_enable
503 nvar /sdfr=df norm_thetaphi_mode
504 nvar /sdfr=df norm_thetaphi_smoothing
506 if (force || norm_thetaphi_enable)
507 dfref temp_df = newfreedatafolder()
508 setdatafolder temp_df
509 normalize_strip_thetaphi(process_data, process_theta, process_phi, smooth_method=norm_thetaphi_mode, smooth_factor=norm_thetaphi_smoothing, check=check)
513 duplicate /o check_dist, df:dist_y
514 duplicate /o check_smoo, df:dist_y_smoo
526 dfref saveDF = GetDataFolderDFR()
536 nvar folding=output_folding
537 nvar horizon=output_horizon
546 pizza_service_2(process_data, output_name, process_theta, process_tilt, process_phi, folding=folding, nograph=1)
548 setdatafolder $output_name
552 values = pol <= horizon ? values : nan
563 svar /sdfr=df output_name
564 svar /sdfr=df output_graphname
565 nvar /sdfr=df graph_projection
566 nvar /sdfr=df graph_mode
568 dfref saveDF = GetDataFolderDFR()
570 output_graphname = output_name
571 output_graphname =
display_hemi_scan(output_name, projection=graph_projection, graphtype=graph_mode, graphname=output_graphname)
583 svar /sdfr=df preview_graphname
584 svar /sdfr=df output_graphname
585 svar /sdfr=df graph_colortable
586 nvar /sdfr=df graph_contrast
588 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
589 set_contrast(graph_contrast, graph_contrast, graphname=preview_graphname, colortable=graph_colortable)
591 if (strlen(output_graphname) && (wintype(output_graphname) == 1))
592 set_contrast(graph_contrast, graph_contrast, graphname=output_graphname, colortable=graph_colortable)
601 svar /sdfr=df preview_graphname
602 svar /sdfr=df output_graphname
603 svar /sdfr=df dist_x_graphname
604 svar /sdfr=df dist_y_graphname
606 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
607 killwindow $preview_graphname
609 if (strlen(output_graphname) && (wintype(output_graphname) == 1))
610 killwindow $output_graphname
612 if (strlen(dist_x_graphname) && (wintype(dist_x_graphname) == 1))
613 killwindow $dist_x_graphname
615 if (strlen(dist_y_graphname) && (wintype(dist_y_graphname) == 1))
616 killwindow $dist_y_graphname
619 preview_graphname =
"" 620 output_graphname =
"" 621 dist_x_graphname =
"" 622 dist_y_graphname =
"" 637 svar /sdfr=df source_path
638 svar /sdfr=df output_name
639 svar /sdfr=df output_graphname
640 wave raw_data = $source_path
642 dfref saveDF = GetDataFolderDFR()
643 dfref dest_df = GetWavesDataFolderDFR(raw_data)
644 setdatafolder dest_df
645 newdatafolder /o /s $dest_name
646 dfref dest_df = GetDataFolderDFR()
657 svar /sdfr=df output_name
659 dfref saveDF = GetDataFolderDFR()
674 svar /sdfr=df output_name
675 wave /sdfr=df process_data
677 dfref saveDF = GetDataFolderDFR()
680 string s_int =
"values" 682 string s_polar = s_prefix +
"pol" 683 string s_azim = s_prefix +
"az" 685 pmsco_save_scan(
"",
"", num2str(ekin), s_polar, s_azim,
"", s_int,
"", sdfr=data_df)
756 svar /sdfr=df panel_name
758 if (strlen(panel_name) && (wintype(panel_name) == 7))
759 DoWindow /F $panel_name
763 NewPanel /K=1 /N=anglescan_panel /W=(200,100,479,1027) as
"angle scan processing" 766 GroupBox gb_source, title=
"data source" 768 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."}
769 TitleBox tb_source_path, size={240,21}
770 TitleBox tb_source_path,variable= root:packages:pearl_anglescan_panel:source_path
772 GroupBox gb_offsets, title=
"offsets" 773 SetVariable sv_theta_offset, size={88,16},bodyWidth=60,title=
"theta" 774 SetVariable sv_theta_offset,value= root:packages:pearl_anglescan_panel:theta_offset
775 SetVariable sv_theta_offset, help={
"manipulator theta value that corresponds to normal emission."}
776 SetVariable sv_tilt_offset, size={74,16},bodyWidth=60,title=
"tilt" 777 SetVariable sv_tilt_offset,value= root:packages:pearl_anglescan_panel:tilt_offset
778 SetVariable sv_tilt_offset, help={
"manipulator tilt value that corresponds to normal emission."}
779 SetVariable sv_phi_offset, size={78,16},bodyWidth=60,title=
"phi" 780 SetVariable sv_phi_offset,value= root:packages:pearl_anglescan_panel:phi_offset
781 SetVariable sv_phi_offset, help={
"manipulator phi value that should map to the 3 o'clock angle."}
782 SetVariable sv_alpha_offset, size={90,16},bodyWidth=60,title=
"alpha" 783 SetVariable sv_alpha_offset,value= root:packages:pearl_anglescan_panel:alpha_offset
784 SetVariable sv_alpha_offset, help={
"alpha value that corresponds to normal emission (if the sample normal is properly aligned)."}
786 GroupBox gb_crop_alpha, title=
"crop alpha" 787 CheckBox cb_crop_alpha_enable, size={50,14}, title=
"enable" 788 CheckBox cb_crop_alpha_enable, help={
"enable cropping at +/- alpha"}
789 CheckBox cb_crop_alpha_enable,variable= root:packages:pearl_anglescan_panel:crop_alpha_enable
790 SetVariable sv_crop_alpha_value, size={90,16},bodyWidth=60,title=
"angle" 791 SetVariable sv_crop_alpha_value,limits={0,30,1},value= root:packages:pearl_anglescan_panel:crop_alpha_value
792 SetVariable sv_crop_alpha_value, help={
"alpha (detection angle) cropping angle"}
794 Button b_crop_alpha_preview, help={
"show a preview of the cropped dataset."}
796 GroupBox gb_norm_alpha, title=
"normalize alpha" 797 CheckBox cb_norm_alpha_enable, size={50,14}, title=
"enable" 798 CheckBox cb_norm_alpha_enable,variable= root:packages:pearl_anglescan_panel:norm_alpha_enable
799 CheckBox cb_norm_alpha_enable, help={
"enable normalization of the alpha distribution"}
801 PopupMenu pm_norm_alpha_mode, mode=5, popvalue=
"loess", value= #
"\"none;binomial;boxcar;scienta;loess;\"" 802 PopupMenu pm_norm_alpha_mode, help={
"alpha normalization method. recommended: loess"}
803 SetVariable sv_norm_alpha_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 804 SetVariable sv_norm_alpha_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_alpha_smoothing
805 SetVariable sv_norm_alpha_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
807 Button b_norm_alpha_check, help={
"show a graph of the normalization function"}
809 Button b_norm_alpha_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
811 GroupBox gb_norm_phi, title=
"normalize phi" 812 CheckBox cb_norm_phi_enable, size={50,14}, title=
"enable" 813 CheckBox cb_norm_phi_enable,variable= root:packages:pearl_anglescan_panel:norm_phi_enable
814 CheckBox cb_norm_phi_enable, help={
"enable normalization of the phi distribution to reduce the effect of wobble"}
815 SetVariable sv_norm_phi_range, size={118,16}, bodyWidth=60, title=
"theta range" 816 SetVariable sv_norm_phi_range, limits={0,90,1}, value= root:packages:pearl_anglescan_panel:norm_phi_thetarange
817 SetVariable sv_norm_phi_range, help={
"theta range (from normal) to factor into the normalization function"}
819 Button b_norm_phi_check, help={
"show a graph of the normalization function"}
821 Button b_norm_phi_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
823 GroupBox gb_norm_theta, title=
"normalize theta" 824 CheckBox cb_norm_theta_enable, size={50,14},title=
"enable" 825 CheckBox cb_norm_theta_enable, variable= root:packages:pearl_anglescan_panel:norm_theta_enable
826 CheckBox cb_norm_theta_enable, help={
"enable normalization of the theta distribution (integrated over phi)"}
828 PopupMenu pm_norm_theta_mode,mode=5,popvalue=
"loess",value= #
"\"none;binomial;boxcar;polynomial;loess;\"" 829 PopupMenu pm_norm_theta_mode, help={
"theta normalization method. recommended: loess"}
830 SetVariable sv_norm_theta_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 831 SetVariable sv_norm_theta_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_theta_smoothing
832 SetVariable sv_norm_theta_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
834 Button b_norm_theta_check, help={
"show a graph of the normalization function"}
836 Button b_norm_theta_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
838 GroupBox gb_norm_thetaphi, size={272,97},title=
"normalize (theta,phi)" 839 CheckBox cb_norm_thetaphi_enable, size={50,14},title=
"enable" 840 CheckBox cb_norm_thetaphi_enable, variable= root:packages:pearl_anglescan_panel:norm_thetaphi_enable
841 CheckBox cb_norm_thetaphi_enable, help={
"enable normalization of the (theta, phi) distribution."}
843 PopupMenu pm_norm_thetaphi_mode, mode=5, popvalue=
"loess", value= #
"\"none;none;none;none;loess;\"" 844 PopupMenu pm_norm_thetaphi_mode, help={
"theta normalization method. recommended: loess"}
845 SetVariable sv_norm_thetaphi_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 846 SetVariable sv_norm_thetaphi_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_thetaphi_smoothing
847 SetVariable sv_norm_thetaphi_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
849 Button b_norm_thetaphi_check, help={
"show a graph of the normalization function"}
851 Button b_norm_thetaphi_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
853 GroupBox gb_output, title=
"output" 854 SetVariable sv_output_folding, size={95,16}, bodyWidth=60, title=
"folding" 855 SetVariable sv_output_folding, limits={1,20,1}, value= root:packages:pearl_anglescan_panel:output_folding
856 SetVariable sv_output_folding, help={
"n-fold rotational average. 1=no averaging."}
857 SetVariable sv_output_horizon, size={98,16}, bodyWidth=60, title=
"horizon" 858 SetVariable sv_output_horizon, limits={1,90,1}, value= root:packages:pearl_anglescan_panel:output_horizon
859 SetVariable sv_output_horizon, help={
"highest theta to display"}
861 PopupMenu pm_graph_projection, mode=2, popvalue=
"stereographic", value= #
"\"equidistant;stereographic;equal area;gnomonic;orthographic;\"" 862 PopupMenu pm_graph_projection, help={
"projection (theta mapping) mode"}
864 PopupMenu pm_graph_mode, mode=2, popvalue=
"polar plot", value= #
"\"none;polar plot;none;image;\"" 865 PopupMenu pm_graph_mode, help={
"graph mode"}
867 Button b_output_calc, help={
"execute data processing with the enabled filters and display the diffractogram."}
869 Button b_output_duplicate, help={
"copy the result to an arbitrary data folder."}
871 Button b_output_itx, help={
"save the result to an igor text file (itx)."}
873 Button b_output_etpi, help={
"save the result to a pmsco angle scan file (etpi)."}
875 GroupBox gb_graph, title=
"graph" 877 PopupMenu pm_graph_colortable, mode=0, value= #
"\"*COLORTABLEPOPNONAMES*\"" 878 PopupMenu pm_graph_colortable, help={
"color table to use in pseudocolor graphs."}
879 SetVariable sv_graph_contrast, size={119,16}, bodyWidth=60, title=
"contrast (%)" 880 SetVariable sv_graph_contrast, limits={0,25,1}, value= root:packages:pearl_anglescan_panel:graph_contrast
881 SetVariable sv_graph_contrast, help={
"contrast value (percentile)."}
883 Button b_graph_update, help={
"update the existing graph."}
885 Button b_graph_png, help={
"save the graph in png format."}
893 svar /sdfr=df panel_name
895 variable gb_space = 2
896 variable gb_internal_top = 20
897 variable gb_internal_bot = 8
898 variable line_space = 26
916 GroupBox gb_source,pos={4,gb_top}
917 gb_ht = gb_internal_top
918 Button b_source_select,pos={17, gb_top + gb_ht + b_adj},size={50,20}
920 TitleBox tb_source_path,pos={18, gb_top + gb_ht + tb_adj},size={240,21}
922 gb_ht += gb_internal_bot
923 GroupBox gb_source, size={272,gb_ht}
925 gb_top += gb_ht + gb_space
926 GroupBox gb_offsets,pos={4,gb_top}
927 gb_ht = gb_internal_top
928 SetVariable sv_theta_offset,pos={46, gb_top + gb_ht + sv_adj},size={88,16}
930 SetVariable sv_tilt_offset,pos={60, gb_top + gb_ht + sv_adj},size={74,16}
932 SetVariable sv_phi_offset,pos={56, gb_top + gb_ht + sv_adj},size={78,16}
934 SetVariable sv_alpha_offset,pos={44, gb_top + gb_ht + sv_adj},size={90,16}
936 gb_ht += gb_internal_bot
937 GroupBox gb_offsets, size={272,gb_ht}
939 gb_top += gb_ht + gb_space
940 GroupBox gb_crop_alpha,pos={4,gb_top}
941 gb_ht = gb_internal_top
942 CheckBox cb_crop_alpha_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
944 SetVariable sv_crop_alpha_value,pos={44, gb_top + gb_ht + sv_adj},size={90,16}
945 Button b_crop_alpha_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
947 gb_ht += gb_internal_bot
948 GroupBox gb_crop_alpha, size={272,gb_ht}
950 gb_top += gb_ht + gb_space
951 GroupBox gb_norm_alpha,pos={4,gb_top}
952 gb_ht = gb_internal_top
953 CheckBox cb_norm_alpha_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
955 PopupMenu pm_norm_alpha_mode,pos={36, gb_top + gb_ht + pm_adj},size={138,21}
956 Button b_norm_alpha_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
958 SetVariable sv_norm_alpha_smoothing,pos={22, gb_top + gb_ht + sv_adj},size={112,16}
959 Button b_norm_alpha_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
961 gb_ht += gb_internal_bot
962 GroupBox gb_norm_alpha, size={272,gb_ht}
964 gb_top += gb_ht + gb_space
965 GroupBox gb_norm_phi,pos={4,gb_top}
966 gb_ht = gb_internal_top
967 CheckBox cb_norm_phi_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
968 Button b_norm_phi_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
970 SetVariable sv_norm_phi_range,pos={15, gb_top + gb_ht + sv_adj},size={118,16}
971 Button b_norm_phi_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
973 gb_ht += gb_internal_bot
974 GroupBox gb_norm_phi, size={272,gb_ht}
976 gb_top += gb_ht + gb_space
977 GroupBox gb_norm_theta,pos={4,gb_top}
978 gb_ht = gb_internal_top
979 CheckBox cb_norm_theta_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
981 PopupMenu pm_norm_theta_mode,pos={35, gb_top + gb_ht + pm_adj},size={138,21}
982 Button b_norm_theta_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
984 SetVariable sv_norm_theta_smoothing,pos={21, gb_top + gb_ht + sv_adj},size={112,16}
985 Button b_norm_theta_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
987 gb_ht += gb_internal_bot
988 GroupBox gb_norm_theta, size={272,gb_ht}
990 gb_top += gb_ht + gb_space
991 GroupBox gb_norm_thetaphi,pos={4,gb_top}
992 gb_ht = gb_internal_top
993 CheckBox cb_norm_thetaphi_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
995 PopupMenu pm_norm_thetaphi_mode,pos={35, gb_top + gb_ht + pm_adj},size={138,21}
996 Button b_norm_thetaphi_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
998 SetVariable sv_norm_thetaphi_smoothing,pos={21, gb_top + gb_ht + sv_adj},size={112,16}
999 Button b_norm_thetaphi_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1001 gb_ht += gb_internal_bot
1002 GroupBox gb_norm_thetaphi, size={272,gb_ht}
1004 gb_top += gb_ht + gb_space
1005 GroupBox gb_output,pos={4,gb_top}
1006 gb_ht = gb_internal_top
1007 SetVariable sv_output_folding,pos={38, gb_top + gb_ht + sv_adj},size={95,16}
1008 Button b_output_calc,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1010 SetVariable sv_output_horizon,pos={35, gb_top + gb_ht + sv_adj},size={98,16}
1011 Button b_output_duplicate,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1013 PopupMenu pm_graph_projection,pos={24, gb_top + gb_ht + pm_adj},size={149,21}
1014 Button b_output_itx,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1016 PopupMenu pm_graph_mode,pos={44, gb_top + gb_ht + pm_adj},size={129,21}
1017 Button b_output_etpi,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1019 gb_ht += gb_internal_bot
1020 GroupBox gb_output, size={272,gb_ht}
1022 gb_top += gb_ht + gb_space
1023 GroupBox gb_graph,pos={4,gb_top}
1024 gb_ht = gb_internal_top
1025 PopupMenu pm_graph_colortable,pos={21, gb_top + gb_ht + pm_adj},size={152,21}
1026 Button b_graph_update,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1028 SetVariable sv_graph_contrast,pos={14, gb_top + gb_ht + sv_adj},size={119,16}
1029 Button b_graph_png,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1031 gb_ht += gb_internal_bot
1032 GroupBox gb_graph, size={272,gb_ht}
1039 svar /sdfr=df panel_name
1040 if (wintype(panel_name) == 7)
1042 nvar /sdfr=df norm_alpha_mode
1043 m = norm_alpha_mode + 1
1044 PopupMenu pm_norm_alpha_mode win=$panel_name, mode=m
1045 nvar /sdfr=df norm_theta_mode
1046 m = norm_theta_mode + 1
1047 PopupMenu pm_norm_theta_mode win=$panel_name, mode=m
1048 nvar /sdfr=df norm_thetaphi_mode
1049 m = norm_thetaphi_mode + 1
1050 PopupMenu pm_norm_thetaphi_mode win=$panel_name, mode=m
1051 nvar /sdfr=df graph_mode
1053 PopupMenu pm_graph_mode win=$panel_name, mode=m
1054 nvar /sdfr=df graph_projection
1055 m = graph_projection + 1
1056 PopupMenu pm_graph_projection win=$panel_name, mode=m
1057 svar /sdfr=df graph_colortable
1058 m = 1 + WhichListItem(graph_colortable, CTabList())
1059 PopupMenu pm_graph_colortable win=$panel_name, mode=m
1064 STRUCT WMButtonAction &ba
1066 switch( ba.eventCode )
1068 dfref dfBefore = GetDataFolderDFR()
1069 Execute /q/z
"CreateBrowser prompt=\"Select 2D holo scan wave\", showWaves=1, showVars=0, showStrs=0" 1070 dfref dfAfter = GetDataFolderDFR()
1071 SetDataFolder dfBefore
1073 SVAR list = S_BrowserList
1075 if ((flag != 0) && (ItemsInList(list) >= 1))
1076 string wname = StringFromList(0, list)
1090 STRUCT WMButtonAction &ba
1092 switch( ba.eventCode )
1104 STRUCT WMButtonAction &ba
1106 switch( ba.eventCode )
1118 STRUCT WMButtonAction &ba
1120 switch( ba.eventCode )
1132 STRUCT WMButtonAction &ba
1134 switch( ba.eventCode )
1146 STRUCT WMButtonAction &ba
1148 switch( ba.eventCode )
1160 STRUCT WMButtonAction &ba
1162 switch( ba.eventCode )
1174 STRUCT WMButtonAction &ba
1176 switch( ba.eventCode )
1188 STRUCT WMButtonAction &ba
1190 switch( ba.eventCode )
1202 STRUCT WMButtonAction &ba
1204 switch( ba.eventCode )
1216 STRUCT WMButtonAction &ba
1218 switch( ba.eventCode )
1231 STRUCT WMButtonAction &ba
1233 switch( ba.eventCode )
1236 prompt dest_folder,
"destination folder name (relative to data source)" 1237 doprompt
"duplicate", dest_folder
1250 STRUCT WMButtonAction &ba
1252 switch( ba.eventCode )
1255 wave /sdfr=df process_data
1257 ekin = NumberByKey(
"KineticEnergy", note(process_data),
"=",
"\r")
1258 prompt ekin,
"kinetic energy" 1259 doprompt
"save etpi", ekin
1272 STRUCT WMButtonAction &ba
1274 switch( ba.eventCode )
1286 STRUCT WMButtonAction &ba
1288 switch( ba.eventCode )
1300 STRUCT WMButtonAction &ba
1302 switch( ba.eventCode )
1305 svar /sdfr=df source_path
1306 svar /sdfr=df output_graphname
1307 if (WinType(output_graphname) == 1)
1308 SavePICT /WIN=$output_graphname /E=-5 /B=144 /TRAN=0
1319 STRUCT WMPopupAction &pa
1321 switch( pa.eventCode )
1324 nvar /sdfr=df norm_alpha_mode
1325 norm_alpha_mode = pa.popNum - 1
1335 STRUCT WMPopupAction &pa
1337 switch( pa.eventCode )
1340 nvar /sdfr=df norm_theta_mode
1341 norm_theta_mode = pa.popNum - 1
1351 STRUCT WMPopupAction &pa
1353 switch( pa.eventCode )
1356 nvar /sdfr=df norm_thetaphi_mode
1357 norm_thetaphi_mode = pa.popNum - 1
1367 STRUCT WMPopupAction &pa
1369 switch( pa.eventCode )
1372 nvar /sdfr=df graph_mode
1373 graph_mode = pa.popNum - 1
1383 STRUCT WMPopupAction &pa
1385 switch( pa.eventCode )
1388 nvar /sdfr=df graph_projection
1389 graph_projection = pa.popNum - 1
1399 STRUCT WMPopupAction &pa
1401 switch( pa.eventCode )
1404 svar /sdfr=df graph_colortable
1405 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.