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

Last change on this file since 1091 was 1091, checked in by srkline, 4 years ago

a number of changes, mostly to allow everything to compile.

added conditional compile to ensure that XML code would not be compiled if VSANS was present, since it's not XML-aware.

modified V_MainPanel to avoid conflicts with the SANS version. There still may be some functions hidden in procedures that do not have the V_ prefix yet, but these are either for functions that should point to a common file, or procedures that have been hidden from the VSANS panel

modified saving of VSANS mask files so that they can still be saved from teh deom version where home path is not defined.

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