source: sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_NXcanSAS.ipf @ 1186

Last change on this file since 1186 was 1186, checked in by krzywon, 3 years ago

Fix issues with processNote, Qdev, and temperature for the VSANS NXcanSAS writer.

File size: 39.7 KB
Line 
1#pragma TextEncoding = "MacRoman"
2#pragma rtGlobals=3             // Use modern global access method and strict wave access.
3
4
5Function V_WriteNXcanSAS1DData(pathStr,folderStr,saveName)
6        String pathStr,folderStr,saveName
7       
8        // Define local function variables
9        String formatStr=""
10        String destStr="", parentBase, nxcansasBase
11        Variable fileID
12        Variable refnum,dialog=1
13        String/G base = "root:V_NXcanSAS_file"
14       
15        NewDataFolder/O/S $(base)
16       
17        SetDataFolder $(pathStr+folderStr)
18       
19        // Check fullpath and dialog
20        if(stringmatch(saveName, ""))
21                fileID = NxCansas_DoSaveFileDialog()
22        else
23                fileID = NxCansas_CreateFile(saveName)
24        Endif
25        if(!fileID)
26                abort "Unable to create file at " + saveName + "."
27        EndIf
28       
29        Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1)
30        sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all
31        sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all
32
33        Wave qw = tmp_q
34        Wave iw = tmp_i
35        Wave sw = tmp_s
36        Wave sigQ = tmp_sq
37        Wave qbar = tmp_qb
38        Wave fs = tmp_fs
39       
40        SVAR gProtoStr = root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr
41        Wave/T proto=$("root:Packages:NIST:VSANS:Globals:Protocols:"+gProtoStr)
42       
43        //make sure the waves exist
44        if(WaveExists(qw) == 0)
45                Abort "q is missing"
46        endif
47        if(WaveExists(iw) == 0)
48                Abort "i is missing"
49        endif
50        if(WaveExists(sw) == 0)
51                Abort "s is missing"
52        endif
53        if(WaveExists(sigQ) == 0)
54                Abort "Resolution information is missing."
55        endif
56        if(WaveExists(proto) == 0)
57                Abort "protocol information is missing."
58        endif
59       
60        ///////////////////////////////////////////////////////////////////////////
61        // Write all data
62       
63        // Define common attribute waves
64        Make/T/O/N=1 empty = {""}
65        Make/T/O/N=1 units = {"units"}
66        Make/T/O/N=1 inv_cm = {"1/cm"}
67        Make/T/O/N=1 inv_angstrom = {"1/A"}
68       
69        // Run Name and title
70        NewDataFolder/O/S $(parentBase)
71        Make/O/T/N=1 $(parentBase + ":title") = {V_getTitle(folderStr)}
72        CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty)
73        Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)}
74        CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty)
75       
76        // SASData
77        String dataParent = nxcansasBase + "sasdata/"
78        // Create SASdata entry
79        String dataBase = parentBase + ":sasdata"
80        NewDataFolder/O/S $(dataBase)
81        Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"}
82        Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q","NXdata","0",V_getDataEndTime(folderStr)}
83        CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals"))
84        //
85        // TODO: Reinstate Qdev/resolutions when I can fix the reader issue
86        //
87        // Create q entry
88        NewDataFolder/O/S $(dataBase + ":q")
89        Make/O/T/N=2 $(dataBase + ":q:attr") = {"units"}//,"resolutions"}
90        Make/O/T/N=2 $(dataBase + ":q:attrVals") = {"1/angstrom"}//,"Qdev"}
91        CreateVarNxCansas(fileID,dataParent,"sasdata","Q",qw,$(dataBase + ":q:attr"),$(dataBase + ":q:attrVals"))
92        // Create i entry
93        NewDataFolder/O/S $(dataBase + ":i")
94        Make/O/T/N=2 $(dataBase + ":i:attr") = {"units","uncertainties"}
95        Make/O/T/N=2 $(dataBase + ":i:attrVals") = {"1/cm","Idev"}
96        CreateVarNxCansas(fileID,dataParent,"sasdata","I",iw,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals"))
97        // Create idev entry
98        CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",sw,units,inv_cm)
99        // Create qdev entry
100        CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",sigQ,units,inv_angstrom)
101        CreateVarNxCansas(fileID,dataParent,"sasdata","Qmean",qbar,units,inv_angstrom)
102       
103        // Write all VSANS meta data
104        V_WriteMetaData(fileID,parentBase,nxcansasBase,folderStr,proto)
105               
106        //
107        ///////////////////////////////////////////////////////////////////////////
108       
109        // Close the file
110        if(fileID)
111                HDF5CloseFile /Z fileID
112        endif
113       
114        KillDataFolder/Z $base
115       
116End
117
118//
119//////////////////////////////////////////////////////////////////////////////////////////////////
120
121
122///////// QxQy Export  //////////
123//
124// (see the similar-named SANS routine for additonal steps - like resolution, etc.)
125// NXcanSAS output using the latest standard
126//
127//      July 2019 -- first version
128//
129//
130// TODO:
131// -- resolution is not generated here (and it shouldn't be) since resolution is not known yet.
132// -- The final writer will need to be aware of resolution, and there may be different forms
133//
134Function V_WriteNXcanSAS2DData(folderStr,pathStr,saveName,dialog)
135        String pathStr,folderStr,saveName
136        Variable dialog         //=1 will present dialog for name
137       
138        // Define local function variables
139        String formatStr="",detStr="",detSavePath
140        String destStr="",parentBase,nxcansasBase
141        String type=folderStr
142       
143        Variable fileID
144        String/G base = "root:V_NXcanSAS_file"
145       
146        NewDataFolder/O/S $(base)
147        SetDataFolder $(pathStr+folderStr)
148       
149        // Check fullpath and dialog
150        if(dialog == 1 || stringmatch(saveName, ""))
151                fileID = NxCansas_DoSaveFileDialog()
152        else
153                fileID = NxCansas_CreateFile(saveName)
154        Endif
155        if(!fileID)
156                abort "Unable to create file at " + saveName + "."
157        EndIf
158               
159        Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1)
160        sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all
161        sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all
162       
163        // declare, or make a fake protocol if needed (if the export type is RAW)
164        SVAR gProtoStr = root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr
165        String rawTag=""
166        if(cmpstr(folderStr,"RAW")==0)
167                Make/O/T/N=(kNumProtocolSteps) proto
168                RawTag = "RAW Data File: "     
169        else
170                Wave/T proto=$("root:Packages:NIST:VSANS:Globals:Protocols:"+gProtoStr)
171        endif
172       
173        SVAR samFiles = $("root:Packages:NIST:VSANS:"+folderStr+":gFileList")
174       
175        ///////////////////////////////////////////////////////////////////////////
176        // Write all data
177       
178        // Define common attribute waves
179        Make/O/T/N=1 empty = {""}
180        Make/O/T/N=1 units = {"units"}
181        Make/O/T/N=1 inv_cm = {"1/cm"}
182        Make/O/T/N=1 inv_angstrom = {"1/A"}
183       
184        // Run Name and title
185        NewDataFolder/O/S $(parentBase)
186       
187        Make/O/T/N=1 $(parentBase + ":title") = {V_getSampleDescription(folderStr)}
188        CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty)
189        Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)}
190        CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty)
191
192        // data values to populate the file header
193        String fileName,fileDate,fileLabel
194        Variable monCt,lambda,offset,dist,trans,thick
195        Variable bCentX,bCentY,a2,a1a2_dist,deltaLam,bstop
196        String a1Str
197        Variable pixX,pixY
198        Variable numTextLines,ii,jj,kk
199        Variable pixSizeX,pixSizeY
200        Variable duration
201
202        numTextLines = 30
203        Make/O/T/N=(numTextLines) labelWave
204       
205        //loop over all of the detector panels
206        NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
207
208        String detList
209        if(gIgnoreDetB)
210                detList = ksDetectorListNoB
211        else
212                detList = ksDetectorListAll
213        endif
214       
215        for(kk=0;kk<ItemsInList(detList);kk+=1)
216
217                detStr = StringFromList(kk, detList, ";")
218                detSavePath = pathStr + "_" + detStr
219               
220                pixX = V_getDet_pixel_num_x(type,detStr)
221                pixY = V_getDet_pixel_num_y(type,detStr)
222               
223                fileName = saveName
224                fileDate = V_getDataStartTime(type)             // already a string
225                fileLabel = V_getSampleDescription(type)
226               
227                monCt = V_getBeamMonNormData(type)
228                lambda = V_getWavelength(type)
229
230                offset = V_getDet_LateralOffset(type,detStr)
231       
232                dist = V_getDet_ActualDistance(type,detStr)
233                trans = V_getSampleTransmission(type)
234                thick = V_getSampleThickness(type)
235               
236                bCentX = V_getDet_beam_center_x(type,detStr)
237                bCentY = V_getDet_beam_center_y(type,detStr)
238                a1Str = V_getSourceAp_size(type)                //already a string
239                a2 = V_getSampleAp2_size(type)
240                a1a2_dist = V_getSourceAp_distance(type)
241                deltaLam = V_getWavelength_spread(type)
242                // TODO -- decipher which beamstop, if any is actually in place
243                // or -- V_getBeamStopC3_size(type)
244                bstop = V_getBeamStopC2_size(type)
245
246                pixSizeX = V_getDet_x_pixel_size(type,detStr)
247                pixSizeY = V_getDet_y_pixel_size(type,detStr)
248               
249                duration = V_getCount_time(type)
250               
251                WAVE data = V_getDetectorDataW(type,detStr)
252                WAVE data_err = V_getDetectorDataErrW(type,detStr)
253               
254                // TODO - replace hard wired paths with Read functions
255                // hard-wired
256                Wave qx_val = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qx_"+detStr)
257                Wave qy_val = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qy_"+detStr)
258                Wave qz_val = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qz_"+detStr)
259                Wave qTot = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qTot_"+detStr)
260               
261        ///// calculation of the resolution function (2D)
262
263        //
264                Variable acc,ssd,lambda0,yg_d,qstar,g,L1,L2,vz_1,sdd
265                // L1 = source to sample distance [cm]
266                L1 = V_getSourceAp_distance(type)
267       
268        // L2 = sample to detector distance [cm]
269                L2 = V_getDet_ActualDistance(type,detStr)               //cm
270
271        //             
272                G = 981.  //!   ACCELERATION OF GRAVITY, CM/SEC^2
273                vz_1 =  3.956E5 //      3.956E5 //!     CONVERT WAVELENGTH TO VELOCITY CM/SEC
274                acc = vz_1
275                SDD = L2                //1317
276                SSD = L1                //1627          //cm
277                lambda0 = lambda                //              15
278                YG_d = -0.5*G*SDD*(SSD+SDD)*(LAMBDA0/acc)^2
279                Print "DISTANCE BEAM FALLS DUE TO GRAVITY (CM) = ",YG_d
280        ////            Print "Gravity q* = ",-2*pi/lambda0*2*yg_d/sdd
281                qstar = -2*pi/lambda0*2*yg_d/sdd
282        //     
283        //
284        //// the gravity center is not the resolution center
285        //// gravity center = beam center
286        //// resolution center = offset y = dy + (2)*yg_d
287        /////************
288        //// do everything to write out the resolution too
289        //      // un-comment these if you want to write out qz_val and qval too, then use the proper save command
290        //      qval = CalcQval(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10)
291                Duplicate/O qTot,phi,r_dist
292                Variable xctr,yctr
293
294
295                xctr = V_getDet_beam_center_x_pix(type,detStr)
296                yctr = V_getDet_beam_center_y_pix(type,detStr)
297                phi = V_FindPhi( pixSizeX*((p+1)-xctr) , pixSizeY*((q+1)-yctr)+(2)*yg_d)                //(dx,dy+yg_d)
298                r_dist = sqrt(  (pixSizeX*((p+1)-xctr))^2 +  (pixSizeY*((q+1)-yctr)+(2)*yg_d)^2 )               //radial distance from ctr to pt
299       
300                //make everything in 1D now
301                Duplicate/O qTot SigmaQX,SigmaQY,fsubS,qval     
302                Redimension/N=(pixX*pixY) SigmaQX,SigmaQY,fsubS,qval,phi,r_dist
303
304                Variable ret1,ret2,ret3,nq
305                String collimationStr = proto[9]
306               
307                nq = pixX*pixY
308                ii=0
309
310// TODO
311// this loop is the slow step. it takes Å 0.7 s for F or M panels, and Å 120 s for the Back panel (6144 pts vs. 1.12e6 pts)
312// find some way to speed this up!
313// MultiThreading will be difficult as it requires all the dependent functions (HDF5 reads, etc.) to be threadsafe as well
314// and there are a lot of them... and I don't know if opening a file multiple times is a threadsafe operation?
315//  -- multiple open attempts seems like a bad idea.
316                //type = work folder
317               
318//              (this doesn't work...and isn't any faster)
319//              Duplicate/O qval dum
320//              dum = V_get2DResolution(qval,phi,r_dist,type,detStr,collimationStr,SigmaQX,SigmaQY,fsubS)
321
322v_tic()
323                Make/O/N=(2,pixX,pixY) qxy_vals
324                Make/O/N=(pixX,pixY) shadow
325                Make/O/N=(2,pixX,pixY) SigmaQ_combined
326                do
327                        jj = 0
328                        do
329                                nq = ii * pixX + jj
330                                V_get2DResolution(qval[nq],phi[nq],r_dist[nq],folderStr,detStr,collimationStr,ret1,ret2,ret3)
331                                qxy_vals[0][ii][jj] = qx_val[nq]
332                                qxy_vals[1][ii][jj] = qy_val[nq]
333                                SigmaQ_combined[0][ii][jj] = ret1
334                                SigmaQ_combined[1][ii][jj] = ret2
335                                shadow[ii][jj] = ret3
336                                jj+=1
337                        while(jj<pixX)
338                        ii+=1
339                while(ii<pixY)
340v_toc()
341
342        ////*********************       
343                Duplicate/O qx_val,qx_val_s
344                Duplicate/O qy_val,qy_val_s
345                Duplicate/O qz_val,qz_val_s
346                Duplicate/O data,z_val_s
347                Duplicate/O SigmaQx,sigmaQx_s
348                Duplicate/O SigmaQy,sigmaQy_s
349                Duplicate/O fSubS,fSubS_s
350                Duplicate/O data_err,sw_s
351               
352                //so that double precision data is not written out
353                Redimension/S qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s
354                Redimension/S SigmaQx_s,SigmaQy_s,fSubS_s
355       
356                Redimension/N=(pixX*pixY) qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s
357               
358                // SASData
359                String dataParent,dataBase
360                sPrintf dataParent,"%ssasdata%d/",nxcansasBase,kk
361                // Create SASdata entry
362                sPrintf dataBase,"%s:sasdata%d",parentBase,kk
363                NewDataFolder/O/S $(dataBase)
364                Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"}
365                Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q,Q","NXdata","0,1",V_getDataEndTime(folderStr)}
366                CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals"))
367                // Create i entry
368                NewDataFolder/O/S $(dataBase + ":i")
369                Make/O/T/N=2 $(dataBase + ":i:attr") = {"units","uncertainties"}
370               
371                Make/O/T/N=2 $(dataBase + ":i:attrVals") = {"1/cm","Idev"}
372                CreateVarNxCansas(fileID,dataParent,"sasdata","I",data,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals"))
373                //
374                // TODO: Reinstate Qdev/resolutions when I can fix the reader issue
375                //
376                // Create qx and qy entry
377                NewDataFolder/O/S $(dataBase + ":q")
378                Make/O/T/N=2 $(dataBase + ":q:attr") = {"units"}//,"resolutions"}
379                Make/O/T/N=2 $(dataBase + ":q:attrVals") = {"1/angstrom"}//,"Qdev"}
380                CreateVarNxCansas(fileID,dataParent,"sasdata","Q",qxy_vals,$(dataBase + ":q:attr"),$(dataBase + ":q:attrVals"))
381                // Create idev entry
382                CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",data_err,units,inv_cm)
383                // Create qdev entry
384                CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",SigmaQ_combined,units,inv_angstrom)
385                // Create shadwfactor entry
386                CreateVarNxCansas(fileID,dataParent,"sasdata","ShadowFactor",shadow,empty,empty)
387                //
388                ///////////////////////////////////////////////////////////////////////////
389               
390                KillWaves/Z qx_val_s,qy_val_s,z_val_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s,sw,sw_s
391                Killwaves/Z qval,sigmaQx,SigmaQy,fSubS,phi,r_dist
392       
393        endfor
394       
395        KillWaves/Z labelWave,dum
396       
397        // Write all VSANS meta data
398        V_WriteMetaData(fileID,parentBase,nxcansasBase,folderStr,proto)
399               
400        //
401        ///////////////////////////////////////////////////////////////////////////
402       
403        // Close the file
404        if(fileID)
405                HDF5CloseFile /Z fileID
406        endif
407       
408        KillDataFolder/Z $base
409       
410        return(0)
411End
412
413///////////////////////////////////////////////////////////////////////////
414// - V_WriteMetaData - Method used to write non data elements into NXcanSAS
415// format. This is common between 1D and 2D data sets.
416
417Function V_WriteMetaData(fileID,base,parentBase,folderStr,proto)
418        String base,parentBase,folderStr
419        Variable fileID
420        Wave/T proto
421       
422        // Define common attribute waves
423        Make/T/O/N=1 empty = {""}
424        Make/T/O/N=1 units = {"units"}
425        Make/T/O/N=1 m = {"m"}
426        Make/T/O/N=1 mm = {"mm"}
427        Make/T/O/N=1 cm = {"cm"}
428        Make/T/O/N=1 pixel = {"pixel"}
429        Make/T/O/N=1 angstrom = {"A"}
430       
431        // SASinstrument
432        String instrParent = parentBase + "sasinstrument/"
433        // Create SASinstrument entry
434        String instrumentBase = base + ":sasinstrument"
435        NewDataFolder/O/S $(instrumentBase)
436        Make/O/T/N=5 $(instrumentBase + ":attr") = {"canSAS_class","NX_class"}
437        Make/O/T/N=5 $(instrumentBase + ":attrVals") = {"SASinstrument","NXinstrument"}
438        CreateStrNxCansas(fileID,instrParent,"","",empty,$(instrumentBase + ":attr"),$(instrumentBase + ":attrVals"))
439        // Create SASinstrument name entry
440        Make/O/T/N=1 $(instrumentBase + ":name") = {V_getInstrumentName(folderStr)}
441        CreateStrNxCansas(fileID,instrParent,"","name",$(instrumentBase + ":name"),empty,empty)
442       
443        // SASaperture
444        String apertureParent = instrParent + "sasaperture/"
445        // Create SASaperture entry
446        String apertureBase = instrumentBase + ":sasaperture"
447        NewDataFolder/O/S $(apertureBase)
448        Make/O/T/N=5 $(apertureBase + ":attr") = {"canSAS_class","NX_class"}
449        Make/O/T/N=5 $(apertureBase + ":attrVals") = {"SASaperture","NXaperture"}
450        CreateStrNxCansas(fileID,apertureParent,"","",empty,$(apertureBase + ":attr"),$(apertureBase + ":attrVals"))
451        // Create SASaperture shape entry
452        Make/O/T/N=1 $(apertureBase + ":shape") = {V_getSampleAp_shape(folderStr)}
453        CreateStrNxCansas(fileID,apertureParent,"sasaperture","shape",$(apertureBase + ":shape"),empty,empty)
454        // Create SASaperture x_gap entry
455        Make/O/N=1 $(apertureBase + ":x_gap") = {V_getSampleAp_height(folderStr)}
456        CreateVarNxCansas(fileID,apertureParent,"sasaperture","x_gap",$(apertureBase + ":x_gap"),units,mm)
457        // Create SASaperture y_gap entry
458        Make/O/N=1 $(apertureBase + ":y_gap") = {V_getSampleAp_width(folderStr)}
459        CreateVarNxCansas(fileID,apertureParent,"sasaperture","y_gap",$(apertureBase + ":y_gap"),units,mm)
460       
461        // SAScollimation
462        String collimationParent = instrParent + "sascollimation/"
463        // Create SAScollimation entry
464        String collimationBase = instrumentBase + ":sascollimation"
465        NewDataFolder/O/S $(collimationBase)
466        Make/O/T/N=5 $(collimationBase + ":attr") = {"canSAS_class","NX_class"}
467        Make/O/T/N=5 $(collimationBase + ":attrVals") = {"SAScollimation","NXcollimator"}
468        CreateStrNxCansas(fileID,collimationParent,"","",empty,$(collimationBase + ":attr"),$(collimationBase + ":attrVals"))
469        // Create SAScollimation distance entry
470        Make/O/N=1 $(collimationBase + ":distance") = {V_getSourceAp_distance(folderStr)}
471        CreateVarNxCansas(fileID,collimationParent,"sasaperture","distance",$(collimationBase + ":distance"),units,m)
472       
473        // SASdetector - Front Top
474        String detectorParent = instrParent + "sasdetector1/"
475        // Create SASdetector entry
476        String detectorBase = instrumentBase + ":sasdetector1"
477        NewDataFolder/O/S $(detectorBase)
478        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
479        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
480        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
481        // Create SASdetector name entry
482        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontTop"}
483        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
484        // Create SASdetector type entry
485        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
486        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
487        // Create SASdetector distance entry
488        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FT")}
489        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
490        // Create SASdetector beam_center_x entry
491        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FT")}
492        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
493        // Create SASdetector beam_center_y entry
494        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FT")}
495        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
496        // Create SASdetector x_pixel_size entry
497        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FT")}
498        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
499        // Create SASdetector y_pixel_size entry
500        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FT")}
501        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
502       
503        // SASdetector - Front Bottom
504        detectorParent = instrParent + "sasdetector2/"
505        // Create SASdetector entry
506        detectorBase = instrumentBase + ":sasdetector2"
507        NewDataFolder/O/S $(detectorBase)
508        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
509        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
510        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
511        // Create SASdetector name entry
512        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontBottom"}
513        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
514        // Create SASdetector type entry
515        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
516        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
517        // Create SASdetector distance entry
518        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FB")}
519        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
520        // Create SASdetector beam_center_x entry
521        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FB")}
522        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
523        // Create SASdetector beam_center_y entry
524        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FB")}
525        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
526        // Create SASdetector x_pixel_size entry
527        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FB")}
528        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
529        // Create SASdetector y_pixel_size entry
530        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FB")}
531        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)   
532       
533        // SASdetector - Front Left
534        detectorParent = instrParent + "sasdetector3/"
535        // Create SASdetector entry
536        detectorBase = instrumentBase + ":sasdetector3"
537        NewDataFolder/O/S $(detectorBase)
538        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
539        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
540        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
541        // Create SASdetector name entry
542        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontLeft"}
543        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
544        // Create SASdetector type entry
545        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
546        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
547        // Create SASdetector distance entry
548        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FL")}
549        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
550        // Create SASdetector beam_center_x entry
551        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FL")}
552        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
553        // Create SASdetector beam_center_y entry
554        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FL")}
555        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
556        // Create SASdetector x_pixel_size entry
557        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FL")}
558        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
559        // Create SASdetector y_pixel_size entry
560        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FL")}
561        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
562       
563        // SASdetector - Front Right
564        detectorParent = instrParent + "sasdetector4/"
565        // Create SASdetector entry
566        detectorBase = instrumentBase + ":sasdetector4"
567        NewDataFolder/O/S $(detectorBase)
568        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
569        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
570        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
571        // Create SASdetector name entry
572        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontRight"}
573        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
574        // Create SASdetector type entry
575        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
576        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
577        // Create SASdetector distance entry
578        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FR")}
579        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
580        // Create SASdetector beam_center_x entry
581        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FR")}
582        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
583        // Create SASdetector beam_center_y entry
584        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FR")}
585        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
586        // Create SASdetector x_pixel_size entry
587        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FR")}
588        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
589        // Create SASdetector y_pixel_size entry
590        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FR")}
591        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
592       
593        // SASdetector - Middle Top
594        detectorParent = instrParent + "sasdetector5/"
595        // Create SASdetector entry
596        detectorBase = instrumentBase + ":sasdetector5"
597        NewDataFolder/O/S $(detectorBase)
598        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
599        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
600        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
601        // Create SASdetector name entry
602        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleTop"}
603        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
604        // Create SASdetector type entry
605        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
606        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
607        // Create SASdetector distance entry
608        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"MT")}
609        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
610        // Create SASdetector beam_center_x entry
611        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"MT")}
612        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
613        // Create SASdetector beam_center_y entry
614        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"MT")}
615        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
616        // Create SASdetector x_pixel_size entry
617        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"MT")}
618        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
619        // Create SASdetector y_pixel_size entry
620        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"MT")}
621        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
622       
623        // SASdetector - Middle Bottom
624        detectorParent = instrParent + "sasdetector6/"
625        // Create SASdetector entry
626        detectorBase = instrumentBase + ":sasdetector6"
627        NewDataFolder/O/S $(detectorBase)
628        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
629        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
630        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
631        // Create SASdetector name entry
632        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleBottom"}
633        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
634        // Create SASdetector type entry
635        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
636        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
637        // Create SASdetector distance entry
638        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"MB")}
639        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
640        // Create SASdetector beam_center_x entry
641        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"MB")}
642        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
643        // Create SASdetector beam_center_y entry
644        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"MB")}
645        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
646        // Create SASdetector x_pixel_size entry
647        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"MB")}
648        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
649        // Create SASdetector y_pixel_size entry
650        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"MB")}
651        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
652       
653        // SASdetector - Middle Left
654        detectorParent = instrParent + "sasdetector7/"
655        // Create SASdetector entry
656        detectorBase = instrumentBase + ":sasdetector7"
657        NewDataFolder/O/S $(detectorBase)
658        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
659        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
660        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
661        // Create SASdetector name entry
662        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleLeft"}
663        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
664        // Create SASdetector type entry
665        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
666        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
667        // Create SASdetector distance entry
668        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"ML")}
669        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
670        // Create SASdetector beam_center_x entry
671        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"ML")}
672        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
673        // Create SASdetector beam_center_y entry
674        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"ML")}
675        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
676        // Create SASdetector x_pixel_size entry
677        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"ML")}
678        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
679        // Create SASdetector y_pixel_size entry
680        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"ML")}
681        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
682       
683        // SASdetector - Middle Right
684        detectorParent = instrParent + "sasdetector8/"
685        // Create SASdetector entry
686        detectorBase = instrumentBase + ":sasdetector8"
687        NewDataFolder/O/S $(detectorBase)
688        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
689        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
690        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
691        // Create SASdetector name entry
692        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleRight"}
693        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
694        // Create SASdetector type entry
695        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
696        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
697        // Create SASdetector distance entry
698        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"MR")}
699        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
700        // Create SASdetector beam_center_x entry
701        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"MR")}
702        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
703        // Create SASdetector beam_center_y entry
704        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"MR")}
705        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
706        // Create SASdetector x_pixel_size entry
707        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"MR")}
708        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
709        // Create SASdetector y_pixel_size entry
710        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"MR")}
711        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
712       
713        NVAR ignoreBack = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
714        if(ignoreBack == 0)     
715                // SASdetector - Back High Res
716                detectorParent = instrParent + "sasdetector9/"
717                // Create SASdetector entry
718                detectorBase = instrumentBase + ":sasdetector9"
719                NewDataFolder/O/S $(detectorBase)
720                Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
721                Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
722                CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
723                // Create SASdetector name entry
724                Make/O/T/N=1 $(detectorBase + ":name") = {"HighResolutionBack"}
725                CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
726                // Create SASdetector type entry
727                Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
728                CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
729                // Create SASdetector distance entry
730                Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"B")}
731                CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
732                // Create SASdetector beam_center_x entry
733                Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"B")}
734                CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
735                // Create SASdetector beam_center_y entry
736                Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"B")}
737                CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
738                // Create SASdetector x_pixel_size entry
739                Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"B")}
740                CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
741                // Create SASdetector y_pixel_size entry
742                Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"B")}
743                CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
744        EndIf
745       
746        // SASsource
747        String sourceParent = instrParent + "sassource/"
748        // Create SASdetector entry
749        String sourceBase = instrumentBase + ":sassource"
750        NewDataFolder/O/S $(sourceBase)
751        Make/O/T/N=5 $(sourceBase + ":attr") = {"canSAS_class","NX_class"}
752        Make/O/T/N=5 $(sourceBase + ":attrVals") = {"SASsource","NXsource"}
753        CreateStrNxCansas(fileID,sourceParent,"","",empty,$(sourceBase + ":attr"),$(sourceBase + ":attrVals"))
754        // Create SASsource radiation entry
755        Make/O/T/N=1 $(sourceBase + ":radiation") = {V_getSourceType(folderStr)}
756        CreateStrNxCansas(fileID,sourceParent,"","radiation",$(sourceBase + ":radiation"),empty,empty)
757        // Create SASsource incident_wavelength entry
758        Make/O/N=1 $(sourceBase + ":incident_wavelength") = {V_getWavelength(folderStr)}
759        CreateVarNxCansas(fileID,sourceParent,"","incident_wavelength",$(sourceBase + ":incident_wavelength"),units,angstrom)
760        // Create SASsource incident_wavelength_spread entry
761        Make/O/N=1 $(sourceBase + ":incident_wavelength_spread") = {V_getWavelength_spread(folderStr)}
762        CreateVarNxCansas(fileID,sourceParent,"","incident_wavelength_spread",$(sourceBase + ":incident_wavelength_spread"),units,angstrom)
763
764        // SASsample
765        String sampleParent = parentBase + "sassample/"
766        // Create SASsample entry
767        String sampleBase = base + ":sassample"
768        NewDataFolder/O/S $(sampleBase)
769        Make/O/T/N=5 $(sampleBase + ":attr") = {"canSAS_class","NX_class"}
770        Make/O/T/N=5 $(sampleBase + ":attrVals") = {"SASsample","NXsample"}
771        CreateStrNxCansas(fileID,sampleParent,"","",empty,$(sampleBase + ":attr"),$(sampleBase + ":attrVals"))
772        // Create SASsample name entry
773        Make/O/T/N=1 $(sampleBase + ":name") = {V_getSampleDescription(folderStr)}
774        CreateStrNxCansas(fileID,sampleParent,"","name",$(sampleBase + ":name"),empty,empty)
775        // Create SASsample thickness entry
776        Make/O/N=1 $(sampleBase + ":thickness") = {V_getSampleThickness(folderStr)}
777        CreateVarNxCansas(fileID,sampleParent,"","thickness",$(sampleBase + ":thickness"),units,mm)
778        // Create SASsample transmission entry
779        Make/O/N=1 $(sampleBase + ":transmission") = {V_getSampleTransmission(folderStr)}
780        CreateVarNxCansas(fileID,sampleParent,"","transmission",$(sampleBase + ":transmission"),empty,empty)
781       
782        // Create SASsample temperature entry
783        If(V_getSampleTemperature(folderStr) != -999999)
784                Make/O/N=1 $(sampleBase + ":temperature") = {V_getSampleTemperature(folderStr)}
785                CreateVarNxCansas(fileID,sampleParent,"","temperature",$(sampleBase + ":temperature"),empty,empty)
786        EndIf
787       
788        //
789        // TODO: Include other sample environment when they are available
790       
791        // SASprocess
792        SVAR samFiles = root:Packages:NIST:VSANS:Globals:Protocols:gSAM
793        String protoStr7,protoStr8
794        if(strlen(proto[7]) == 0)
795                protoStr7 = "(Default) "+ ksBinTrimBegDefault
796        else
797                protoStr7 = proto[7]
798        endif
799        if(strlen(proto[8]) == 0)
800                protoStr8 = "(Default) "+ ksBinTrimEndDefault
801        else
802                protoStr8 = proto[8]
803        endif
804        String processNote0,processNote1,processNote2,processNote3,processNote4
805        String processNote5,processNote6,processNote7,processNote8,processNote9
806        sPrintf processNote0,"SAM: %s",samFiles
807        sPrintf processNote1,"BGD: %s",Proto[0]
808        sPrintf processNote2,"EMP: %s",Proto[1]
809        sPrintf processNote3,"DIV: %s",Proto[2]
810        sPrintf processNote4,"MASK: %s",Proto[3]
811        sPrintf processNote5,"ABS Parameters (3-6): %s",Proto[4]
812        sPrintf processNote6,"Average Choices: %s",Proto[5]
813        sPrintf processNote7,"Beginning Trim Points: %s",ProtoStr7
814        sPrintf processNote8,"End Trim Points: %s",ProtoStr8
815        sPrintf processNote9,"COLLIMATION=%s",proto[9]
816        // Create SASprocess entry
817        String processParent = parentBase + "sasprocess/"
818        String processBase = base + ":sasprocess"
819        NewDataFolder/O/S $(processBase)
820        Make/O/T/N=5 $(processBase + ":attr") = {"canSAS_class","NX_class"}
821        Make/O/T/N=5 $(processBase + ":attrVals") = {"SASprocess","NXprocess"}
822        CreateStrNxCansas(fileID,processParent,"","",empty,$(processBase + ":attr"),$(processBase + ":attrVals"))
823        // Create SASprocess name entry
824        Make/O/T/N=1 $(processBase + ":name") = {samFiles}
825        CreateStrNxCansas(fileID,processParent,"","name",$(processBase + ":name"),empty,empty)
826        // Create SASprocess note entries
827        Make/O/T/N=1 $(processBase + ":note0") = {processNote0}
828        CreateStrNxCansas(fileID,processParent,"","note0",$(processBase + ":note0"),empty,empty)
829        Make/O/T/N=1 $(processBase + ":note1") = {processNote1}
830        CreateStrNxCansas(fileID,processParent,"","note1",$(processBase + ":note1"),empty,empty)
831        Make/O/T/N=1 $(processBase + ":note2") = {processNote2}
832        CreateStrNxCansas(fileID,processParent,"","note2",$(processBase + ":note2"),empty,empty)
833        Make/O/T/N=1 $(processBase + ":note3") = {processNote3}
834        CreateStrNxCansas(fileID,processParent,"","note3",$(processBase + ":note3"),empty,empty)
835        Make/O/T/N=1 $(processBase + ":note4") = {processNote4}
836        CreateStrNxCansas(fileID,processParent,"","note4",$(processBase + ":note4"),empty,empty)
837        Make/O/T/N=1 $(processBase + ":note5") = {processNote5}
838        CreateStrNxCansas(fileID,processParent,"","note5",$(processBase + ":note5"),empty,empty)
839        Make/O/T/N=1 $(processBase + ":note6") = {processNote6}
840        CreateStrNxCansas(fileID,processParent,"","note6",$(processBase + ":note6"),empty,empty)
841        Make/O/T/N=1 $(processBase + ":note7") = {processNote7}
842        CreateStrNxCansas(fileID,processParent,"","note7",$(processBase + ":note7"),empty,empty)
843        Make/O/T/N=1 $(processBase + ":note8") = {processNote8}
844        CreateStrNxCansas(fileID,processParent,"","note8",$(processBase + ":note8"),empty,empty)
845        Make/O/T/N=1 $(processBase + ":note9") = {processNote9}
846        CreateStrNxCansas(fileID,processParent,"","note9",$(processBase + ":note9"),empty,empty)
847       
848End
849       
850//
851///////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.