source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Testing_Data_Procs.ipf @ 994

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

more changes, lots of files.

File size: 5.4 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5
6//////// function to take VCALC information and
7// fill in the simulated information as needed to make a "fake" data file
8//
9// TODO:
10// -- identify all of the necessary bits to change
11// -- maybe want a panel to make it easier to decide what inputs to change in the file
12// -- decide if it's better to write wholesale, or as individual waves
13//
14Macro Copy_VCALC_to_VSANSFile()
15       
16        String fileName = V_DoSaveFileDialog("pick the file to write to")
17        print fileName
18//     
19        if(strlen(fileName) > 0)
20                writeVCALC_to_file(fileName)
21        endif
22End
23
24//
25// TODO -- fill this in as needed to get fake data that's different
26//
27Function writeVCALC_to_file(fileName)
28        String fileName
29
30
31// the detectors, all 9 + the correct SDD (that accounts for the offset of T/B panels
32// the data itself (as INT32)
33// the front SDD (correct units)
34// the middle SDD (correct units)
35// the back SDD (correct units)
36        Variable ii,val
37        String detStr
38        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1)
39                detStr = StringFromList(ii, ksDetectorListAll, ";")
40                Duplicate/O $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+detStr+":det_"+detStr) tmpData
41                Redimension/I tmpData
42                tmpData = (tmpData ==   2147483647) ? 0 : tmpData               //the NaN "mask" in the sim data (T/B only)shows up as an ugly integer
43                V_writeDetectorData(fileName,detStr,tmpData)
44               
45                val = VCALC_getTopBottomSDDOffset(detStr)/10 + VCALC_getSDD(detStr)*100         // make sure value is in cm
46                print val
47                V_writeDet_distance(fileName,detStr,val)
48               
49                // x and y pixel sizes for each detector should be correct in the "base" file - but if not...
50                //Function VCALC_getPixSizeX(type)              // returns the pixel X size, in [cm]
51                //Function VCALC_getPixSizeY(type)
52                V_writeDet_x_pixel_size(fileName,detStr,VCALC_getPixSizeX(detStr)*10)           // data file is expecting mm
53                V_writeDet_y_pixel_size(fileName,detStr,VCALC_getPixSizeY(detStr)*10)
54       
55                // write out the xCtr and yCtr (pixels) that was used in the q-calculation, done in VC_CalculateQFrontPanels()
56                V_writeDet_beam_center_x(fileName,detStr,V_getDet_beam_center_x("VCALC",detStr))
57                V_writeDet_beam_center_y(fileName,detStr,V_getDet_beam_center_y("VCALC",detStr))
58               
59               
60       
61                // the calibration data for each detector (except B) is already correct in the "base" file
62                //V_writeDetTube_spatialCalib(fname,detStr,inW)
63                // and for "B"
64                //V_writeDet_cal_x(fname,detStr,inW)
65                //V_writeDet_cal_y(fname,detStr,inW)
66               
67                               
68                // the dead time for each detector is already correct in the "base" file
69                // V_writeDetector_deadtime(fname,detStr,inW)
70                // TODO: need a new, separate function to write the single deadtime value in/out of "B"
71
72        endfor
73       
74       
75//? other detector geometry - lateral separation?
76
77// the wavelength
78//      Variable lam = V_getWavelength("VCALC")         //doesn't work, the corresponding folder in VCALC has not been defined
79        V_writeWavelength(fileName,VCALC_getWavelength())
80
81// description of the sample
82
83// sample information
84// name, title, etc
85       
86// fake the information about the count setup, so I have different numbers to read
87// count time = fake time of 100 s
88        V_writeCount_time(fileName,100)
89
90// monitor count (= imon)
91// returns the number of neutrons on the sample
92//Function VCALC_getImon()
93
94// ?? anything else that I'd like to see on the catalog - I could change them here to see different values
95// different collimation types?
96//
97
98        return(0)
99end
100
101
102
103
104// writes out "perfect" detector calibration constants for all 8 tube banks
105Function V_WritePerfectCalibration()
106
107        Make/O/D/N=(3,48) tmpCalib
108        // for the "tall" L/R banks
109        tmpCalib[0][] = -512
110        tmpCalib[1][] = 8
111        tmpCalib[2][] = 0
112       
113        V_writeDetTube_spatialCalib("","FR",tmpCalib)
114        V_writeDetTube_spatialCalib("","FL",tmpCalib)
115        V_writeDetTube_spatialCalib("","MR",tmpCalib)
116        V_writeDetTube_spatialCalib("","ML",tmpCalib)
117
118        // for the "short" T/B banks
119        tmpCalib[0][] = -256
120        tmpCalib[1][] = 4
121        tmpCalib[2][] = 0
122       
123        V_writeDetTube_spatialCalib("","FT",tmpCalib)
124        V_writeDetTube_spatialCalib("","FB",tmpCalib)
125        V_writeDetTube_spatialCalib("","MT",tmpCalib)
126        V_writeDetTube_spatialCalib("","MB",tmpCalib)
127       
128        KillWaves tmpCalib
129        return(0)
130end
131
132// TODO -- need a function to write out "bad" and "perfect" dead time values
133// to the HDF file
134//V_writeDetector_deadtime(fname,detStr,inW)
135//V_writeDetector_deadtime_B(fname,detStr,val)
136
137
138Function V_FakeBeamCenters()
139// fake beam center values
140        V_putDet_beam_center_x("RAW","B",75)
141        V_putDet_beam_center_y("RAW","B",75)
142
143        V_putDet_beam_center_x("RAW","MB",64)
144        V_putDet_beam_center_y("RAW","MB",55)
145        V_putDet_beam_center_x("RAW","MT",64)
146        V_putDet_beam_center_y("RAW","MT",-8.1)
147        V_putDet_beam_center_x("RAW","MR",-8.1)
148        V_putDet_beam_center_y("RAW","MR",64)
149        V_putDet_beam_center_x("RAW","ML",55)
150        V_putDet_beam_center_y("RAW","ML",64)
151
152        V_putDet_beam_center_x("RAW","FB",64)
153        V_putDet_beam_center_y("RAW","FB",55)
154        V_putDet_beam_center_x("RAW","FT",64)
155        V_putDet_beam_center_y("RAW","FT",-8.7)
156        V_putDet_beam_center_x("RAW","FR",-8.1)
157        V_putDet_beam_center_y("RAW","FR",64)
158        V_putDet_beam_center_x("RAW","FL",55)
159        V_putDet_beam_center_y("RAW","FL",64)
160       
161        return(0)
162end
163
164Function V_FakeScaleToCenter()
165
166        V_RescaleToBeamCenter("RAW","MB",64,55)
167        V_RescaleToBeamCenter("RAW","MT",64,-8.7)
168        V_RescaleToBeamCenter("RAW","MR",-8.1,64)
169        V_RescaleToBeamCenter("RAW","ML",55,64)
170        V_RescaleToBeamCenter("RAW","FL",55,64)
171        V_RescaleToBeamCenter("RAW","FR",-8.1,64)
172        V_RescaleToBeamCenter("RAW","FT",64,-8.7)
173        V_RescaleToBeamCenter("RAW","FB",64,55)
174       
175        return(0)
176End
Note: See TracBrowser for help on using the repository browser.