1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | #pragma version=5.0 |
---|
3 | #pragma IgorVersion=6.1 |
---|
4 | |
---|
5 | // |
---|
6 | // SRK modified 30 JAN07 to include Rotation angle, Temperature, and B-field in the table (at the end) |
---|
7 | // |
---|
8 | |
---|
9 | //************** |
---|
10 | // Vers 1.2 090401 |
---|
11 | // |
---|
12 | // Procedures for creating the Catalog listings of the SANS datafiles in the folder |
---|
13 | // specified by catPathName. |
---|
14 | // Header information from each of the dataifles is organized in a table for |
---|
15 | // easy identification of each file. CatVSTable is the preferred invocation, |
---|
16 | // although CatVSNotebook and CatNotebook can also be used. |
---|
17 | // Files in the folder that are not RAW SANS data are appended to the end of the listing. |
---|
18 | //************** |
---|
19 | |
---|
20 | //this main procedure does all the work, obtaining the folder path, |
---|
21 | //parsing the filenames in the list and (dispatching) to write out the |
---|
22 | //appropriate information to the notebook window |
---|
23 | Function BuildCatVeryShortTable() |
---|
24 | |
---|
25 | Variable err |
---|
26 | Variable t1 = ticks |
---|
27 | |
---|
28 | PathInfo catPathName |
---|
29 | if(v_flag==0) |
---|
30 | err = PickPath() //sets the local path to the data (catPathName) |
---|
31 | if(err) |
---|
32 | Abort "no path to data was selected, no catalog can be made - use PickPath button" |
---|
33 | Endif |
---|
34 | Endif |
---|
35 | |
---|
36 | DoWindow/F CatVSTable |
---|
37 | |
---|
38 | Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Filenames" |
---|
39 | Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Suffix" |
---|
40 | Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Labels" |
---|
41 | Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:DateAndTime" |
---|
42 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:SDD" |
---|
43 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Lambda" |
---|
44 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:CntTime" |
---|
45 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:TotCnts" |
---|
46 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:CntRate" |
---|
47 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Transmission" |
---|
48 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Thickness" |
---|
49 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:XCenter" |
---|
50 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:YCenter" |
---|
51 | // Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
52 | // Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
53 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
54 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
55 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RunNumber" |
---|
56 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:IsTrans" |
---|
57 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RotAngle" |
---|
58 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Temperature" |
---|
59 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Field" |
---|
60 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 |
---|
61 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Pos" //added Mar 2010 |
---|
62 | //For ANSTO |
---|
63 | Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:SICS" |
---|
64 | Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:HDF" |
---|
65 | |
---|
66 | Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Reactorpower" //only used for for ILL, June 2008, |
---|
67 | WAVE ReactorPower = $"root:myGlobals:CatVSHeaderInfo:Reactorpower" |
---|
68 | |
---|
69 | WAVE/T Filenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" |
---|
70 | WAVE/T Suffix = $"root:myGlobals:CatVSHeaderInfo:Suffix" |
---|
71 | WAVE/T Labels = $"root:myGlobals:CatVSHeaderInfo:Labels" |
---|
72 | WAVE/T DateAndTime = $"root:myGlobals:CatVSHeaderInfo:DateAndTime" |
---|
73 | WAVE SDD = $"root:myGlobals:CatVSHeaderInfo:SDD" |
---|
74 | WAVE Lambda = $"root:myGlobals:CatVSHeaderInfo:Lambda" |
---|
75 | WAVE CntTime = $"root:myGlobals:CatVSHeaderInfo:CntTime" |
---|
76 | WAVE TotCnts = $"root:myGlobals:CatVSHeaderInfo:TotCnts" |
---|
77 | WAVE CntRate = $"root:myGlobals:CatVSHeaderInfo:CntRate" |
---|
78 | WAVE Transmission = $"root:myGlobals:CatVSHeaderInfo:Transmission" |
---|
79 | WAVE Thickness = $"root:myGlobals:CatVSHeaderInfo:Thickness" |
---|
80 | WAVE XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" |
---|
81 | WAVE YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" |
---|
82 | // WAVE/B nGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
83 | // WAVE/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
84 | WAVE nGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
85 | WAVE NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
86 | WAVE RunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" |
---|
87 | WAVE IsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" |
---|
88 | WAVE RotAngle = $"root:myGlobals:CatVSHeaderInfo:RotAngle" |
---|
89 | WAVE Temperature = $"root:myGlobals:CatVSHeaderInfo:Temperature" |
---|
90 | WAVE Field = $"root:myGlobals:CatVSHeaderInfo:Field" |
---|
91 | WAVE MCR = $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 |
---|
92 | WAVE Pos = $"root:myGlobals:CatVSHeaderInfo:Pos" |
---|
93 | //For ANSTO |
---|
94 | WAVE SICS = $"root:myGlobals:CatVSHeaderInfo:SICS" |
---|
95 | WAVE HDF = $"root:myGlobals:CatVSHeaderInfo:HDF" |
---|
96 | |
---|
97 | If(V_Flag==0) |
---|
98 | BuildTableWindow() |
---|
99 | ModifyTable width(:myGlobals:CatVSHeaderInfo:SDD)=40 |
---|
100 | ModifyTable width(:myGlobals:CatVSHeaderInfo:Lambda)=40 |
---|
101 | ModifyTable width(:myGlobals:CatVSHeaderInfo:CntTime)=50 |
---|
102 | ModifyTable width(:myGlobals:CatVSHeaderInfo:TotCnts)=60 |
---|
103 | ModifyTable width(:myGlobals:CatVSHeaderInfo:CntRate)=60 |
---|
104 | ModifyTable width(:myGlobals:CatVSHeaderInfo:Transmission)=40 |
---|
105 | ModifyTable width(:myGlobals:CatVSHeaderInfo:Thickness)=40 |
---|
106 | ModifyTable width(:myGlobals:CatVSHeaderInfo:XCenter)=40 |
---|
107 | ModifyTable width(:myGlobals:CatVSHeaderInfo:YCenter)=40 |
---|
108 | ModifyTable width(:myGlobals:CatVSHeaderInfo:NumAttens)=30 |
---|
109 | ModifyTable width(:myGlobals:CatVSHeaderInfo:RotAngle)=50 |
---|
110 | ModifyTable width(:myGlobals:CatVSHeaderInfo:Field)=50 |
---|
111 | ModifyTable width(:myGlobals:CatVSHeaderInfo:MCR)=50 |
---|
112 | #if (exists("QUOKKA")==6) |
---|
113 | //ANSTO |
---|
114 | ModifyTable width(:myGlobals:CatVSHeaderInfo:SICS)=80 |
---|
115 | ModifyTable width(:myGlobals:CatVSHeaderInfo:HDF)=40 |
---|
116 | #endif |
---|
117 | |
---|
118 | #if (exists("ILL_D22")==6) |
---|
119 | ModifyTable width(:myGlobals:CatVSHeaderInfo:Reactorpower)=50 //activate for ILL, June 2008 |
---|
120 | #endif |
---|
121 | |
---|
122 | #if (exists("NCNR")==6) |
---|
123 | ModifyTable width(:myGlobals:CatVSHeaderInfo:nGuides)=40 |
---|
124 | ModifyTable width(:myGlobals:CatVSHeaderInfo:Pos)=30 |
---|
125 | ModifyTable sigDigits(:myGlobals:CatVSHeaderInfo:Pos)=3 //to make the display look nice, given the floating point values from ICE |
---|
126 | ModifyTable sigDigits(:myGlobals:CatVSHeaderInfo:Lambda)=3 //may not work in all situations, but an improvement |
---|
127 | ModifyTable sigDigits(:myGlobals:CatVSHeaderInfo:SDD)=5 |
---|
128 | ModifyTable trailingZeros(:myGlobals:CatVSHeaderInfo:Temperature)=1 |
---|
129 | ModifyTable sigDigits(:myGlobals:CatVSHeaderInfo:Temperature)=4 |
---|
130 | #endif |
---|
131 | |
---|
132 | ModifyTable width(Point)=0 //JUN04, remove point numbers - confuses users since point != run |
---|
133 | Endif |
---|
134 | |
---|
135 | //get a list of all files in the folder, some will be junk version numbers that don't exist |
---|
136 | String list,partialName,tempName,temp="" |
---|
137 | list = IndexedFile(catPathName,-1,"????") //get all files in folder |
---|
138 | Variable numitems,ii,ok |
---|
139 | |
---|
140 | //remove version numbers from semicolon-delimited list |
---|
141 | list = RemoveVersNumsFromList(list) |
---|
142 | numitems = ItemsInList(list,";") |
---|
143 | |
---|
144 | //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS |
---|
145 | //***version numbers have been removed*** |
---|
146 | String str,fullName |
---|
147 | Variable lastPoint |
---|
148 | ii=0 |
---|
149 | |
---|
150 | Make/T/O/N=0 notRAWlist |
---|
151 | do |
---|
152 | |
---|
153 | //get current item in the list |
---|
154 | partialName = StringFromList(ii, list, ";") |
---|
155 | //get a valid file based on this partialName and catPathName |
---|
156 | tempName = FindValidFilename(partialName) |
---|
157 | |
---|
158 | |
---|
159 | If(cmpstr(tempName,"")==0) //a null string was returned |
---|
160 | //write to notebook that file was not found |
---|
161 | //if string is not a number, report the error |
---|
162 | if(numtype(str2num(partialName)) == 2) |
---|
163 | str = "this file was not found: "+partialName+"\r\r" |
---|
164 | //Notebook CatWin,font="Times",fsize=12,text=str |
---|
165 | Endif |
---|
166 | else |
---|
167 | //prepend path to tempName for read routine |
---|
168 | PathInfo catPathName |
---|
169 | FullName = S_path + tempName |
---|
170 | //make sure the file is really a RAW data file |
---|
171 | ok = CheckIfRawData(fullName) |
---|
172 | |
---|
173 | if (!ok) |
---|
174 | //write to notebook that file was not a RAW SANS file |
---|
175 | lastPoint = numpnts(notRAWlist) |
---|
176 | InsertPoints lastPoint,1,notRAWlist |
---|
177 | notRAWlist[lastPoint]=tempname |
---|
178 | else |
---|
179 | //go write the header information to the Notebook |
---|
180 | GetHeaderInfoToWave(fullName,tempName) |
---|
181 | Endif |
---|
182 | Endif |
---|
183 | ii+=1 |
---|
184 | while(ii<numitems) |
---|
185 | //Now sort them all based on some criterion that may be facility dependent (aim is to order them as collected) |
---|
186 | SortWaves() |
---|
187 | //Append the files that are not raw files to the list |
---|
188 | AppendNotRAWFiles(notRAWlist) |
---|
189 | KillWaves/Z notRAWlist |
---|
190 | // |
---|
191 | // Print "Total time (s) = ",(ticks - t1)/60.15 |
---|
192 | // Print "Time per raw data file (s) = ",(ticks - t1)/60.15/(numItems-numpnts(notRawList)) |
---|
193 | return(0) |
---|
194 | End |
---|
195 | |
---|
196 | //appends the list of files that are not RAW SANS data to the filename wave (1st column) |
---|
197 | //for display in the table. Note that the filenames column will now be longer than all other |
---|
198 | //waves in the table |
---|
199 | Function AppendNotRAWFiles(w) |
---|
200 | Wave/T w |
---|
201 | Wave/T Filenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" |
---|
202 | Variable lastPoint |
---|
203 | lastPoint = numpnts(Filenames) |
---|
204 | InsertPoints lastPoint,numpnts(w),Filenames |
---|
205 | Filenames[lastPoint,numpnts(Filenames)-1] = w[p-lastPoint] |
---|
206 | return(0) |
---|
207 | End |
---|
208 | |
---|
209 | //sorts all of the waves of header information using the suffix (A123) |
---|
210 | //the result is that all of the data is in the order that it was collected, |
---|
211 | // regardless of how the prefix or run numbers were changed by the user |
---|
212 | Function SortWaves() |
---|
213 | Wave/T GFilenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" |
---|
214 | Wave/T GSuffix = $"root:myGlobals:CatVSHeaderInfo:Suffix" |
---|
215 | Wave/T GLabels = $"root:myGlobals:CatVSHeaderInfo:Labels" |
---|
216 | Wave/T GDateTime = $"root:myGlobals:CatVSHeaderInfo:DateAndTime" |
---|
217 | Wave GSDD = $"root:myGlobals:CatVSHeaderInfo:SDD" |
---|
218 | Wave GLambda = $"root:myGlobals:CatVSHeaderInfo:Lambda" |
---|
219 | Wave GCntTime = $"root:myGlobals:CatVSHeaderInfo:CntTime" |
---|
220 | Wave GTotCnts = $"root:myGlobals:CatVSHeaderInfo:TotCnts" |
---|
221 | Wave GCntRate = $"root:myGlobals:CatVSHeaderInfo:CntRate" |
---|
222 | Wave GTransmission = $"root:myGlobals:CatVSHeaderInfo:Transmission" |
---|
223 | Wave GThickness = $"root:myGlobals:CatVSHeaderInfo:Thickness" |
---|
224 | Wave GXCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" |
---|
225 | Wave GYCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" |
---|
226 | // Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
227 | // Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
228 | Wave GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
229 | Wave GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
230 | Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" |
---|
231 | Wave GIsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" |
---|
232 | Wave GRot = $"root:myGlobals:CatVSHeaderInfo:RotAngle" |
---|
233 | Wave GTemp = $"root:myGlobals:CatVSHeaderInfo:Temperature" |
---|
234 | Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" |
---|
235 | Wave GMCR = $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 |
---|
236 | Wave GPos = $"root:myGlobals:CatVSHeaderInfo:Pos" |
---|
237 | Wave/Z GReactPow = $"root:myGlobals:CatVSHeaderInfo:ReactorPower" //activate for ILL June 2008 ( and the sort line too) |
---|
238 | //For ANSTO |
---|
239 | Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS" |
---|
240 | Wave/T GHDF = $"root:myGlobals:CatVSHeaderInfo:HDF" |
---|
241 | |
---|
242 | #if (exists("ILL_D22")==6) |
---|
243 | Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GReactPow |
---|
244 | #elif (exists("NCNR")==6) |
---|
245 | // Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR |
---|
246 | Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GPos,gNumGuides |
---|
247 | #elif (exists("QUOKKA")==6) |
---|
248 | //ANSTO |
---|
249 | Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR, GSICS, GHDF |
---|
250 | #else |
---|
251 | // Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR |
---|
252 | Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR |
---|
253 | #endif |
---|
254 | |
---|
255 | |
---|
256 | return(0) |
---|
257 | End |
---|
258 | |
---|
259 | //function to create the CAT/VSTable to display the header information |
---|
260 | //this table is just like any other table |
---|
261 | Function BuildTableWindow() |
---|
262 | Wave/T Filenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" |
---|
263 | Wave/T Labels = $"root:myGlobals:CatVSHeaderInfo:Labels" |
---|
264 | Wave/T DateAndTime = $"root:myGlobals:CatVSHeaderInfo:DateAndTime" |
---|
265 | Wave SDD = $"root:myGlobals:CatVSHeaderInfo:SDD" |
---|
266 | Wave Lambda = $"root:myGlobals:CatVSHeaderInfo:Lambda" |
---|
267 | Wave CntTime = $"root:myGlobals:CatVSHeaderInfo:CntTime" |
---|
268 | Wave TotCnts = $"root:myGlobals:CatVSHeaderInfo:TotCnts" |
---|
269 | Wave CntRate = $"root:myGlobals:CatVSHeaderInfo:CntRate" |
---|
270 | Wave Transmission = $"root:myGlobals:CatVSHeaderInfo:Transmission" |
---|
271 | Wave Thickness = $"root:myGlobals:CatVSHeaderInfo:Thickness" |
---|
272 | Wave XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" |
---|
273 | Wave YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" |
---|
274 | // Wave/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
275 | // Wave/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
276 | Wave NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
277 | Wave NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
278 | Wave RotAngle = $"root:myGlobals:CatVSHeaderInfo:RotAngle" |
---|
279 | Wave Temperature = $"root:myGlobals:CatVSHeaderInfo:Temperature" |
---|
280 | Wave Field= $"root:myGlobals:CatVSHeaderInfo:Field" |
---|
281 | Wave MCR = $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 |
---|
282 | Wave Pos = $"root:myGlobals:CatVSHeaderInfo:Pos" |
---|
283 | Wave/Z ReactorPower = $"root:myGlobals:CatVSHeaderInfo:reactorpower" //activate for ILL, June 08 (+ edit line) |
---|
284 | Wave/Z SICS = $"root:myGlobals:CatVSHeaderInfo:SICS" // For ANSTO June 2010 |
---|
285 | Wave/Z HDF = $"root:myGlobals:CatVSHeaderInfo:HDF" // For ANSTO June 2010 |
---|
286 | |
---|
287 | #if (exists("ILL_D22")==6) |
---|
288 | Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR, ReactorPower as "Data File Catalog" |
---|
289 | #elif (exists("NCNR")==6) |
---|
290 | // original order, magnetic at the end |
---|
291 | // Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" |
---|
292 | // with numGuides |
---|
293 | Edit Filenames, Labels, DateAndTime, SDD, Lambda, numGuides, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR, Pos as "Data File Catalog" |
---|
294 | // alternate ordering, put the magnetic information first |
---|
295 | // Edit Filenames, Labels, RotAngle, Temperature, Field, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Data File Catalog" |
---|
296 | #elif (exists("QUOKKA")==6) |
---|
297 | //ANSTO |
---|
298 | Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR,SICS, HDF as "Data File Catalog" |
---|
299 | #else |
---|
300 | // HFIR or anything else |
---|
301 | Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" |
---|
302 | #endif |
---|
303 | |
---|
304 | String name="CatVSTable" |
---|
305 | DoWindow/C $name |
---|
306 | return(0) |
---|
307 | End |
---|
308 | |
---|
309 | //reads header information and puts it in the appropriate waves for display in the table. |
---|
310 | //fname is the full path for opening (and reading) information from the file |
---|
311 | //which alreay was found to exist. sname is the file;vers to be written out, |
---|
312 | //avoiding the need to re-extract it from fname. |
---|
313 | Function GetHeaderInfoToWave(fname,sname) |
---|
314 | String fname,sname |
---|
315 | |
---|
316 | // String textstr,temp,lbl,date_time,suffix |
---|
317 | // Variable ,lambda,sdd,,refNum,trans,thick,xcenter,ycenter,numatten |
---|
318 | // Variable lastPoint, beamstop,dum |
---|
319 | Variable lastPoint,ctime,detcnt,cntrate//,instrumentNum |
---|
320 | |
---|
321 | Wave/T GFilenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" |
---|
322 | Wave/T GSuffix = $"root:myGlobals:CatVSHeaderInfo:Suffix" |
---|
323 | Wave/T GLabels = $"root:myGlobals:CatVSHeaderInfo:Labels" |
---|
324 | Wave/T GDateTime = $"root:myGlobals:CatVSHeaderInfo:DateAndTime" |
---|
325 | //ANSTO |
---|
326 | Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS" |
---|
327 | Wave/T GHDF = $"root:myGlobals:CatVSHeaderInfo:HDF" |
---|
328 | //END ANSTO |
---|
329 | Wave GSDD = $"root:myGlobals:CatVSHeaderInfo:SDD" |
---|
330 | Wave GLambda = $"root:myGlobals:CatVSHeaderInfo:Lambda" |
---|
331 | Wave GCntTime = $"root:myGlobals:CatVSHeaderInfo:CntTime" |
---|
332 | Wave GTotCnts = $"root:myGlobals:CatVSHeaderInfo:TotCnts" |
---|
333 | Wave GCntRate = $"root:myGlobals:CatVSHeaderInfo:CntRate" |
---|
334 | Wave GTransmission = $"root:myGlobals:CatVSHeaderInfo:Transmission" |
---|
335 | Wave GThickness = $"root:myGlobals:CatVSHeaderInfo:Thickness" |
---|
336 | Wave GXCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" |
---|
337 | Wave GYCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" |
---|
338 | // Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
339 | // Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
340 | Wave GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" |
---|
341 | Wave GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" |
---|
342 | Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" |
---|
343 | Wave GIsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" |
---|
344 | Wave GRot = $"root:myGlobals:CatVSHeaderInfo:RotAngle" |
---|
345 | Wave GTemp = $"root:myGlobals:CatVSHeaderInfo:Temperature" |
---|
346 | Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" |
---|
347 | Wave GMCR = $"root:myGlobals:CatVSHeaderInfo:MCR" |
---|
348 | Wave GPos = $"root:myGlobals:CatVSHeaderInfo:Pos" |
---|
349 | Wave GReactpow = $"root:myGlobals:CatVSHeaderInfo:reactorpower" //activate for ILL, Jne 2008, (+ last insert @ end of function) |
---|
350 | |
---|
351 | lastPoint = numpnts(GLambda) |
---|
352 | |
---|
353 | //filename |
---|
354 | InsertPoints lastPoint,1,GFilenames |
---|
355 | GFilenames[lastPoint]=sname |
---|
356 | |
---|
357 | //read the file alphanumeric suffix |
---|
358 | InsertPoints lastPoint,1,GSuffix |
---|
359 | GSuffix[lastPoint]=getSuffix(fname) |
---|
360 | |
---|
361 | //read the counting time (integer) |
---|
362 | InsertPoints lastPoint,1,GCntTime |
---|
363 | ctime = getCountTime(fname) |
---|
364 | GCntTime[lastPoint]=ctime |
---|
365 | |
---|
366 | //read the file creation date |
---|
367 | InsertPoints lastPoint,1,GDateTime |
---|
368 | GDateTime[lastPoint]=getFileCreationDate(fname) |
---|
369 | |
---|
370 | // read the sample.label text field |
---|
371 | InsertPoints lastPoint,1,GLabels |
---|
372 | GLabels[lastPoint]=getSampleLabel(fname) |
---|
373 | |
---|
374 | #if (exists("QUOKKA")==6) |
---|
375 | InsertPoints lastPoint,1,GSICS |
---|
376 | GSICS[lastPoint]=getSICSVersion(fname) |
---|
377 | |
---|
378 | //read the HDF version |
---|
379 | InsertPoints lastPoint,1,GHDF |
---|
380 | GHDF[lastPoint]=getHDFVersion(fname) |
---|
381 | #endif |
---|
382 | |
---|
383 | //read the reals |
---|
384 | //detector count and (derived) count rate |
---|
385 | detcnt = getDetCount(fname) |
---|
386 | cntrate = detcnt/ctime |
---|
387 | InsertPoints lastPoint,1,GTotCnts |
---|
388 | GTotCnts[lastPoint]=detcnt |
---|
389 | InsertPoints lastPoint,1,GCntRate |
---|
390 | GCntRate[lastPoint]=cntrate |
---|
391 | |
---|
392 | //Attenuators |
---|
393 | InsertPoints lastPoint,1,GNumAttens |
---|
394 | GNumAttens[lastPoint]=getAttenNumber(fname) |
---|
395 | |
---|
396 | //Transmission |
---|
397 | InsertPoints lastPoint,1,GTransmission |
---|
398 | GTransmission[lastPoint]=getSampleTrans(fname) |
---|
399 | |
---|
400 | //Thickness |
---|
401 | InsertPoints lastPoint,1,GThickness |
---|
402 | GThickness[lastPoint]=getSampleThickness(fname) |
---|
403 | |
---|
404 | //XCenter of beam on detector |
---|
405 | InsertPoints lastPoint,1,GXCenter |
---|
406 | GXCenter[lastPoint]=getBeamXPos(fname) |
---|
407 | |
---|
408 | //YCenter |
---|
409 | InsertPoints lastPoint,1,GYCenter |
---|
410 | GYCenter[lastPoint]=getBeamYPos(fname) |
---|
411 | |
---|
412 | //SDD |
---|
413 | InsertPoints lastPoint,1,GSDD |
---|
414 | GSDD[lastPoint]=getSDD(fname) |
---|
415 | |
---|
416 | //wavelength |
---|
417 | InsertPoints lastPoint,1,GLambda |
---|
418 | GLambda[lastPoint]=getWavelength(fname) |
---|
419 | |
---|
420 | //Rotation Angle |
---|
421 | InsertPoints lastPoint,1,GRot |
---|
422 | GRot[lastPoint]=getSampleRotationAngle(fname) |
---|
423 | |
---|
424 | //Sample Temperature |
---|
425 | InsertPoints lastPoint,1,GTemp |
---|
426 | GTemp[lastPoint]=getTemperature(fname) |
---|
427 | |
---|
428 | //Sample Field |
---|
429 | InsertPoints lastPoint,1,GField |
---|
430 | GField[lastPoint]=getFieldStrength(fname) |
---|
431 | |
---|
432 | //Beamstop position (not reported) |
---|
433 | //strToExecute = GBLoadStr + "/S=368/U=1" + "\"" + fname + "\"" |
---|
434 | |
---|
435 | //the run number (not displayed in the table, but carried along) |
---|
436 | InsertPoints lastPoint,1,GRunNumber |
---|
437 | GRunNumber[lastPoint] = GetRunNumFromFile(sname) |
---|
438 | |
---|
439 | // 0 if the file is a scattering file, 1 (truth) if the file is a transmission file |
---|
440 | InsertPoints lastPoint,1,GIsTrans |
---|
441 | GIsTrans[lastPoint] = isTransFile(fname) //returns one if beamstop is "out" |
---|
442 | |
---|
443 | // Monitor Count Rate |
---|
444 | InsertPoints lastPoint,1,GMCR |
---|
445 | GMCR[lastPoint] = getMonitorCount(fname)/ctime //total monitor count / total count time |
---|
446 | |
---|
447 | |
---|
448 | |
---|
449 | #if (exists("ILL_D22")==6) |
---|
450 | // Reactor Power (activate for ILL) |
---|
451 | InsertPoints lastPoint,1,GReactpow |
---|
452 | GReactPow[lastPoint] = getReactorPower(fname) |
---|
453 | #endif |
---|
454 | |
---|
455 | // number of guides and sample position, only for NCNR |
---|
456 | #if (exists("NCNR")==6) |
---|
457 | // instrumentNum = str2num(getAcctName(fname)[3]) // "[NGxSANSxx]" -- [3] should be then instrument number |
---|
458 | // Variable/G root:Packages:NIST:SAS:instrument = instrumentNum //so that Ng can be correctly calculated |
---|
459 | |
---|
460 | // acct name is "[NGxSANSxx]" -- [1,3] is the instrument "name" "NGx" |
---|
461 | //so that Ng can be correctly calculated |
---|
462 | String/G root:Packages:NIST:SAS:gInstStr = getAcctName(fname)[1,3] |
---|
463 | |
---|
464 | InsertPoints lastPoint,1,GNumGuides |
---|
465 | GNumGuides[lastPoint] = numGuides(getSourceToSampleDist(fname)) |
---|
466 | |
---|
467 | //Sample Position |
---|
468 | InsertPoints lastPoint,1,GPos |
---|
469 | GPos[lastPoint] = getSamplePosition(fname) |
---|
470 | #endif |
---|
471 | |
---|
472 | return(0) |
---|
473 | End |
---|
474 | |
---|
475 | |
---|
476 | //this main procedure does all the work for making the cat notebook, |
---|
477 | // obtaining the folder path, parsing the filenames in the list, |
---|
478 | // and (dispatching) to write out the appropriate information to the notebook window |
---|
479 | Proc BuildCatShortNotebook() |
---|
480 | |
---|
481 | DoWindow/F CatWin |
---|
482 | If(V_Flag ==0) |
---|
483 | String nb = "CatWin" |
---|
484 | NewNotebook/F=1/N=$nb/W=(5.25,40.25,581.25,380.75) as "CATALOG Window" |
---|
485 | Notebook $nb defaultTab=36, statusWidth=238, pageMargins={72,72,72,72} |
---|
486 | Notebook $nb showRuler=1, rulerUnits=1, updating={1, 60} |
---|
487 | Notebook $nb newRuler=Normal, justification=0, margins={0,0,468}, spacing={0,0,0}, tabs={} |
---|
488 | Notebook $nb ruler=Normal; Notebook $nb margins={0,0,544} |
---|
489 | Endif |
---|
490 | |
---|
491 | Variable err |
---|
492 | PathInfo catPathName |
---|
493 | if(v_flag==0) |
---|
494 | err = PickPath() //sets the local path to the data (catPathName) |
---|
495 | if(err) |
---|
496 | Abort "no path to data was selected, no catalog can be made - use PickPath button" |
---|
497 | Endif |
---|
498 | Endif |
---|
499 | |
---|
500 | String temp="" |
---|
501 | //clear old window contents, reset the path |
---|
502 | Notebook CatWin,selection={startOfFile,EndOfFile} |
---|
503 | Notebook CatWin,text="\r" |
---|
504 | |
---|
505 | PathInfo catPathName |
---|
506 | temp = "FOLDER: "+S_path+"\r\r" |
---|
507 | Notebook CatWin,font="Times",fsize=12,text = temp |
---|
508 | |
---|
509 | //get a list of all files in the folder, some will be junk version numbers that don't exist |
---|
510 | String list,partialName,tempName |
---|
511 | list = IndexedFile(catPathName,-1,"????") //get all files in folder |
---|
512 | Variable numitems,ii,ok |
---|
513 | |
---|
514 | //remove version numbers from semicolon-delimited list |
---|
515 | list = RemoveVersNumsFromList(list) |
---|
516 | |
---|
517 | numitems = ItemsInList(list,";") |
---|
518 | |
---|
519 | //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS |
---|
520 | //***version numbers have been removed*** |
---|
521 | String str,fullName,notRAWlist |
---|
522 | ii=0 |
---|
523 | notRAWlist = "" |
---|
524 | do |
---|
525 | //get current item in the list |
---|
526 | partialName = StringFromList(ii, list, ";") |
---|
527 | //get a valid file based on this partialName and catPathName |
---|
528 | tempName = FindValidFilename(partialName) |
---|
529 | If(cmpstr(tempName,"")==0) //a null string was returned |
---|
530 | //write to notebook that file was not found |
---|
531 | //if string is not a number, report the error |
---|
532 | if(numtype(str2num(partialName)) == 2) |
---|
533 | str = "this file was not found: "+partialName+"\r\r" |
---|
534 | Notebook CatWin,font="Times",fsize=12,text=str |
---|
535 | Endif |
---|
536 | else |
---|
537 | //prepend path to tempName for read routine |
---|
538 | PathInfo catPathName |
---|
539 | FullName = S_path + tempName |
---|
540 | //make sure the file is really a RAW data file |
---|
541 | ok = CheckIfRawData(fullName) |
---|
542 | if (!ok) |
---|
543 | //write to notebook that file was not a RAW SANS file |
---|
544 | notRAWlist += "This file is not recognized as a RAW SANS data file: "+tempName+"\r" |
---|
545 | //Notebook CatWin,font="Times",fsize=12,text=str |
---|
546 | else |
---|
547 | //go write the header information to the Notebook |
---|
548 | WriteCatToNotebook(fullName,tempName) |
---|
549 | Endif |
---|
550 | Endif |
---|
551 | ii+=1 |
---|
552 | while(ii<numitems) |
---|
553 | Notebook CatWin,font="Times",fsize=12,text=notRAWlist |
---|
554 | End |
---|
555 | |
---|
556 | //writes out the CATalog information to the notebook named CatWin (which must exist) |
---|
557 | //fname is the full path for opening (and reading) information from the file |
---|
558 | //which alreay was found to exist. sname is the file;vers to be written out, |
---|
559 | //avoiding the need to re-extract it from fname. |
---|
560 | Function WriteCatToNotebook(fname,sname) |
---|
561 | String fname,sname |
---|
562 | |
---|
563 | String textstr,temp,lbl,date_time |
---|
564 | Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick |
---|
565 | |
---|
566 | //read the file creation date |
---|
567 | date_time = getFileCreationDate(fname) |
---|
568 | |
---|
569 | // read the sample.label text field |
---|
570 | lbl = getSampleLabel(fname) |
---|
571 | |
---|
572 | //read the counting time (integer) |
---|
573 | ctime = getCountTime(fname) |
---|
574 | |
---|
575 | //read the reals |
---|
576 | |
---|
577 | //detector count + countrate |
---|
578 | detcnt = getDetCount(fname) |
---|
579 | cntrate = detcnt/ctime |
---|
580 | |
---|
581 | //wavelength |
---|
582 | lambda = getWavelength(fname) |
---|
583 | |
---|
584 | //SDD |
---|
585 | sdd = getSDD(fname) |
---|
586 | |
---|
587 | //Transmission |
---|
588 | trans = getSampleTrans(fname) |
---|
589 | |
---|
590 | //Thickness |
---|
591 | thick = getSampleThickness(fname) |
---|
592 | |
---|
593 | temp = "FILE: " |
---|
594 | Notebook CatWin,textRGB=(0,0,0),text=temp |
---|
595 | Notebook CatWin,fstyle=1,text=sname |
---|
596 | temp = "\t\t"+date_time+"\r" |
---|
597 | Notebook CatWin,fstyle=0,text=temp |
---|
598 | temp = "LABEL: "+lbl+"\r" |
---|
599 | Notebook CatWin,text=temp |
---|
600 | temp = "COUNTING TIME: "+num2str(ctime)+" secs \t\tDETECTOR COUNT: "+num2str(detcnt)+"\r" |
---|
601 | Notebook CatWin,text=temp |
---|
602 | temp = "WAVELENGTH: "+num2str(lambda)+" A \tSDD: "+num2str(sdd)+" m \t" |
---|
603 | temp += "DET. CNT. RATE: "+num2str(cntrate)+" cts/sec\r" |
---|
604 | Notebook CatWin,text=temp |
---|
605 | temp = "TRANS: " |
---|
606 | Notebook CatWin,text=temp |
---|
607 | temp = num2str(trans) |
---|
608 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
609 | temp = "\t\tTHICKNESS: " |
---|
610 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
611 | temp = num2str(thick) |
---|
612 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
613 | temp = " cm\r\r" |
---|
614 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
615 | End |
---|
616 | |
---|
617 | //writes out the CATalog information to the notebook named CatWin (which must exist) |
---|
618 | //fname is the full path for opening (and reading) information from the file |
---|
619 | //which alreay was found to exist. sname is the file;vers to be written out, |
---|
620 | //avoiding the need to re-extract it from fname. |
---|
621 | // |
---|
622 | // this is just for 1D (not Raw) data files |
---|
623 | Function Write_ABSHeader_toNotebook(fname,sname) |
---|
624 | String fname,sname |
---|
625 | |
---|
626 | String textstr,temp,lbl,date_time |
---|
627 | Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick |
---|
628 | |
---|
629 | //read the file creation date |
---|
630 | date_time = getFileCreationDate(fname) |
---|
631 | |
---|
632 | // read the sample.label text field |
---|
633 | lbl = getSampleLabel(fname) |
---|
634 | |
---|
635 | //read the counting time (integer) |
---|
636 | ctime = getCountTime(fname) |
---|
637 | |
---|
638 | //read the reals |
---|
639 | |
---|
640 | //detector count + countrate |
---|
641 | detcnt = getDetCount(fname) |
---|
642 | cntrate = detcnt/ctime |
---|
643 | |
---|
644 | //wavelength |
---|
645 | lambda = getWavelength(fname) |
---|
646 | |
---|
647 | //SDD |
---|
648 | sdd = getSDD(fname) |
---|
649 | |
---|
650 | //Transmission |
---|
651 | trans = getSampleTrans(fname) |
---|
652 | |
---|
653 | //Thickness |
---|
654 | thick = getSampleThickness(fname) |
---|
655 | |
---|
656 | temp = "FILE: " |
---|
657 | Notebook CatWin,textRGB=(0,0,0),text=temp |
---|
658 | Notebook CatWin,fstyle=1,text=sname |
---|
659 | temp = "\t\t"+date_time+"\r" |
---|
660 | Notebook CatWin,fstyle=0,text=temp |
---|
661 | temp = "LABEL: "+lbl+"\r" |
---|
662 | Notebook CatWin,text=temp |
---|
663 | temp = "COUNTING TIME: "+num2str(ctime)+" secs \t\tDETECTOR COUNT: "+num2str(detcnt)+"\r" |
---|
664 | Notebook CatWin,text=temp |
---|
665 | temp = "WAVELENGTH: "+num2str(lambda)+" A \tSDD: "+num2str(sdd)+" m \t" |
---|
666 | temp += "DET. CNT. RATE: "+num2str(cntrate)+" cts/sec\r" |
---|
667 | Notebook CatWin,text=temp |
---|
668 | temp = "TRANS: " |
---|
669 | Notebook CatWin,text=temp |
---|
670 | temp = num2str(trans) |
---|
671 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
672 | temp = "\t\tTHICKNESS: " |
---|
673 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
674 | temp = num2str(thick) |
---|
675 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
676 | temp = " cm\r\r" |
---|
677 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
678 | End |
---|
679 | |
---|
680 | |
---|
681 | //**************** |
---|
682 | // main procedure for CAT/VS Notebook ****** |
---|
683 | //this main procedure does all the work, obtaining the folder path, |
---|
684 | //parsing the filenames in the list and (dispatching) to write out the |
---|
685 | //appropriate information to the notebook window |
---|
686 | Proc BuildCatVeryShortNotebook() |
---|
687 | |
---|
688 | DoWindow/F CatWin |
---|
689 | If(V_Flag ==0) |
---|
690 | String nb = "CatWin" |
---|
691 | NewNotebook/F=1/N=$nb/W=(5.25,40.25,581.25,380.75) as "CATALOG Window" |
---|
692 | Notebook $nb defaultTab=36, statusWidth=238, pageMargins={72,72,72,72} |
---|
693 | Notebook $nb showRuler=1, rulerUnits=1, updating={1, 60} |
---|
694 | Notebook $nb newRuler=Normal, justification=0, margins={0,0,468}, spacing={0,0,0}, tabs={} |
---|
695 | Notebook $nb ruler=Normal; Notebook $nb margins={0,0,544} |
---|
696 | Endif |
---|
697 | |
---|
698 | Variable err |
---|
699 | PathInfo catPathName |
---|
700 | if(v_flag==0) |
---|
701 | err = PickPath() //sets the local path to the data (catPathName) |
---|
702 | if(err) |
---|
703 | Abort "no path to data was selected, no catalog can be made - use PickPath button" |
---|
704 | Endif |
---|
705 | Endif |
---|
706 | |
---|
707 | String temp="" |
---|
708 | //clear old window contents, reset the path |
---|
709 | Notebook CatWin,selection={startOfFile,EndOfFile} |
---|
710 | Notebook CatWin,text="\r" |
---|
711 | |
---|
712 | PathInfo catPathName |
---|
713 | temp = "FOLDER: "+S_path+"\r\r" |
---|
714 | Notebook CatWin,font="Times",fsize=12,text = temp |
---|
715 | Notebook CatWin,fstyle=1,text="NAME"+", " |
---|
716 | temp = "Label"+", " |
---|
717 | Notebook CatWin,fstyle=0, text=temp |
---|
718 | temp = "CntTime" |
---|
719 | Notebook CatWin,fstyle=1,textRGB=(0,0,50000),text=temp |
---|
720 | temp = ", TotDetCnts, " |
---|
721 | Notebook CatWin,fstyle=0,textRGB=(0,0,0),text=temp |
---|
722 | temp = "Lambda" |
---|
723 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
724 | temp = ", SDD, " |
---|
725 | Notebook CatWin,fstyle=0,textRGB=(0,0,0),text=temp |
---|
726 | temp = "CountRate" |
---|
727 | Notebook CatWin,textRGB=(0,50000,0),fStyle = 1,text=temp |
---|
728 | temp = ", Transmission, " |
---|
729 | Notebook CatWin,fstyle=0,textRGB=(0,0,0),text=temp |
---|
730 | temp = "Thickness" |
---|
731 | Notebook CatWin,textRGB=(0,0,50000),fStyle = 1,text=temp |
---|
732 | temp = ", Xposition" |
---|
733 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
734 | temp = ", Yposition" |
---|
735 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 0,text=temp |
---|
736 | temp = "\r\r" |
---|
737 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
738 | |
---|
739 | |
---|
740 | //get a list of all files in the folder, some will be junk version numbers that don't exist |
---|
741 | String list,partialName,tempName |
---|
742 | list = IndexedFile(catPathName,-1,"????") //get all files in folder |
---|
743 | Variable numitems,ii,ok |
---|
744 | |
---|
745 | //remove version numbers from semicolon-delimited list |
---|
746 | list = RemoveVersNumsFromList(list) |
---|
747 | |
---|
748 | numitems = ItemsInList(list,";") |
---|
749 | |
---|
750 | //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS |
---|
751 | //***version numbers have been removed*** |
---|
752 | String str,fullName,notRAWlist |
---|
753 | ii=0 |
---|
754 | |
---|
755 | notRAWlist="" |
---|
756 | do |
---|
757 | //get current item in the list |
---|
758 | partialName = StringFromList(ii, list, ";") |
---|
759 | //get a valid file based on this partialName and catPathName |
---|
760 | tempName = FindValidFilename(partialName) |
---|
761 | If(cmpstr(tempName,"")==0) //a null string was returned |
---|
762 | //write to notebook that file was not found |
---|
763 | //if string is not a number, report the error |
---|
764 | if(numtype(str2num(partialName)) == 2) |
---|
765 | str = "this file was not found: "+partialName+"\r\r" |
---|
766 | Notebook CatWin,font="Times",fsize=12,text=str |
---|
767 | Endif |
---|
768 | else |
---|
769 | //prepend path to tempName for read routine |
---|
770 | PathInfo catPathName |
---|
771 | FullName = S_path + tempName |
---|
772 | //make sure the file is really a RAW data file |
---|
773 | ok = CheckIfRawData(fullName) |
---|
774 | if (!ok) |
---|
775 | //write to notebook that file was not a RAW SANS file |
---|
776 | notRAWlist += "This file is not recognized as a RAW SANS data file: "+tempName+"\r" |
---|
777 | //Notebook CatWin,font="Times",fsize=12,text=str |
---|
778 | else |
---|
779 | //go write the header information to the Notebook |
---|
780 | WriteCatVSToNotebook(fullName,tempName) |
---|
781 | Endif |
---|
782 | Endif |
---|
783 | ii+=1 |
---|
784 | while(ii<numitems) |
---|
785 | Notebook CatWin,font="Times",fsize=12,text=notRAWlist |
---|
786 | End |
---|
787 | |
---|
788 | //writes out the CATalog information to the notebook named CatWin (which must exist) |
---|
789 | //fname is the full path for opening (and reading) information from the file |
---|
790 | //which alreay was found to exist. sname is the file;vers to be written out, |
---|
791 | //avoiding the need to re-extract it from fname. |
---|
792 | Function WriteCatVSToNotebook(fname,sname) |
---|
793 | String fname,sname |
---|
794 | |
---|
795 | String textstr,temp,lbl,date_time |
---|
796 | Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick,xcenter,ycenter,numatten |
---|
797 | |
---|
798 | //read the file creation date |
---|
799 | date_time = getFileCreationDate(fname) |
---|
800 | |
---|
801 | // read the sample.label text field |
---|
802 | lbl = getSampleLabel(fname) |
---|
803 | |
---|
804 | //read the counting time (integer) |
---|
805 | ctime = getCountTime(fname) |
---|
806 | |
---|
807 | //read the reals |
---|
808 | //detector count + countrate |
---|
809 | detcnt = getDetCount(fname) |
---|
810 | cntrate = detcnt/ctime |
---|
811 | |
---|
812 | //wavelength |
---|
813 | lambda = getWavelength(fname) |
---|
814 | |
---|
815 | //SDD |
---|
816 | sdd = getSDD(fname) |
---|
817 | |
---|
818 | //Transmission |
---|
819 | trans = getSampleTrans(fname) |
---|
820 | |
---|
821 | //Thickness |
---|
822 | thick = getSampleThickness(fname) |
---|
823 | |
---|
824 | //Attenuators |
---|
825 | numatten = getAttenNumber(fname) |
---|
826 | |
---|
827 | //XCenter |
---|
828 | xCenter = getBeamXPos(fname) |
---|
829 | |
---|
830 | //YCenter |
---|
831 | yCenter = getBeamYPos(fname) |
---|
832 | |
---|
833 | |
---|
834 | temp = "" |
---|
835 | Notebook CatWin,textRGB=(0,0,0),text=temp |
---|
836 | Notebook CatWin,fstyle=1,text=sname+", " |
---|
837 | // temp = ", "+date_time+", " |
---|
838 | // Notebook CatWin,fstyle=0,text=temp |
---|
839 | temp = lbl+", " |
---|
840 | Notebook CatWin,fstyle=0, text=temp |
---|
841 | temp = num2str(ctime) |
---|
842 | Notebook CatWin,fstyle=1,textRGB=(0,0,50000),text=temp |
---|
843 | temp = ", " + num2str(detcnt) + ", " |
---|
844 | Notebook CatWin,fstyle=0,textRGB=(0,0,0),text=temp |
---|
845 | temp = num2str(lambda) |
---|
846 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
847 | temp = ", "+num2str(sdd)+", " |
---|
848 | Notebook CatWin,fstyle=0,textRGB=(0,0,0),text=temp |
---|
849 | temp = num2str(cntrate) |
---|
850 | Notebook CatWin,textRGB=(0,50000,0),fStyle = 1,text=temp |
---|
851 | temp = ", "+num2str(trans)+", " |
---|
852 | Notebook CatWin,fstyle=0,textRGB=(0,0,0),text=temp |
---|
853 | temp = num2str(thick) |
---|
854 | Notebook CatWin,textRGB=(0,0,50000),fStyle = 1,text=temp |
---|
855 | temp = ", "+num2str(xCenter)+", " |
---|
856 | Notebook CatWin,textRGB=(0,0,0),fStyle = 0,text=temp |
---|
857 | temp = num2str(yCenter)+"\r" |
---|
858 | Notebook CatWin,textRGB=(50000,0,0),fStyle = 1,text=temp |
---|
859 | //temp = num2str(numatten)+", " |
---|
860 | //Notebook CatWin,text=temp |
---|
861 | End |
---|