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

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

Adding proceures - not complete yet- to allow smearing of data under white beam conditions. currently only wavelength effects taken into account, not the geometry. Unknown if geometry is a significant correction given the width of the qhite beam distribution. further testing is needed.

File size: 1.7 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 --
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//
21// of the three choices, using the fit to the "top" of the distribution gives the best-looking
22// result when compared to the AgBeh data
23//
24Function V_WhiteBeamDist(lam)
25        Variable lam
26       
27        if(lam < 3.37)
28                return(0)
29        endif
30       
31        if(lam < 3.69)
32                return(-31013 + 9198*lam)
33        endif
34       
35        if(lam < 3.84)
36                return(23715 -5649*lam)
37        endif
38       
39// the "middle" of the spikes   
40//      if(lam < 4.12)
41//              return(-84962 + 22634*lam)
42//      endif
43//      if(lam < 8.37)
44//              return(-2336 + 11422*exp(-( (lam-3.043)/4.234 )^2))
45//      endif
46
47// the "top" of the spikes
48        if(lam < 4.16)
49                return(-84962 + 22634*lam)
50        endif
51        if(lam < 8.25)
52                return(-2336 + 12422*exp(-( (lam-3.043)/4.034 )^2))
53        endif
54
55//       anything larger than 8.37, return 0   
56        return(0)
57       
58End
59
60// this is not used - there is no improvement in the results when using the "full" shape of the
61// WB distribution.
62Function V_WhiteBeamInterp(lam)
63        Variable lam
64       
65        WAVE interp_lam = root:interp_lam
66        WAVE interp_cts = root:interp_cts
67       
68        return(interp(lam,interp_lam,interp_cts))
69End
70
71// change the x-scaling of cts_for_mean to 3,9 (beg,end)
72// 3309 is the average value of cts_for_mean
73// cts_for_mean = interp_cts*x/3309
74//
75// gives an average wavelength of 5.302 A
76// median ~ 5.97 A
77//
78Function V_WB_Mean()
79
80        WAVE cts_for_mean
81        Variable tot=sum(cts_for_mean)
82        Variable ans
83       
84        cts_for_mean = cts_for_mean*x
85        ans = sum(cts_for_mean)/tot
86       
87        return(ans)
88End
89
Note: See TracBrowser for help on using the repository browser.