1 | #pragma TextEncoding = "MacRoman" |
---|
2 | #pragma rtGlobals=3 // Use modern global access method and strict wave access. |
---|
3 | #pragma IgorVersion = 7.00 |
---|
4 | |
---|
5 | |
---|
6 | // |
---|
7 | // this is an empirical representation of the White Beam wavelength |
---|
8 | // distribution. |
---|
9 | // |
---|
10 | // using Integrate function -- find the normalization value |
---|
11 | // |
---|
12 | // integral = 20926 (cts*A) for "top" |
---|
13 | // integral = 19933 (cts*A) for "middle" |
---|
14 | // integration of interpolated data (100 pts) = 20051 (3 A to 9 A) |
---|
15 | // |
---|
16 | // |
---|
17 | // |
---|
18 | // of the three choices, using the fit to the "top" of the distribution gives the best-looking |
---|
19 | // result when compared to the AgBeh data |
---|
20 | // |
---|
21 | |
---|
22 | |
---|
23 | // 9/2019 |
---|
24 | // added an empirical functional form for the "Super" white beam mode where the deflector is out |
---|
25 | // and the wavelength is not cut off at the higher wavelength, but extends to 20 |
---|
26 | // |
---|
27 | // Integral = 30955 (cts*A) for middle fit |
---|
28 | // |
---|
29 | // |
---|
30 | |
---|
31 | // White Beam: |
---|
32 | // mean wavelength = 5.29687 |
---|
33 | // 3rd moment/2nd moment = 5.741 |
---|
34 | // |
---|
35 | // Super White Beam: |
---|
36 | // mean wavelength = 6.2033 |
---|
37 | // 3rd moment/2nd moment = 7.93267 |
---|
38 | // |
---|
39 | Constant kWhiteBeam_Mean = 5.3 |
---|
40 | //Constant kWhiteBeam_Mean = 5.7 // mean of lam^2 |
---|
41 | Constant kWhiteBeam_Normalization = 19933 |
---|
42 | |
---|
43 | Constant kSuperWhiteBeam_Mean = 6.2 |
---|
44 | //Constant kSuperWhiteBeam_Mean = 7.9 //mean of lam^2 |
---|
45 | Constant kSuperWhiteBeam_Normalization = 30955 |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | Function V_WhiteBeamDist_top(lam) |
---|
51 | Variable lam |
---|
52 | |
---|
53 | if(lam < 3.37) |
---|
54 | return(0) |
---|
55 | endif |
---|
56 | |
---|
57 | if(lam < 3.69) |
---|
58 | return(-31013 + 9198*lam) |
---|
59 | endif |
---|
60 | |
---|
61 | if(lam < 3.84) |
---|
62 | return(23715 - 5649*lam) |
---|
63 | endif |
---|
64 | |
---|
65 | //// the "middle" of the spikes |
---|
66 | // if(lam < 4.12) |
---|
67 | // return(-84962 + 22634*lam) |
---|
68 | // endif |
---|
69 | // if(lam < 8.37) |
---|
70 | // return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2)) |
---|
71 | // endif |
---|
72 | |
---|
73 | //// the "top" of the spikes |
---|
74 | if(lam < 4.16) |
---|
75 | return(-84962 + 22634*lam) |
---|
76 | endif |
---|
77 | if(lam < 8.25) |
---|
78 | return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2)) |
---|
79 | endif |
---|
80 | |
---|
81 | // anything larger than 8.37, return 0 |
---|
82 | return(0) |
---|
83 | |
---|
84 | End |
---|
85 | |
---|
86 | |
---|
87 | Function V_WhiteBeamDist_mid(lam) |
---|
88 | Variable lam |
---|
89 | |
---|
90 | if(lam < 3.37) |
---|
91 | return(0) |
---|
92 | endif |
---|
93 | |
---|
94 | if(lam < 3.69) |
---|
95 | return(-31013 + 9198*lam) |
---|
96 | endif |
---|
97 | |
---|
98 | if(lam < 3.84) |
---|
99 | return(23715 - 5649*lam) |
---|
100 | endif |
---|
101 | |
---|
102 | //// the "middle" of the spikes |
---|
103 | if(lam < 4.12) |
---|
104 | return(-84962 + 22634*lam) |
---|
105 | endif |
---|
106 | if(lam < 8.37) |
---|
107 | return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2)) |
---|
108 | endif |
---|
109 | |
---|
110 | ////// the "top" of the spikes |
---|
111 | // if(lam < 4.16) |
---|
112 | // return(-84962 + 22634*lam) |
---|
113 | // endif |
---|
114 | // if(lam < 8.25) |
---|
115 | // return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2)) |
---|
116 | // endif |
---|
117 | |
---|
118 | // anything larger than 8.37, return 0 |
---|
119 | return(0) |
---|
120 | |
---|
121 | End |
---|
122 | |
---|
123 | // this is not used - there is no improvement in the results when using the "full" shape of the |
---|
124 | // WB distribution. |
---|
125 | Function V_WhiteBeamInterp(lam) |
---|
126 | Variable lam |
---|
127 | |
---|
128 | WAVE interp_lam = root:interp_lam |
---|
129 | WAVE interp_cts = root:interp_cts |
---|
130 | |
---|
131 | return(interp(lam,interp_lam,interp_cts)) |
---|
132 | End |
---|
133 | |
---|
134 | // change the x-scaling of cts_for_mean to 3,9 (beg,end) |
---|
135 | // 3309 is the average value of cts_for_mean |
---|
136 | // cts_for_mean = interp_cts*x/3309 |
---|
137 | // |
---|
138 | // gives an average wavelength of 5.302 A |
---|
139 | // median ~ 5.97 A |
---|
140 | // |
---|
141 | Function V_WB_Mean() |
---|
142 | |
---|
143 | WAVE cts_for_mean |
---|
144 | Variable tot=sum(cts_for_mean) |
---|
145 | Variable ans |
---|
146 | |
---|
147 | cts_for_mean = cts_for_mean*x |
---|
148 | ans = sum(cts_for_mean)/tot |
---|
149 | |
---|
150 | return(ans) |
---|
151 | End |
---|
152 | |
---|
153 | |
---|
154 | // assumes that the counts and wavelength data for white and superWhite both are loaded and named: |
---|
155 | // |
---|
156 | // white_wavelength, counts_white |
---|
157 | // super_white_wavelength, counts_super_white |
---|
158 | // |
---|
159 | // |
---|
160 | Proc V_WB_Stats() |
---|
161 | |
---|
162 | duplicate/O counts_white cts_W, intg_W,intg_W3 |
---|
163 | duplicate/O counts_super_white cts_SW intg_SW,intg_SW3 |
---|
164 | |
---|
165 | Print "White Beam:" |
---|
166 | intg_W = cts_W*white_wavelength |
---|
167 | printf "mean wavelength = %g\r",sum(intg_W)/sum(cts_W) |
---|
168 | intg_W = cts_W*white_wavelength^2 |
---|
169 | // printf "sqrt(wavelength^2)/N = %g\r",sqrt( sum(intg_W)/sum(cts_W) ) |
---|
170 | intg_W3 = cts_W*white_wavelength^3 |
---|
171 | printf "3rd moment/2nd moment = %g\r",sum(intg_W3)/sum(intg_W) |
---|
172 | |
---|
173 | Print |
---|
174 | Print "Super White Beam:" |
---|
175 | intg_SW = cts_SW*super_white_wavelength |
---|
176 | printf "mean wavelength = %g\r",sum(intg_SW)/sum(cts_SW) |
---|
177 | intg_SW = cts_SW*super_white_wavelength^2 |
---|
178 | // printf "sqrt(wavelength^2)/N = %g\r",sqrt( sum(intg_SW)/sum(cts_SW) ) |
---|
179 | intg_SW3 = cts_SW*super_white_wavelength^3 |
---|
180 | printf "3rd moment/2nd moment = %g\r",sum(intg_SW3)/sum(intg_SW) |
---|
181 | |
---|
182 | End |
---|
183 | |
---|
184 | // |
---|
185 | // |
---|
186 | // |
---|
187 | Function V_SuperWhiteBeamDist_mid(lam) |
---|
188 | Variable lam |
---|
189 | |
---|
190 | if(lam < 3.37) |
---|
191 | return(0) |
---|
192 | endif |
---|
193 | |
---|
194 | if(lam < 3.72) |
---|
195 | return(-33536 + 9919*lam) |
---|
196 | endif |
---|
197 | |
---|
198 | if(lam < 3.88) |
---|
199 | return(28941 - 6848*lam) |
---|
200 | endif |
---|
201 | |
---|
202 | //// the "middle" of the spikes |
---|
203 | if(lam < 4.16) |
---|
204 | return(-1.0111e5 + 26689*lam) |
---|
205 | endif |
---|
206 | |
---|
207 | if(lam < 20) |
---|
208 | return(5 - 10081*exp(-( (lam-4.161)/0.9788 )) + 19776*exp(-( (lam-4.161)/1.921 )) ) |
---|
209 | endif |
---|
210 | |
---|
211 | // anything larger than 20, return 0 |
---|
212 | return(0) |
---|
213 | |
---|
214 | End |
---|
215 | |
---|
216 | |
---|