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 strconstant
package_path =
"root:packages:pearl_anglescan_panel:" 52 dfref savedf = GetDataFolderDFR()
57 if (nvar_exists(init_done))
68 variable /g init_done = 1
76 dfref savedf = getdatafolderdfr()
78 newdatafolder /o/s packages
79 newdatafolder /o/s $package_name
82 string /g graphname = "graph_anglescan_panel"
84 prefs_objects += "norm_alpha_enable;norm_alpha_mode;norm_alpha_smoothing;norm_phi_enable;norm_phi_mode;norm_phi_thetarange;"
85 prefs_objects += "norm_theta_enable;norm_theta_mode;norm_theta_domain;norm_theta_smoothing;norm_thetaphi_enable;norm_thetaphi_mode;norm_thetaphi_smoothing;"
86 prefs_objects += "output_folding;output_horizon;graph_mode;graph_projection;graph_colortable;graph_contrast;"
89 variable /g theta_offset = 0
90 variable /g tilt_offset = 0
91 variable /g phi_offset = 0
92 variable /g alpha_offset = 0
93 variable /g crop_enable = 0
94 variable /g crop_alpha = 25
95 variable /g crop_theta = 88
96 string /g crop_rows = ""
97 variable /g norm_alpha_enable = 0
98 variable /g norm_alpha_mode = 4
99 variable /g norm_alpha_smoothing = 0.25
100 variable /g norm_theta_enable = 0
101 variable /g norm_theta_mode = 4
102 variable /g norm_theta_domain = 0
103 variable /g norm_theta_smoothing = 0.25
104 variable /g norm_thetaphi_enable = 0
105 variable /g norm_thetaphi_mode = 4
106 variable /g norm_thetaphi_smoothing = 0.25
107 variable /g norm_phi_enable = 0
108 variable /g norm_phi_mode = 4
109 variable /g norm_phi_thetarange = 20
110 string /g output_name = "holo1"
111 variable /g output_folding = 1
112 variable /g output_horizon = 88
113 variable /g graph_mode = 1
115 string /g graph_colortable = "grays"
116 variable /g graph_contrast = 2
119 string /g source_path = ""
120 string /g export_folderpath = "root:"
121 variable /g export_format = 1
124 string /g panel_name = ""
125 string /g preview_graphname = ""
126 string /g dist_x_graphname = ""
127 string /g dist_y_graphname = ""
128 string /g output_graphname = ""
131 make /n=(10,10) /o raw_data, process_data
132 make /o dist_x, dist_x_smoo
133 make /o dist_y, dist_y_smoo
143 dfref saveDF = GetDataFolderDFR()
145 svar /sdfr=df prefs_objects
147 string fullPath = SpecialDirPath("Packages", 0, 0, 0)
149 NewPath/O/C/Q tempPackagePrefsPath, fullPath
150 fullPath += ":preferences.pxp"
152 SetDataFolder root:packages
153 SetDataFolder $package_name
154 SaveData /O /Q /J=prefs_objects fullPath
156 KillPath/Z tempPackagePrefsPath
169 dfref saveDF = GetDataFolderDFR()
173 NewDataFolder /O/S packages
174 NewDataFolder /O/S $package_name
175 string fullPath = SpecialDirPath("Packages", 0, 0, 0)
178 GetFileFolderInfo /Q /Z fullPath
180 fullPath += ":preferences.pxp"
181 GetFileFolderInfo /Q /Z fullPath
183 LoadData /O /R /Q fullPath
207 dfref saveDF = GetDataFolderDFR()
208 dfref datadf = GetWavesDataFolderDFR(raw_data)
209 dfref attrdf = datadf:attr
210 if (!DataFolderRefStatus(attrdf))
213 dfref parentdf = GetDataFolderDFR()
214 dfref attrdf = parentdf:attr
221 source_path = GetWavesDataFolder(raw_data, 2)
223 duplicate /o raw_data, raw, process_data
225 wave /sdfr=attrdf /z ManipulatorTheta
226 wave /sdfr=attrdf /z ManipulatorTilt
227 wave /sdfr=attrdf /z ManipulatorPhi
228 if (WaveExists(ManipulatorTheta) && WaveExists(ManipulatorTilt) && WaveExists(ManipulatorPhi))
229 duplicate /o attrdf:ManipulatorTheta, raw_theta, process_theta
230 duplicate /o attrdf:ManipulatorTilt, raw_tilt, process_tilt
231 duplicate /o attrdf:ManipulatorPhi, raw_phi, process_phi
233 DoAlert 0, "Can't find manipulator angle waves.\rCheck that the attr folder exists, or provide values in the following table."
234 make /n=(dimsize(raw_data, 1)) /o raw_theta, raw_tilt, raw_phi
235 make /n=(dimsize(raw_data, 1)) /o process_theta, process_tilt, process_phi
236 edit /k=1 raw_theta, raw_tilt, raw_phi
239 make /o /n=(dimsize(raw_data, 0)) dist_x, dist_x_smoo
240 make /o /n=(dimsize(raw_data, 1)) dist_y, dist_y_smoo
251 wave /sdfr=df process_data
252 svar /sdfr=df preview_graphname
254 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
256 DoWindow /F $preview_graphname
261 nvar /sdfr=df graph_contrast
262 svar /sdfr=df graph_colortable
263 set_contrast(graph_contrast, graph_contrast, graphname=preview_graphname, colortable=graph_colortable)
274 variable xdist, ydist
279 wave /sdfr=df dist_x_smoo
280 wave /sdfr=df dist_y_smoo
281 svar /sdfr=df dist_x_graphname
282 svar /sdfr=df dist_y_graphname
285 if (strlen(dist_x_graphname) && (wintype(dist_x_graphname) == 1))
286 DoWindow /F $dist_x_graphname
288 display /k=1 /n=graph_asp_dist_x dist_x, dist_x_smoo
289 dist_x_graphname = s_name
290 ModifyGraph /w=$dist_x_graphname mode(dist_x)=2
291 ModifyGraph /w=$dist_x_graphname lsize(dist_x)=2
292 ModifyGraph /w=$dist_x_graphname rgb(dist_x)=(0,0,0)
297 if (strlen(dist_y_graphname) && (wintype(dist_y_graphname) == 1))
298 DoWindow /F $dist_y_graphname
300 display /k=1 /n=graph_asp_dist_y dist_y, dist_y_smoo
301 dist_y_graphname = s_name
302 ModifyGraph /w=$dist_y_graphname mode(dist_y)=2
303 ModifyGraph /w=$dist_y_graphname lsize(dist_y)=2
304 ModifyGraph /w=$dist_y_graphname rgb(dist_y)=(0,0,0)
323 wave /sdfr=df raw_theta
324 wave /sdfr=df raw_tilt
325 wave /sdfr=df raw_phi
326 nvar /sdfr=df theta_offset
327 nvar /sdfr=df tilt_offset
328 nvar /sdfr=df phi_offset
329 nvar /sdfr=df alpha_offset
331 duplicate /o raw, df:process_data
332 duplicate /o raw_theta, df:process_theta
333 duplicate /o raw_tilt, df:process_tilt
334 duplicate /o raw_phi, df:process_phi
336 wave /sdfr=df process_data
337 wave /sdfr=df process_theta
338 wave /sdfr=df process_tilt
339 wave /sdfr=df process_phi
341 process_theta = raw_theta - theta_offset
342 process_tilt = raw_tilt - tilt_offset
343 process_phi = raw_phi - phi_offset
344 setscale /p x dimoffset(raw, 0) - alpha_offset, dimdelta(raw, 0), waveunits(raw, 0), process_data
362 if (ParamIsDefault(force))
367 wave /sdfr=df process_data
368 wave /sdfr=df process_theta
369 wave /sdfr=df process_tilt
370 wave /sdfr=df process_phi
371 nvar /sdfr=df crop_enable
372 nvar /sdfr=df crop_alpha
373 nvar /sdfr=df crop_theta
374 svar /sdfr=df crop_rows
376 if (force || crop_enable)
378 if (crop_alpha > abs(dimdelta(process_data, 0)))
379 crop_strip(process_data, -crop_alpha, +crop_alpha)
382 if ((crop_theta >= 10) && (crop_theta < 90))
383 crop_strip_theta(process_data, 0, crop_theta, process_theta, process_tilt, process_phi)
386 if (strlen(crop_rows) > 0)
387 delete_rows(crop_rows, process_data, process_theta, process_tilt, process_phi)
413 make /n=(numpnts(theta)) /i /free idx
415 variable nrows = ItemsInList(rows, ",")
419 for (irow = 0; irow < nrows; irow += 1)
420 srow = StringFromList(irow, rows, ",")
421 q1 = str2num(StringFromList(0, srow, "-"))
422 q2 = str2num(StringFromList(1, srow, "-"))
430 extract /free idx, idx, idx >= 0
431 variable nx = dimsize(data, 0)
432 variable ny = numpnts(idx)
436 redimension /n=(ny) theta, tilt, phi
437 duplicate /free data, data_copy
438 redimension /n=(nx,ny) data
439 data = data_copy[p][idx[q]]
457 if (ParamIsDefault(force))
461 dfref saveDF = GetDataFolderDFR()
463 wave /sdfr=df process_data
464 nvar /sdfr=df norm_alpha_enable
465 nvar /sdfr=df norm_alpha_mode
466 nvar /sdfr=df norm_alpha_smoothing
468 if (force || norm_alpha_enable)
469 dfref temp_df = newfreedatafolder()
470 setdatafolder temp_df
471 normalize_strip_x(process_data, smooth_method=norm_alpha_mode, smooth_factor=norm_alpha_smoothing, check=check)
475 duplicate /o check_dist, df:dist_x
476 duplicate /o check_smoo, df:dist_x_smoo
498 if (ParamIsDefault(force))
502 dfref saveDF = GetDataFolderDFR()
504 wave /sdfr=df process_data
505 wave /sdfr=df process_theta
506 wave /sdfr=df process_phi
507 nvar /sdfr=df norm_phi_enable
508 nvar /sdfr=df norm_phi_mode
509 nvar /sdfr=df norm_phi_thetarange
511 if (force || norm_phi_enable)
512 dfref temp_df = newfreedatafolder()
513 setdatafolder temp_df
514 normalize_strip_phi(process_data, process_theta, process_phi, theta_range=norm_phi_thetarange, check=check)
518 duplicate /o check_dist, df:dist_y
519 duplicate /o check_smoo, df:dist_y_smoo
541 if (ParamIsDefault(force))
545 dfref saveDF = GetDataFolderDFR()
547 wave /sdfr=df process_data
548 wave /sdfr=df process_theta
549 nvar /sdfr=df norm_theta_enable
550 nvar /sdfr=df norm_theta_mode
551 nvar /sdfr=df norm_theta_domain
552 nvar /sdfr=df norm_theta_smoothing
554 if (force || norm_theta_enable)
555 dfref temp_df = newfreedatafolder()
556 setdatafolder temp_df
557 if (norm_theta_domain==1)
558 normalize_strip_theta_scans(process_data, process_theta, smooth_method=norm_theta_mode, smooth_factor=norm_theta_smoothing, check=check)
560 normalize_strip_theta(process_data, process_theta, smooth_method=norm_theta_mode, smooth_factor=norm_theta_smoothing, check=check)
565 duplicate /o check_dist, df:dist_y
566 duplicate /o check_smoo, df:dist_y_smoo
588 if (ParamIsDefault(force))
592 dfref saveDF = GetDataFolderDFR()
594 wave /sdfr=df process_data
595 wave /sdfr=df process_theta
596 wave /sdfr=df process_phi
597 nvar /sdfr=df norm_thetaphi_enable
598 nvar /sdfr=df norm_thetaphi_mode
599 nvar /sdfr=df norm_thetaphi_smoothing
601 if (force || norm_thetaphi_enable)
602 dfref temp_df = newfreedatafolder()
603 setdatafolder temp_df
604 normalize_strip_thetaphi(process_data, process_theta, process_phi, smooth_method=norm_thetaphi_mode, smooth_factor=norm_thetaphi_smoothing, check=check)
608 duplicate /o check_dist, df:dist_y
609 duplicate /o check_smoo, df:dist_y_smoo
621 dfref saveDF = GetDataFolderDFR()
631 nvar folding=output_folding
632 nvar horizon=output_horizon
641 pizza_service_2(process_data, output_name, process_theta, process_tilt, process_phi, folding=folding, nograph=1)
643 setdatafolder $output_name
647 values = pol <= horizon ? values : nan
671 svar /sdfr=pkg_df output_name
672 svar /sdfr=pkg_df output_graphname
673 nvar /sdfr=pkg_df graph_projection
674 nvar /sdfr=pkg_df graph_mode
675 svar /sdfr=pkg_df graph_colortable
676 nvar /sdfr=pkg_df graph_contrast
678 if (ParamIsDefault(data_df))
679 dfref data_df = pkg_df
681 if (ParamIsDefault(data_name))
682 data_name = output_name
685 dfref saveDF = GetDataFolderDFR()
686 setdatafolder data_df
692 string graphname = data_name
693 graphname =
display_hemi_scan(data_name, projection=graph_projection, graphtype=graph_mode, graphname=graphname)
694 if (ParamIsDefault(data_df))
695 output_graphname = graphname
699 if (strlen(graphname) && (wintype(graphname) == 1))
700 set_contrast(graph_contrast, graph_contrast, graphname=graphname, colortable=graph_colortable)
713 svar /sdfr=df preview_graphname
714 svar /sdfr=df output_graphname
715 svar /sdfr=df graph_colortable
716 nvar /sdfr=df graph_contrast
718 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
719 set_contrast(graph_contrast, graph_contrast, graphname=preview_graphname, colortable=graph_colortable)
721 if (strlen(output_graphname) && (wintype(output_graphname) == 1))
722 set_contrast(graph_contrast, graph_contrast, graphname=output_graphname, colortable=graph_colortable)
731 svar /sdfr=df preview_graphname
732 svar /sdfr=df output_graphname
733 svar /sdfr=df dist_x_graphname
734 svar /sdfr=df dist_y_graphname
736 if (strlen(preview_graphname) && (wintype(preview_graphname) == 1))
737 killwindow $preview_graphname
739 if (strlen(output_graphname) && (wintype(output_graphname) == 1))
740 killwindow $output_graphname
742 if (strlen(dist_x_graphname) && (wintype(dist_x_graphname) == 1))
743 killwindow $dist_x_graphname
745 if (strlen(dist_y_graphname) && (wintype(dist_y_graphname) == 1))
746 killwindow $dist_y_graphname
749 preview_graphname = ""
750 output_graphname = ""
751 dist_x_graphname = ""
752 dist_y_graphname = ""
772 if (ParamIsDefault(do_graph))
777 svar /sdfr=df source_path
778 svar /sdfr=df output_name
779 svar /sdfr=df output_graphname
780 wave raw_data = $source_path
782 dfref saveDF = GetDataFolderDFR()
783 dfref raw_df = GetWavesDataFolderDFR(raw_data)
785 newdatafolder /o /s $dest_name
786 dfref dest_df = GetDataFolderDFR()
790 string graphname = ""
803 svar /sdfr=df output_name
805 dfref saveDF = GetDataFolderDFR()
820 svar /sdfr=df output_name
821 wave /sdfr=df process_data
823 dfref saveDF = GetDataFolderDFR()
826 string s_int = "values"
828 string s_polar = s_prefix + "pol"
829 string s_azim = s_prefix + "az"
831 pmsco_save_scan("", "", num2str(ekin), s_polar, s_azim, "", s_int, "", sdfr=data_df)
847 asp_display_dist_check(0, 1)
854 asp_display_dist_check(0, 1)
861 asp_display_dist_check(0, 1)
873 do_norm_alpha(1, force=1)
880 do_norm_phi(1, force=1)
887 do_norm_theta(1, force=1)
894 do_norm_thetaphi(1, force=1)
902 svar /sdfr=df panel_name
904 if (strlen(panel_name) && (wintype(panel_name) == 7))
905 DoWindow /F $panel_name
909 NewPanel /K=1 /N=anglescan_panel /W=(200,50,480,874) as "angle scan processing"
912 GroupBox gb_source, title="data source"
914 Button b_source_select, help={
"select the source wave, e.g. ReducedData1. it must be in the scan or region data folder. the attr folder with the manipulator waves must be in the same folder or one level up."}
916 Button b_source_update, help={
"reload the process data from the previous source (link displayed below)"}
917 TitleBox tb_source_path, size={240,21}
918 TitleBox tb_source_path,variable= root:packages:pearl_anglescan_panel:source_path
920 GroupBox gb_offsets, title=
"offsets" 921 SetVariable sv_theta_offset, size={88,16},bodyWidth=60,title=
"theta" 922 SetVariable sv_theta_offset,value= root:packages:pearl_anglescan_panel:theta_offset
923 SetVariable sv_theta_offset, help={
"manipulator theta value that corresponds to normal emission."}
924 SetVariable sv_tilt_offset, size={74,16},bodyWidth=60,title=
"tilt" 925 SetVariable sv_tilt_offset,value= root:packages:pearl_anglescan_panel:tilt_offset
926 SetVariable sv_tilt_offset, help={
"manipulator tilt value that corresponds to normal emission."}
927 SetVariable sv_phi_offset, size={78,16},bodyWidth=60,title=
"phi" 928 SetVariable sv_phi_offset,value= root:packages:pearl_anglescan_panel:phi_offset
929 SetVariable sv_phi_offset, help={
"manipulator phi value that should map to the 3 o'clock angle."}
930 SetVariable sv_alpha_offset, size={90,16},bodyWidth=60,title=
"alpha" 931 SetVariable sv_alpha_offset,value= root:packages:pearl_anglescan_panel:alpha_offset
932 SetVariable sv_alpha_offset, help={
"alpha value that corresponds to normal emission (if the sample normal is properly aligned)."}
934 Button b_save_prefs, help={
"save settings as preferences."}
936 Button b_load_prefs, help={
"load settings from preferences."}
938 GroupBox gb_crop, title=
"crop and delete" 939 CheckBox cb_crop_enable, size={50,14}, title=
"enable" 940 CheckBox cb_crop_enable, help={
"crop at +/-alpha and +theta, delete arbitrary rows"}
941 CheckBox cb_crop_enable, variable= root:packages:pearl_anglescan_panel:crop_enable
942 SetVariable sv_crop_alpha, size={90,16},bodyWidth=60,title=
"alpha" 943 SetVariable sv_crop_alpha, limits={0,30,1},value= root:packages:pearl_anglescan_panel:crop_alpha
944 SetVariable sv_crop_alpha, help={
"alpha (detection angle) cropping angle (positive boundary), relative to normal emission"}
945 SetVariable sv_crop_theta, size={90,16},bodyWidth=60,title=
"theta" 946 SetVariable sv_crop_theta, limits={10,90,1},value= root:packages:pearl_anglescan_panel:crop_theta
947 SetVariable sv_crop_theta, help={
"theta (polar angle) upper limit, relative to normal emission"}
948 SetVariable sv_crop_rows, size={200,16},bodyWidth=160,title=
"rows" 949 SetVariable sv_crop_rows, limits={10,90,1},value= root:packages:pearl_anglescan_panel:crop_rows
950 SetVariable sv_crop_rows, help={
"rows to delete from the raw data. comma-separated point indices, hyphen for range."}
952 Button b_crop_preview, help={
"show a preview of the cropped dataset."}
954 GroupBox gb_norm_alpha, title=
"normalize alpha" 955 CheckBox cb_norm_alpha_enable, size={50,14}, title=
"enable" 956 CheckBox cb_norm_alpha_enable,variable= root:packages:pearl_anglescan_panel:norm_alpha_enable
957 CheckBox cb_norm_alpha_enable, help={
"enable normalization of the alpha distribution"}
959 PopupMenu pm_norm_alpha_mode, mode=5, popvalue=
"loess", value= #
"\"none;binomial;boxcar;scienta;loess;\"" 960 PopupMenu pm_norm_alpha_mode, help={
"alpha normalization method. recommended: loess"}
961 SetVariable sv_norm_alpha_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 962 SetVariable sv_norm_alpha_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_alpha_smoothing
963 SetVariable sv_norm_alpha_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
965 Button b_norm_alpha_check, help={
"show a graph of the normalization function"}
967 Button b_norm_alpha_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
969 GroupBox gb_norm_phi, title=
"normalize phi" 970 CheckBox cb_norm_phi_enable, size={50,14}, title=
"enable" 971 CheckBox cb_norm_phi_enable,variable= root:packages:pearl_anglescan_panel:norm_phi_enable
972 CheckBox cb_norm_phi_enable, help={
"enable normalization of the phi distribution to reduce the effect of wobble"}
973 SetVariable sv_norm_phi_range, size={118,16}, bodyWidth=60, title=
"theta range" 974 SetVariable sv_norm_phi_range, limits={0,90,1}, value= root:packages:pearl_anglescan_panel:norm_phi_thetarange
975 SetVariable sv_norm_phi_range, help={
"theta range (from normal) to factor into the normalization function"}
977 Button b_norm_phi_check, help={
"show a graph of the normalization function"}
979 Button b_norm_phi_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
981 GroupBox gb_norm_theta, title=
"normalize theta" 982 CheckBox cb_norm_theta_enable, size={50,14},title=
"enable" 983 CheckBox cb_norm_theta_enable, variable= root:packages:pearl_anglescan_panel:norm_theta_enable
984 CheckBox cb_norm_theta_enable, help={
"enable normalization of the theta distribution (integrated over phi)"}
986 PopupMenu pm_norm_theta_domain, mode=5, popvalue=
"loess", value= #
"\"global;scans;\"" 987 PopupMenu pm_norm_theta_domain, help={
"smoothing domain: global or individual scans. use global unless there is a stronga or irregular phi variation."}
989 PopupMenu pm_norm_theta_mode,mode=5,popvalue=
"loess",value= #
"\"none;binomial;boxcar;polynomial;loess;\"" 990 PopupMenu pm_norm_theta_mode, help={
"theta normalization method. recommended: loess"}
991 SetVariable sv_norm_theta_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 992 SetVariable sv_norm_theta_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_theta_smoothing
993 SetVariable sv_norm_theta_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
995 Button b_norm_theta_check, help={
"show a graph of the normalization function"}
997 Button b_norm_theta_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
999 GroupBox gb_norm_thetaphi, size={272,97},title=
"normalize (theta,phi)" 1000 CheckBox cb_norm_thetaphi_enable, size={50,14},title=
"enable" 1001 CheckBox cb_norm_thetaphi_enable, variable= root:packages:pearl_anglescan_panel:norm_thetaphi_enable
1002 CheckBox cb_norm_thetaphi_enable, help={
"enable normalization of the (theta, phi) distribution."}
1004 PopupMenu pm_norm_thetaphi_mode, mode=5, popvalue=
"loess", value= #
"\"none;none;none;none;loess;\"" 1005 PopupMenu pm_norm_thetaphi_mode, help={
"theta normalization method. recommended: loess"}
1006 SetVariable sv_norm_thetaphi_smoothing, size={112,16}, bodyWidth=60, title=
"smoothing" 1007 SetVariable sv_norm_thetaphi_smoothing, limits={0,1,0.05}, value= root:packages:pearl_anglescan_panel:norm_thetaphi_smoothing
1008 SetVariable sv_norm_thetaphi_smoothing, help={
"smoothing parameter (depends on the normalization method)."}
1010 Button b_norm_thetaphi_check, help={
"show a graph of the normalization function"}
1012 Button b_norm_thetaphi_preview, help={
"show a preview of the normalized dataset (without other normalizations)."}
1014 GroupBox gb_output, title=
"output" 1015 SetVariable sv_output_folding, size={95,16}, bodyWidth=60, title=
"folding" 1016 SetVariable sv_output_folding, limits={1,20,1}, value= root:packages:pearl_anglescan_panel:output_folding
1017 SetVariable sv_output_folding, help={
"n-fold rotational average. 1=no averaging."}
1018 SetVariable sv_output_horizon, size={98,16}, bodyWidth=60, title=
"horizon" 1019 SetVariable sv_output_horizon, limits={1,90,1}, value= root:packages:pearl_anglescan_panel:output_horizon
1020 SetVariable sv_output_horizon, help={
"highest theta to display"}
1022 PopupMenu pm_graph_projection, mode=2, popvalue=
"stereographic", value= #
"\"equidistant;stereographic;equal area;gnomonic;orthographic;\"" 1023 PopupMenu pm_graph_projection, help={
"projection (theta mapping) mode"}
1025 PopupMenu pm_graph_mode, mode=2, popvalue=
"dots", value= #
"\"none;dots;none;image;\"" 1026 PopupMenu pm_graph_mode, help={
"graph type: dots = coloured dots on circles; image = interpolated matrix"}
1028 Button b_output_calc, help={
"execute data processing with the enabled filters and display the diffractogram."}
1030 Button b_output_duplicate, help={
"copy the result to an arbitrary data folder."}
1032 Button b_output_itx, help={
"save the result to an igor text file (itx)."}
1034 Button b_output_etpi, help={
"save the result to a pmsco angle scan file (etpi)."}
1036 GroupBox gb_graph, title=
"graph" 1038 PopupMenu pm_graph_colortable, mode=0, value= #
"\"*COLORTABLEPOPNONAMES*\"" 1039 PopupMenu pm_graph_colortable, help={
"color table to use in pseudocolor graphs."}
1040 SetVariable sv_graph_contrast, size={119,16}, bodyWidth=60, title=
"contrast (%)" 1041 SetVariable sv_graph_contrast, limits={0,25,1}, value= root:packages:pearl_anglescan_panel:graph_contrast
1042 SetVariable sv_graph_contrast, help={
"contrast value (percentile)."}
1044 Button b_graph_update, help={
"update the existing graph."}
1046 Button b_graph_png, help={
"save the graph in png format."}
1054 svar /sdfr=df panel_name
1056 variable gb_space = 2
1057 variable gb_internal_top = 16
1058 variable gb_internal_bot = 4
1059 variable line_space = 22
1077 GroupBox gb_source,pos={4,gb_top}
1078 gb_ht = gb_internal_top
1079 Button b_source_select,pos={17, gb_top + gb_ht + b_adj},size={50,20}
1080 Button b_source_update, pos={67, gb_top + gb_ht + b_adj},size={50,20}
1082 TitleBox tb_source_path,pos={18, gb_top + gb_ht + tb_adj},size={240,21}
1084 gb_ht += gb_internal_bot
1085 GroupBox gb_source, size={272,gb_ht}
1087 gb_top += gb_ht + gb_space
1088 GroupBox gb_offsets,pos={4,gb_top}
1089 gb_ht = gb_internal_top
1090 SetVariable sv_theta_offset,pos={46, gb_top + gb_ht + sv_adj},size={88,16}
1091 Button b_save_prefs,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1093 SetVariable sv_tilt_offset,pos={60, gb_top + gb_ht + sv_adj},size={74,16}
1094 Button b_load_prefs,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1096 SetVariable sv_phi_offset,pos={56, gb_top + gb_ht + sv_adj},size={78,16}
1098 SetVariable sv_alpha_offset,pos={44, gb_top + gb_ht + sv_adj},size={90,16}
1100 gb_ht += gb_internal_bot
1101 GroupBox gb_offsets, size={272,gb_ht}
1103 gb_top += gb_ht + gb_space
1104 GroupBox gb_crop,pos={4,gb_top}
1105 gb_ht = gb_internal_top
1106 CheckBox cb_crop_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
1108 SetVariable sv_crop_alpha, pos={44, gb_top + gb_ht + sv_adj}, size={90,16}
1109 Button b_crop_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1111 SetVariable sv_crop_theta, pos={44, gb_top + gb_ht + sv_adj}, size={90,16}
1113 SetVariable sv_crop_rows, pos={44, gb_top + gb_ht + sv_adj}, size={190,16}
1115 gb_ht += gb_internal_bot
1116 GroupBox gb_crop, size={272,gb_ht}
1118 gb_top += gb_ht + gb_space
1119 GroupBox gb_norm_alpha,pos={4,gb_top}
1120 gb_ht = gb_internal_top
1121 CheckBox cb_norm_alpha_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
1123 PopupMenu pm_norm_alpha_mode,pos={36, gb_top + gb_ht + pm_adj},size={138,21}
1124 Button b_norm_alpha_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1126 SetVariable sv_norm_alpha_smoothing,pos={22, gb_top + gb_ht + sv_adj},size={112,16}
1127 Button b_norm_alpha_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1129 gb_ht += gb_internal_bot
1130 GroupBox gb_norm_alpha, size={272,gb_ht}
1132 gb_top += gb_ht + gb_space
1133 GroupBox gb_norm_phi,pos={4,gb_top}
1134 gb_ht = gb_internal_top
1135 CheckBox cb_norm_phi_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
1136 Button b_norm_phi_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1138 SetVariable sv_norm_phi_range,pos={15, gb_top + gb_ht + sv_adj},size={118,16}
1139 Button b_norm_phi_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1141 gb_ht += gb_internal_bot
1142 GroupBox gb_norm_phi, size={272,gb_ht}
1144 gb_top += gb_ht + gb_space
1145 GroupBox gb_norm_theta,pos={4,gb_top}
1146 gb_ht = gb_internal_top
1147 CheckBox cb_norm_theta_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
1149 PopupMenu pm_norm_theta_domain, pos={35, gb_top + gb_ht + pm_adj}, size={138,21}
1150 Button b_norm_theta_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1152 PopupMenu pm_norm_theta_mode,pos={35, gb_top + gb_ht + pm_adj},size={138,21}
1153 Button b_norm_theta_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1155 SetVariable sv_norm_theta_smoothing,pos={21, gb_top + gb_ht + sv_adj},size={112,16}
1157 gb_ht += gb_internal_bot
1158 GroupBox gb_norm_theta, size={272,gb_ht}
1160 gb_top += gb_ht + gb_space
1161 GroupBox gb_norm_thetaphi,pos={4,gb_top}
1162 gb_ht = gb_internal_top
1163 CheckBox cb_norm_thetaphi_enable,pos={73, gb_top + gb_ht + cb_adj},size={50,14}
1165 PopupMenu pm_norm_thetaphi_mode,pos={35, gb_top + gb_ht + pm_adj},size={138,21}
1166 Button b_norm_thetaphi_check,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1168 SetVariable sv_norm_thetaphi_smoothing,pos={21, gb_top + gb_ht + sv_adj},size={112,16}
1169 Button b_norm_thetaphi_preview,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1171 gb_ht += gb_internal_bot
1172 GroupBox gb_norm_thetaphi, size={272,gb_ht}
1174 gb_top += gb_ht + gb_space
1175 GroupBox gb_output,pos={4,gb_top}
1176 gb_ht = gb_internal_top
1177 SetVariable sv_output_folding,pos={38, gb_top + gb_ht + sv_adj},size={95,16}
1178 Button b_output_calc,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1180 SetVariable sv_output_horizon,pos={35, gb_top + gb_ht + sv_adj},size={98,16}
1181 Button b_output_duplicate,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1183 PopupMenu pm_graph_projection,pos={24, gb_top + gb_ht + pm_adj},size={149,21}
1184 Button b_output_itx,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1186 PopupMenu pm_graph_mode,pos={44, gb_top + gb_ht + pm_adj},size={129,21}
1187 Button b_output_etpi,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1189 gb_ht += gb_internal_bot
1190 GroupBox gb_output, size={272,gb_ht}
1192 gb_top += gb_ht + gb_space
1193 GroupBox gb_graph,pos={4,gb_top}
1194 gb_ht = gb_internal_top
1195 PopupMenu pm_graph_colortable,pos={21, gb_top + gb_ht + pm_adj},size={152,21}
1196 Button b_graph_update,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1198 SetVariable sv_graph_contrast,pos={14, gb_top + gb_ht + sv_adj},size={119,16}
1199 Button b_graph_png,pos={186, gb_top + gb_ht + b_adj},size={80,20}
1201 gb_ht += gb_internal_bot
1202 GroupBox gb_graph, size={272,gb_ht}
1204 gb_top += gb_ht + gb_space
1212 svar /sdfr=df panel_name
1213 if (wintype(panel_name) == 7)
1215 nvar /sdfr=df norm_alpha_mode
1216 m = norm_alpha_mode + 1
1217 PopupMenu pm_norm_alpha_mode win=$panel_name, mode=m
1218 nvar /sdfr=df norm_theta_domain
1219 m = norm_theta_domain + 1
1220 PopupMenu pm_norm_theta_domain win=$panel_name, mode=m
1221 nvar /sdfr=df norm_theta_mode
1222 m = norm_theta_mode + 1
1223 PopupMenu pm_norm_theta_mode win=$panel_name, mode=m
1224 nvar /sdfr=df norm_thetaphi_mode
1225 m = norm_thetaphi_mode + 1
1226 PopupMenu pm_norm_thetaphi_mode win=$panel_name, mode=m
1227 nvar /sdfr=df graph_mode
1229 PopupMenu pm_graph_mode win=$panel_name, mode=m
1230 nvar /sdfr=df graph_projection
1231 m = graph_projection + 1
1232 PopupMenu pm_graph_projection win=$panel_name, mode=m
1233 svar /sdfr=df graph_colortable
1234 m = 1 + WhichListItem(graph_colortable, CTabList())
1235 PopupMenu pm_graph_colortable win=$panel_name, mode=m
1240 STRUCT WMButtonAction &ba
1242 switch( ba.eventCode )
1254 STRUCT WMButtonAction &ba
1256 switch( ba.eventCode )
1268 STRUCT WMButtonAction &ba
1270 switch( ba.eventCode )
1272 dfref dfBefore = GetDataFolderDFR()
1273 Execute /q/z "CreateBrowser prompt=\"Select 2D holo scan wave\", showWaves=1, showVars=0, showStrs=0"
1274 dfref dfAfter = GetDataFolderDFR()
1275 SetDataFolder dfBefore
1277 SVAR list = S_BrowserList
1279 if ((flag != 0) && (ItemsInList(list) >= 1))
1280 string wname = StringFromList(0, list)
1294 STRUCT WMButtonAction &ba
1296 switch( ba.eventCode )
1298 dfref packdf = $package_path
1299 svar /sdfr=packdf source_path
1300 wave /z w = $source_path
1304 DoAlert 0, "can't find source data."
1315 STRUCT WMButtonAction &ba
1317 switch( ba.eventCode )
1329 STRUCT WMButtonAction &ba
1331 switch( ba.eventCode )
1343 STRUCT WMButtonAction &ba
1345 switch( ba.eventCode )
1357 STRUCT WMButtonAction &ba
1359 switch( ba.eventCode )
1371 STRUCT WMButtonAction &ba
1373 switch( ba.eventCode )
1385 STRUCT WMButtonAction &ba
1387 switch( ba.eventCode )
1399 STRUCT WMButtonAction &ba
1401 switch( ba.eventCode )
1413 STRUCT WMButtonAction &ba
1415 switch( ba.eventCode )
1427 STRUCT WMButtonAction &ba
1429 switch( ba.eventCode )
1441 STRUCT WMButtonAction &ba
1443 switch( ba.eventCode )
1456 STRUCT WMButtonAction &ba
1458 switch( ba.eventCode )
1461 variable do_graph = 1
1462 prompt dest_folder, "destination folder name (relative to data source)"
1463 prompt do_graph, "duplicate graph (yes = 1, no = 0)"
1464 doprompt "duplicate", dest_folder, do_graph
1477 STRUCT WMButtonAction &ba
1479 switch( ba.eventCode )
1482 wave /sdfr=df process_data
1484 ekin = NumberByKey("KineticEnergy", note(process_data), "=", "\r")
1485 prompt ekin, "kinetic energy"
1486 doprompt "save etpi", ekin
1499 STRUCT WMButtonAction &ba
1501 switch( ba.eventCode )
1513 STRUCT WMButtonAction &ba
1515 switch( ba.eventCode )
1527 STRUCT WMButtonAction &ba
1529 switch( ba.eventCode )
1532 svar /sdfr=df source_path
1533 svar /sdfr=df output_graphname
1534 if (WinType(output_graphname) == 1)
1535 SavePICT /WIN=$output_graphname /E=-5 /B=144 /TRAN=0
1546 STRUCT WMPopupAction &pa
1548 switch( pa.eventCode )
1551 nvar /sdfr=df norm_alpha_mode
1552 norm_alpha_mode = pa.popNum - 1
1562 STRUCT WMPopupAction &pa
1564 switch( pa.eventCode )
1567 nvar /sdfr=df norm_theta_domain
1568 norm_theta_domain = pa.popNum - 1
1578 STRUCT WMPopupAction &pa
1580 switch( pa.eventCode )
1583 nvar /sdfr=df norm_theta_mode
1584 norm_theta_mode = pa.popNum - 1
1594 STRUCT WMPopupAction &pa
1596 switch( pa.eventCode )
1599 nvar /sdfr=df norm_thetaphi_mode
1600 norm_thetaphi_mode = pa.popNum - 1
1610 STRUCT WMPopupAction &pa
1612 switch( pa.eventCode )
1615 nvar /sdfr=df graph_mode
1616 graph_mode = pa.popNum - 1
1626 STRUCT WMPopupAction &pa
1628 switch( pa.eventCode )
1631 nvar /sdfr=df graph_projection
1632 graph_projection = pa.popNum - 1
1642 STRUCT WMPopupAction &pa
1644 switch( pa.eventCode )
1647 svar /sdfr=df graph_colortable
1648 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.
static variable bp_save_prefs(WMButtonAction *ba)
static variable preview_crop()
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 const string prefs_objects
semicolon-separated list of persistent variable, string, and wave names
static variable pmp_norm_alpha_mode(WMPopupAction *pa)
static variable init_package()
static variable preview_norm_theta()
static variable delete_rows(string rows, wave data, wave theta, wave tilt, wave phi)
delete individual rows from the data strip
static variable pmp_norm_theta_domain(WMPopupAction *pa)
static variable bp_source_update(WMButtonAction *ba)
static variable bp_norm_thetaphi_check(WMButtonAction *ba)
static variable bp_norm_theta_preview(WMButtonAction *ba)
static const string package_path
data folder path
static variable bp_crop_preview(WMButtonAction *ba)
variable crop_strip_theta(wave strip, variable theta_lo, variable theta_hi, wave theta, wave tilt, wave phi)
crop a strip in theta.
static variable do_norm_thetaphi(variable check, variable force=defaultValue)
theta,phi-normalize the process data.
static variable bp_load_prefs(WMButtonAction *ba)
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()
string pmsco_save_scan(string pathname, string filename, string energy, string theta, string phi, string alpha, string intensity, string sigma, dfref sdfr=defaultValue)
save waves in a PMSCO scan data file.
static variable pmp_norm_theta_mode(WMPopupAction *pa)
variable interpolate_hemi_scan(string nickname, variable projection=defaultValue)
interpolate a hemispherical scan onto a rectangular grid
variable normalize_strip_theta_scans(wave strip, wave theta, variable theta_offset=defaultValue, variable smooth_method=defaultValue, variable smooth_factor=defaultValue, variable check=defaultValue)
divide the strip piecewise by a smooth polar distribution.
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()
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
string asp_duplicate_output(string dest_name, variable do_graph=defaultValue)
copy the output data to a new folder
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 duplicate_hemi_scan(string source_nickname, dfref dest_folder, string dest_nickname, variable xpdplot=defaultValue)
duplicate a hemispherical scan dataset.
static variable do_crop(variable check, variable force=defaultValue)
crop the process data.
static variable pmp_norm_thetaphi_mode(WMPopupAction *pa)
static variable preview_norm_thetaphi()
string asp_display_output(dfref data_df=defaultValue, string data_name=defaultValue)
display the output diffractogram
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.