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

Last change on this file since 1130 was 1095, checked in by srkline, 5 years ago

Added two model functions for white beam smearing.

Many other small changes for processing of the back detector, shuffling of VSANS menu items, and consistent naming of V_ procedures.

File size: 2.4 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5
6
7
8
9//
10// this is an empirical representation of the White Beam wavelength
11// distribution.
12//
13// using Integrate function -- find the normalization value
14//
15// integral = 20926 (cts*A) for "top"
16// integral = 19933 (cts*A) for "middle"
17// integration of interpolated data (100 pts) = 20051 (3 A to 9 A)
18//
19//
20// gives an average wavelength of 5.302 A
21// median ~ 5.97 A
22//
23//
24// of the three choices, using the fit to the "top" of the distribution gives the best-looking
25// result when compared to the AgBeh data
26//
27
28Function V_WhiteBeamDist_top(lam)
29        Variable lam
30       
31        if(lam < 3.37)
32                return(0)
33        endif
34       
35        if(lam < 3.69)
36                return(-31013 + 9198*lam)
37        endif
38       
39        if(lam < 3.84)
40                return(23715 - 5649*lam)
41        endif
42       
43//// the "middle" of the spikes
44//      if(lam < 4.12)
45//              return(-84962 + 22634*lam)
46//      endif
47//      if(lam < 8.37)
48//              return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2))
49//      endif
50
51//// the "top" of the spikes
52        if(lam < 4.16)
53                return(-84962 + 22634*lam)
54        endif
55        if(lam < 8.25)
56                return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2))
57        endif
58
59//       anything larger than 8.37, return 0   
60        return(0)
61       
62End
63
64Function V_WhiteBeamDist_mid(lam)
65        Variable lam
66       
67        if(lam < 3.37)
68                return(0)
69        endif
70       
71        if(lam < 3.69)
72                return(-31013 + 9198*lam)
73        endif
74       
75        if(lam < 3.84)
76                return(23715 - 5649*lam)
77        endif
78       
79//// the "middle" of the spikes
80        if(lam < 4.12)
81                return(-84962 + 22634*lam)
82        endif
83        if(lam < 8.37)
84                return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2))
85        endif
86
87////// the "top" of the spikes
88//      if(lam < 4.16)
89//              return(-84962 + 22634*lam)
90//      endif
91//      if(lam < 8.25)
92//              return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2))
93//      endif
94
95//       anything larger than 8.37, return 0   
96        return(0)
97       
98End
99
100// this is not used - there is no improvement in the results when using the "full" shape of the
101// WB distribution.
102Function V_WhiteBeamInterp(lam)
103        Variable lam
104       
105        WAVE interp_lam = root:interp_lam
106        WAVE interp_cts = root:interp_cts
107       
108        return(interp(lam,interp_lam,interp_cts))
109End
110
111// change the x-scaling of cts_for_mean to 3,9 (beg,end)
112// 3309 is the average value of cts_for_mean
113// cts_for_mean = interp_cts*x/3309
114//
115// gives an average wavelength of 5.302 A
116// median ~ 5.97 A
117//
118Function V_WB_Mean()
119
120        WAVE cts_for_mean
121        Variable tot=sum(cts_for_mean)
122        Variable ans
123       
124        cts_for_mean = cts_for_mean*x
125        ans = sum(cts_for_mean)/tot
126       
127        return(ans)
128End
129
Note: See TracBrowser for help on using the repository browser.