source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DIVUtils.ipf @ 1025

Last change on this file since 1025 was 1025, checked in by srkline, 6 years ago

many changes to get the basics of a reduction protocol working

File size: 5.0 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2
3//
4// ********
5// TODO -- this is only a fake DIV file. need to identify how to generate a real DIV file
6//     for the different detectors, and how to fill it into a file. ProDIV for SANS may be a good
7//     starting point, or it may be cumbersome. Not sure how it will be measured in practice
8//     on VSANS.
9//
10//   JAN 2017
11//
12//
13//
14//
15//
16
17// TODO
18// currently, there are no dummy fill values or attributes for the fake DIV file
19//
20Proc Setup_VSANS_DIV_Struct()
21
22        // lays out the tree and fills with dummy values
23        H_Setup_VSANS_DIV_Structure()
24       
25        // writes in the attributes
26//      H_Fill_VSANS_Attributes()
27       
28        // fill in with VCALC simulation bits
29//      H_Fill_VSANS_wSim()
30       
31End
32
33Proc Save_VSANS_DIV_Nexus(fileName)
34        String fileName="Test_VSANS_DIV_file"
35
36        // save as HDF5 (no attributes saved yet)
37        Save_VSANS_file("root:VSANS_DIV_file", fileName+".h5")
38       
39//      // read in a data file using the gateway-- reads from the home path
40//      H_HDF5Gate_Read_Raw(fileName+".h5")
41//     
42//      // after reading in a "partial" file using the gateway (to generate the xref)
43//      // Save the xref to disk (for later use)
44//      Save_HDF5___xref("root:"+fileName,"HDF5___xref")
45//     
46//      // after you've generated the HDF5___xref, load it in and copy it
47//      // to the necessary folder location.
48//      Copy_HDF5___xref("root:VSANS_DIV_file", "HDF5___xref")
49//     
50//      // writes out the contents of a data folder using the gateway
51//      H_HDF5Gate_Write_Raw("root:VSANS_DIV_file", fileName+".h5")
52//
53//      // re-load the data file using the gateway-- reads from the home path
54//      // now with attributes
55//      H_HDF5Gate_Read_Raw(fileName+".h5")
56       
57End
58
59////////////// fake DIV file tests
60//
61//
62//      Make/O/T/N=1    file_name       = "VSANS_DIV_test.h5"
63//
64// simple generation of a fake div file. for sans, nothing other than the creation date was written to the
65// file header. nothing more is needed (possibly)
66//
67// TODO -- I want to re-visit the propagation of errors in the DIV file. No errors are ever calculated/saved
68//   during the generation of the file, but there's no reason it couldn't. the idea is that the plex
69//   is counted so long that the errors are insignificant compared to the data errors, but that may not
70//   always be the case. A bit of math may prove this. or not. Plus, the situation for VSANS may be different.
71//
72//
73// TODO -- make the number of pixels GLOBAL
74// TODO -- there will be lots of work to do to develop the procedures necessary to actually generate the
75//      9 data sets to become the DIV file contents. More complexity here than for the simple SANS case.
76//
77Proc H_Setup_VSANS_DIV_Structure()
78       
79        NewDataFolder/O/S root:VSANS_DIV_file           
80
81        NewDataFolder/O/S root:VSANS_DIV_file:entry     
82                Make/O/T/N=1    title   = "This is a DIV file for VSANS: VSANS_DIV"
83                Make/O/T/N=1    start_date      = "2015-02-28T08:15:30-5:00"
84                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument         
85                        Make/O/T/N=1    name    = "NG3_VSANS"
86                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_B       
87                        Make/O/D/N=(150,150)    data    = 1 + (enoise(0.1))
88                        Make/O/D/N=(150,150)    linear_data_error       = 0.01*abs(gnoise(1))
89                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MR             
90                        Make/O/D/N=(48,128)     data
91                        data[][0] = 1+enoise(0.1)
92                        data[][] = data[p][0]
93                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
94                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_ML             
95                        Make/O/D/N=(48,128)     data
96                        data[][0] = 1+enoise(0.1)
97                        data[][] = data[p][0]
98                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
99                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MT             
100                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
101                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
102                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MB             
103                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
104                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
105                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FR             
106                        Make/O/D/N=(48,128)     data
107                        data[][0] = 1+enoise(0.1)
108                        data[][] = data[p][0]
109                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
110                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FL             
111                        Make/O/D/N=(48,128)     data
112                        data[][0] = 1+enoise(0.1)
113                        data[][] = data[p][0]
114                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
115                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FT             
116                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
117                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
118                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FB             
119                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
120                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
121               
122                // fake, empty folders so that the generic loaders can be used
123                NewDataFolder/O root:VSANS_DIV_file:entry:DAS_logs
124                NewDataFolder/O root:VSANS_DIV_file:entry:control
125                NewDataFolder/O root:VSANS_DIV_file:entry:reduction
126                NewDataFolder/O root:VSANS_DIV_file:entry:sample
127                NewDataFolder/O root:VSANS_DIV_file:entry:user
128
129                       
130        SetDataFolder root:
131
132End
Note: See TracBrowser for help on using the repository browser.