# source:sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WhiteBeamDistribution.ipf@1203

Last change on this file since 1203 was 1203, checked in by srkline, 3 years ago

Corrected attenuator table for VSANS to include the range 4.52->19. Patching of the attenuation factor is disabled since the factor is always calculated rather than read from the file.

Added a few help links in preparation for the full help file integration

Added a "super" white beam distribution definition and a single model function for testing of this new mode. Still need the normalization and mean wavelength for the distribution + a way to identify it in the file metadata.

File size: 3.1 KB
Line
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5//
6// this is an empirical representation of the White Beam wavelength
7// distribution.
8//
9// using Integrate function -- find the normalization value
10//
11// integral = 20926 (cts*A) for "top"
12// integral = 19933 (cts*A) for "middle"
13// integration of interpolated data (100 pts) = 20051 (3 A to 9 A)
14//
15//
16// gives an average wavelength of 5.302 A
17// median ~ 5.97 A
18//
19//
20// of the three choices, using the fit to the "top" of the distribution gives the best-looking
21// result when compared to the AgBeh data
22//
23
24
25// 9/2019
26// added an empirical functional form for the "Super" white beam mode where the deflector is out
27// and the wavelength is not cut off at the higher wavelength, but extends to 20 
28//
29// Integral = 30955 (cts*A) for middle fit
30//
31
32
33
34
35
36
37Function V_WhiteBeamDist_top(lam)
38        Variable lam
39
40        if(lam < 3.37)
41                return(0)
42        endif
43
44        if(lam < 3.69)
45                return(-31013 + 9198*lam)
46        endif
47
48        if(lam < 3.84)
49                return(23715 - 5649*lam)
50        endif
51
52//// the "middle" of the spikes
53//      if(lam < 4.12)
54//              return(-84962 + 22634*lam)
55//      endif
56//      if(lam < 8.37)
57//              return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2))
58//      endif
59
60//// the "top" of the spikes
61        if(lam < 4.16)
62                return(-84962 + 22634*lam)
63        endif
64        if(lam < 8.25)
65                return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2))
66        endif
67
68//       anything larger than 8.37, return 0
69        return(0)
70
71End
72
73Function V_WhiteBeamDist_mid(lam)
74        Variable lam
75
76        if(lam < 3.37)
77                return(0)
78        endif
79
80        if(lam < 3.69)
81                return(-31013 + 9198*lam)
82        endif
83
84        if(lam < 3.84)
85                return(23715 - 5649*lam)
86        endif
87
88//// the "middle" of the spikes
89        if(lam < 4.12)
90                return(-84962 + 22634*lam)
91        endif
92        if(lam < 8.37)
93                return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2))
94        endif
95
96////// the "top" of the spikes
97//      if(lam < 4.16)
98//              return(-84962 + 22634*lam)
99//      endif
100//      if(lam < 8.25)
101//              return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2))
102//      endif
103
104//       anything larger than 8.37, return 0
105        return(0)
106
107End
108
109// this is not used - there is no improvement in the results when using the "full" shape of the
110// WB distribution.
111Function V_WhiteBeamInterp(lam)
112        Variable lam
113
114        WAVE interp_lam = root:interp_lam
115        WAVE interp_cts = root:interp_cts
116
117        return(interp(lam,interp_lam,interp_cts))
118End
119
120// change the x-scaling of cts_for_mean to 3,9 (beg,end)
121// 3309 is the average value of cts_for_mean
122// cts_for_mean = interp_cts*x/3309
123//
124// gives an average wavelength of 5.302 A
125// median ~ 5.97 A
126//
127Function V_WB_Mean()
128
129        WAVE cts_for_mean
130        Variable tot=sum(cts_for_mean)
131        Variable ans
132
133        cts_for_mean = cts_for_mean*x
134        ans = sum(cts_for_mean)/tot
135
136        return(ans)
137End
138
139
140//
141//
142//
143Function V_SuperWhiteBeamDist_mid(lam)
144        Variable lam
145
146        if(lam < 3.37)
147                return(0)
148        endif
149
150        if(lam < 3.72)
151                return(-33536 + 9919*lam)
152        endif
153
154        if(lam < 3.88)
155                return(28941 - 6848*lam)
156        endif
157
158//// the "middle" of the spikes
159        if(lam < 4.16)
160                return(-1.0111e5 + 26689*lam)
161        endif
162
163        if(lam < 20)
164                return(5 - 10081*exp(-( (lam-4.161)/0.9788 )) + 19776*exp(-( (lam-4.161)/1.921 )) )
165        endif
166
167//       anything larger than 20, return 0
168        return(0)
169
170End
171
172
Note: See TracBrowser for help on using the repository browser.