source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/Vx_Nexus_VSANS_Write.ipf @ 1062

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

many changes to the VCALC code and a few changes to the main code to get the units consistent, and centimeters everywhere possible. The real space distance array and the non-linear calibrations are still defined and calculated in mm. This can hopefully be changed in the future. Some constants in the data file will need to be updated to cm, such as the T/B setback, which has been confirmed to be 41.0 cm

File size: 7.9 KB
Line 
1#pragma rtGlobals=3             // Use modern global access method and strict wave access.
2
3///
4// for the simulator, routines to be able to write out a proper Nexus file
5// based on a template
6////
7
8
9
10// overwrites the dummy values as needed with VCALC information
11//
12// TODO
13// issues here with the potential for Nexus to have data as INTEGER
14// where I'd rather have the data here in Igor be DP, so there are no
15// conversion/assignment issues
16//
17// simuation data from VCALC = DP, but I need to assign to an Integer wave...
18// - sometimes this works, sometimes not...
19// may need to Redimension/I
20//
21/// break this up into several smaller procedures as this is a VERY lengthy task to do
22
23        // TODO
24// set the "accessible" copies of the data (these are really to be links in the file!)
25
26
27// TODO
28// get Paul K to write out 2D data sets, rather than 3D (not appropriate for SANS or VSANS)
29//
30
31/////
32/// to get "useable" data out of the 3D wave (incorrectly written)
33//              Redimension/N=(1,320,320)       root:V_Nexus_Template:entry1:instrument:detector_B:data
34//              root:V_Nexus_Template:entry1:instrument:detector_B:data[0][][] = root:Packages:NIST:VSANS:VCALC:Back:det_B[q][r]
35//              root:V_Nexus_Template:entry1:instrument:detector_B:distance = VCALC_getSDD("B")
36
37
38
39//
40// A "template" VSANS Nexus file has been loaded and is then filled in with
41// the simulation results. Some of the file, will therefore be garbage, but the
42// overall structure and attributes should be correct.
43//
44// Hopefully this will make the maintenance and testing of the file structure easier...
45// AUG 2015
46//
47///////////////////////////
48//
49// these are all of the VCALC changes to the simulated files. ADD to these as needed, making these changes to the
50// folder structure after the "default" values have been re-filled in the waves (to make sure something is really there)
51//
52////////////////////////
53
54// TODO:
55//      -- Need to write all of the "accessors" to r/w all of the simulated bits to the data file... lots to do
56// -- THIS DOES NOT MATCH THE CURRENT NICE_GENERATED FILE !!!!
57//
58Proc H_Fill_VSANS_Template_wSim()
59
60
61        root:V_Nexus_Template:entry1:instrument:beam:monochromator:wavelength = VCALC_getWavelength()
62                               
63//                      SetDataFolder root:VSANS_file:entry1:instrument         
64//                              SetDataFolder root:VSANS_file:entry1:instrument:monochromator           
65//                                      wavelength      = VCALC_getWavelength()
66//                                      SetDataFolder root:VSANS_file:entry1:instrument:monochromator:velocity_selector         
67//                                              wavelength      = VCALC_getWavelength()
68//                                              //      table (wave)   
69//                                      SetDataFolder root:VSANS_file:entry1:instrument:monochromator:crystal           
70//                                              wavelength      = VCALC_getWavelength()
71//                                             
72//                                      SetDataFolder root:VSANS_file:entry1:instrument:monochromator:white_beam               
73//                                              wavelength      = VCALC_getWavelength()
74//                                              //      description_of_distribution
75                                       
76
77                Redimension/N=(1,150,150)       root:V_Nexus_Template:entry1:instrument:detector_B:data
78                root:V_Nexus_Template:entry1:instrument:detector_B:data[0][][] = root:Packages:NIST:VSANS:VCALC:Back:det_B[q][r]
79                root:V_Nexus_Template:entry1:instrument:detector_B:distance = VCALC_getSDD("B")
80
81//
82//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_MR                     
83//                              data    = root:Packages:NIST:VSANS:VCALC:Middle:det_MR
84//                              nx_distance     = VCALC_getSDD("MR")
85//                              separation      = VCALC_getPanelSeparation("MR")
86//                              spatial_calibration[0][] = 1.072
87//                              spatial_calibration[1][] = -4.0e-5
88//                             
89//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_ML             
90//                              data    = root:Packages:NIST:VSANS:VCALC:Middle:det_ML
91//                              nx_distance     = VCALC_getSDD("ML")
92//                              separation = VCALC_getPanelSeparation("ML")
93//                              spatial_calibration[0][] = 1.072
94//                              spatial_calibration[1][] = -4.0e-5
95//
96//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_MT             
97//                              data    = root:Packages:NIST:VSANS:VCALC:Middle:det_MT
98//                              nx_distance     = VCALC_getSDD("MT")
99//                              sdd_offset = VCALC_getTopBottomSDDSetback("MT")
100//                              separation = VCALC_getPanelSeparation("MT")
101//                              spatial_calibration[0][] = 1.072
102//                              spatial_calibration[1][] = -4.0e-5
103//
104//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_MB             
105//                              data    = root:Packages:NIST:VSANS:VCALC:Middle:det_MB
106//                              nx_distance     = VCALC_getSDD("MB")
107//                              sdd_offset = VCALC_getTopBottomSDDSetback("MB")
108//                              separation = VCALC_getPanelSeparation("MB")
109//                              spatial_calibration[0][] = 1.072
110//                              spatial_calibration[1][] = -4.0e-5
111//
112//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_FR                     
113//                              data    = root:Packages:NIST:VSANS:VCALC:Front:det_FR
114//                              nx_distance     = VCALC_getSDD("FR")
115//                              separation = VCALC_getPanelSeparation("FR")
116//                              spatial_calibration[0][] = 1.072
117//                              spatial_calibration[1][] = -4.0e-5
118//
119//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_FL             
120//                              data    = root:Packages:NIST:VSANS:VCALC:Front:det_FL
121//                              nx_distance     = VCALC_getSDD("FL")
122//                              separation = VCALC_getPanelSeparation("FL")
123//                              spatial_calibration[0][] = 1.072
124//                              spatial_calibration[1][] = -4.0e-5
125//
126//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_FT             
127//                              data    = root:Packages:NIST:VSANS:VCALC:Front:det_FT
128//                              nx_distance     = VCALC_getSDD("FT")
129//                              sdd_offset = VCALC_getTopBottomSDDSetback("FT")
130//                              separation = VCALC_getPanelSeparation("FT")
131//                              spatial_calibration[0][] = 1.072
132//                              spatial_calibration[1][] = -4.0e-5
133//
134//                      SetDataFolder root:VSANS_file:entry1:instrument:detector_FB             
135//                              data    = root:Packages:NIST:VSANS:VCALC:Front:det_FB
136//                              nx_distance     = VCALC_getSDD("FB")
137//                              sdd_offset = VCALC_getTopBottomSDDSetback("FB")
138//                              separation = VCALC_getPanelSeparation("FB")
139//                              spatial_calibration[0][] = 1.072
140//                              spatial_calibration[1][] = -4.0e-5
141//
142//                                     
143//// SRK -set the top level copies of the data                                 
144//              SetDataFolder root:VSANS_file:entry1:data_B     
145//                      data    = root:Packages:NIST:VSANS:VCALC:Back:det_B
146//
147//              SetDataFolder root:VSANS_file:entry1:data_MR   
148//                      data    = root:Packages:NIST:VSANS:VCALC:Middle:det_MR
149//                     
150//              SetDataFolder root:VSANS_file:entry1:data_ML   
151//                      data    = root:Packages:NIST:VSANS:VCALC:Middle:det_ML
152//                     
153//              SetDataFolder root:VSANS_file:entry1:data_MT   
154//                      data    = root:Packages:NIST:VSANS:VCALC:Middle:det_MT
155//                      data    = (data ==   2147483647) ? 0 : data             //the NaN "mask" in the sim data shows up as an ugly integer
156//                     
157//              SetDataFolder root:VSANS_file:entry1:data_MB   
158//                      data    = root:Packages:NIST:VSANS:VCALC:Middle:det_MB
159//                      data    = (data ==   2147483647) ? 0 : data             //the NaN "mask" in the sim data shows up as an ugly integer
160//                     
161//              SetDataFolder root:VSANS_file:entry1:data_FR   
162//                      data    = root:Packages:NIST:VSANS:VCALC:Front:det_FR
163//                     
164//              SetDataFolder root:VSANS_file:entry1:data_FL   
165//                      data    = root:Packages:NIST:VSANS:VCALC:Front:det_FL
166//                     
167//              SetDataFolder root:VSANS_file:entry1:data_FT   
168//                      data    = root:Packages:NIST:VSANS:VCALC:Front:det_FT
169//                      data    = (data ==   2147483647) ? 0 : data             //the NaN "mask" in the sim data shows up as an ugly integer
170//                     
171//              SetDataFolder root:VSANS_file:entry1:data_FB   
172//                      data    = root:Packages:NIST:VSANS:VCALC:Front:det_FB
173//                      data    = (data ==   2147483647) ? 0 : data             //the NaN "mask" in the sim data shows up as an ugly integer
174//                     
175//                             
176////            SetDataFolder root:VSANS_file:entry1:reduction         
177////                    intent  = "SCATTER"
178////                    transmission_file_name  = "SANSFile_TRN.h5"
179////                    empty_beam_file_name    = "SANSFile_EB.h5"
180////                    background_file_name    = "SANSFile_BKG.h5"
181////                    empty_file_name = "SANSFile_EMP.h5"
182////                    sensitivity_file_name   = "SANSFile_DIV.h5"
183////                    mask_file_name  = "SANSFile_MASK.h5"
184////                    sans_log_file_name      = "SANSFile_log.txt"
185////                    whole_trans     = 0.888
186////                    whole_trans_error       = 0.008
187////                    box_count       = 23232
188////                    box_count_error = 22
189////                    box_coordinates = {50,80,45,75}
190////                    comments        = "extra data comments"
191////                    absolute_scaling        = {1,1,1e5,1}
192////                    SetDataFolder root:VSANS_file:entry1:reduction:pol_sans                 
193////                            pol_sans_purpose        = "name from the list"
194////                            cell_name       = "Burgundy"
195////                            cell_parameters = {1,2,3,4,5}
196//                                     
197
198        SetDataFolder root:
199
200End
201
202
Note: See TracBrowser for help on using the repository browser.