source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/NCNR_USANS_Utils.ipf @ 1239

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

many changes to the VCALC procedures to add in the hard/soft shadowing to the calculation, visualization of the shadowed regions, and the actual q-values. Added a separate panel to view the shadowed regions.

simpe fix to the real time routine to allow easy updating of both the raw 2D data and 1-D average

update to the USANS package to handle the new NICE generated data where the data is collected in terms of q-values rather than angle. On startup asks user which style of data they have. Sets a preference that can be un-checked if you have old-style ICP data. (there is nothing in the data file that I can key on).

File size: 3.6 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2#pragma version=2.20
3#pragma IgorVersion=6.1
4
5// utilities and constants that are specific to the NCNR USANS
6
7//facility-specific constants
8Function Init_USANS_Facility()
9
10        //INSTRUMENTAL CONSTANTS
11        Variable/G      root:Packages:NIST:USANS:Globals:MainPanel:gTheta_H = 3.9e-6            //Darwin FWHM   (pre- NOV 2004)
12        Variable/G      root:Packages:NIST:USANS:Globals:MainPanel:gTheta_V = 0.014             //Vertical divergence   (pre- NOV 2004)
13        //Variable/G  root:Globals:MainPanel:gDomega = 2.7e-7           //Solid angle of detector (pre- NOV 2004)
14        Variable/G      root:Packages:NIST:USANS:Globals:MainPanel:gDomega = 7.1e-7             //Solid angle of detector (NOV 2004)
15        Variable/G      root:Packages:NIST:USANS:Globals:MainPanel:gDefaultMCR= 1e6             //factor for normalization
16       
17        //Variable/G  root:Globals:MainPanel:gDQv = 0.037               //divergence, in terms of Q (1/A) (pre- NOV 2004)
18        Variable/G      root:Packages:NIST:USANS:Globals:MainPanel:gDQv = 0.117         //divergence, in terms of Q (1/A)  (NOV 2004)
19
20        String/G root:Packages:NIST:gXMLLoader_Title=""
21       
22        //November 2010 - deadtime corrections -- see USANS_DetectorDeadtime() below
23        //Only used in BT5_Loader.ipf and dependent on date, so defined there on each file load.
24       
25       
26
27// is the data file from NICE and in terms of QValues rather than angle?
28        Variable/G root:Packages:NIST:gRawUSANSisQvalues=1              //== 1 means raw data is in Q, not angle
29
30        DoAlert 0,"The data loader is set to interpret raw data in Q-values (from NICE), not angle (from ICP). If your raw data was collected from ICP, change this setting using the menu item USANS->NCNR Preferences"
31       
32        // to convert from angle (in degrees) to Q (in 1/Angstrom)
33        // -- or to disable the conversion if the data is "new NICE" (approx Mar 2019)
34        NVAR gRawUSANSisQvalues = root:Packages:NIST:gRawUSANSisQvalues
35        if(gRawUSANSisQvalues == 1)
36                Variable/G root:Packages:NIST:USANS:Globals:MainPanel:deg2QConv = 1             //so that the q-values are unchanged
37        else
38                Variable/G root:Packages:NIST:USANS:Globals:MainPanel:deg2QConv = 5.55e-5               //JGB -- 2/24/01
39        endif
40
41
42       
43        // extension string for the raw data files
44        // -- not that the extension as specified here starts with "."
45        String/G        root:Packages:NIST:USANS:Globals:MainPanel:gUExt = ".bt5"
46       
47        // on Feb 7 2019 @ 11:00 AM, the order of the columns in the raw BT5 data file was swapped to
48        // put the 5 detectors in positions 2-6, moving the transmission detector from postion 4 to positon 7
49        // this was the only change made to the data file (done in expectation of NICE being ready soon)
50        // --to switch between the two different read routines, key on the time of data collection in the data file
51        //
52        Variable/G root:Packages:NIST:USANS:Globals:MainPanel:gFileSwitchSecs=date2secs(2019,2,7)+3600*11               // the seconds of the switch
53       
54        return(0)
55end
56
57
58// returns the detector dead time for the main detectors, and the transmission detector
59//
60// NCNR values switch based on a date when hardware was swapped out. other facilities can ignore the date
61//
62// also, if dead time is not known, zero can be returned to inactivate the dead time correction
63//
64//
65//Discovered significant deadtime on detectors in Oct 2010
66//JGB and AJJ changed pre-amps during shutdown Oct 27 - Nov 7 2010
67//Need different deadtime before and after 8th November 2010
68//
69Function USANS_DetectorDeadtime(filedt,MainDeadTime,TransDeadTime)
70        String filedt
71        Variable &MainDeadTime,&TransDeadTime
72       
73        if (BT5Date2Secs(filedt) < date2secs(2010,11,7))
74                        MainDeadTime = 4e-5
75                        TransDeadTime = 1.26e-5
76                        //print "Old Dead Times"
77                        //MainDeadTime = 0
78                        //TransDeadTime = 0
79        else
80                        MainDeadTime = 7e-6
81                        TransDeadTime = 1.26e-5
82                        //print "New Dead Times"
83        endif
84       
85        return(0)
86end
Note: See TracBrowser for help on using the repository browser.