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

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

VSANS 2D NXcanSAS writer real data from file. Procedure compiles, but not fully tested/verified.

File size: 37.8 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        SetDataFolder $(pathStr+folderStr)
16       
17        // Check fullpath and dialog
18        if(stringmatch(saveName, ""))
19                fileID = NxCansas_DoSaveFileDialog()
20        else
21                fileID = NxCansas_CreateFile(saveName)
22        Endif
23        if(!fileID)
24                abort "Unable to create file at " + saveName + "."
25        else
26                Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1)
27                sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all
28                sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all
29
30                Wave qw = tmp_q
31                Wave iw = tmp_i
32                Wave sw = tmp_s
33                Wave sigQ = tmp_sq
34                Wave qbar = tmp_qb
35                Wave fs = tmp_fs
36        EndIf
37       
38        SVAR gProtoStr = root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr
39        Wave/T proto=$("root:Packages:NIST:VSANS:Globals:Protocols:"+gProtoStr)
40       
41        //make sure the waves exist
42        if(WaveExists(qw) == 0)
43                Abort "q is missing"
44        endif
45        if(WaveExists(iw) == 0)
46                Abort "i is missing"
47        endif
48        if(WaveExists(sw) == 0)
49                Abort "s is missing"
50        endif
51        if(WaveExists(sigQ) == 0)
52                Abort "Resolution information is missing."
53        endif
54        if(WaveExists(proto) == 0)
55                Abort "protocol information is missing."
56        endif
57       
58        ///////////////////////////////////////////////////////////////////////////
59        // Write all data
60       
61        // Define common attribute waves
62        Make/T/O/N=1 empty = {""}
63        Make/T/O/N=1 units = {"units"}
64        Make/T/O/N=1 inv_cm = {"1/cm"}
65        Make/T/O/N=1 inv_angstrom = {"1/A"}
66       
67        // Run Name and title
68        NewDataFolder/O/S $(parentBase)
69       
70        Make/O/T/N=1 $(parentBase + ":title") = {V_getTitle(folderStr)}
71        CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty)
72        Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)}
73        CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty)
74       
75        // SASData
76        String dataParent = nxcansasBase + "sasdata/"
77        // Create SASdata entry
78        String dataBase = parentBase + ":sasdata"
79        NewDataFolder/O/S $(dataBase)
80        Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"}
81        Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q","NXdata","0",V_getDataEndTime(folderStr)}
82        CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals"))
83        // Create q entry
84        NewDataFolder/O/S $(dataBase + ":q")
85        Make/T/N=2 $(dataBase + ":q:attr") = {"units","resolutions"}
86        Make/T/N=2 $(dataBase + ":q:attrVals") = {"1/angstrom","Qdev"}
87        CreateVarNxCansas(fileID,dataParent,"sasdata","Q",qw,$(dataBase + ":q:attr"),$(dataBase + ":q:attrVals"))
88        // Create i entry
89        NewDataFolder/O/S $(dataBase + ":i")
90        Make/O/T/N=2 $(dataBase + ":i:attr") = {"units","uncertainties"}
91        Make/O/T/N=2 $(dataBase + ":i:attrVals") = {"1/cm","Idev"}
92        CreateVarNxCansas(fileID,dataParent,"sasdata","I",iw,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals"))
93        // Create idev entry
94        CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",sw,units,inv_cm)
95        // Create qdev entry
96        CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",sigQ,units,inv_angstrom)
97        CreateVarNxCansas(fileID,dataParent,"sasdata","Qmean",qbar,units,inv_angstrom)
98       
99        // Write all VSANS meta data
100        V_WriteMetaData(fileID,parentBase,nxcansasBase,folderStr,proto)
101               
102        //
103        ///////////////////////////////////////////////////////////////////////////
104       
105        // Close the file
106        if(fileID)
107                HDF5CloseFile /Z fileID
108        endif
109       
110        KillDataFolder/Z $base
111       
112End
113
114//
115//////////////////////////////////////////////////////////////////////////////////////////////////
116
117
118///////// QxQy Export  //////////
119//
120// (see the similar-named SANS routine for additonal steps - like resolution, etc.)
121// NXcanSAS output using the latest standard
122//
123//      July 2019 -- first version
124//
125//
126// TODO:
127// -- This is a placeholder for the final NXcanSAS writer for VSANS data.
128// -- resolution is not generated here (and it shouldn't be) since resolution is not known yet.
129// -- The final writer will need to be aware of resolution, and there may be different forms
130//
131Function V_WriteNXcanSAS2DData(folderStr,pathStr,saveName,dialog)
132        String pathStr,folderStr,saveName
133        Variable dialog         //=1 will present dialog for name
134       
135        // Define local function variables
136        String formatStr="",detStr="",detSavePath
137        String destStr="",parentBase,nxcansasBase
138        String type=pathStr
139       
140        Variable fileID
141        String/G base = "root:V_NXcanSAS_file"
142       
143        SetDataFolder $(pathStr+folderStr)
144       
145        // Check fullpath and dialog
146        if(dialog == 1 || stringmatch(saveName, ""))
147                fileID = NxCansas_DoSaveFileDialog()
148        else
149                fileID = NxCansas_CreateFile(saveName)
150        Endif
151        if(!fileID)
152                abort "Unable to create file at " + saveName + "."
153        else
154                Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1)
155                sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all
156                sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all
157        EndIf
158       
159        // declare, or make a fake protocol if needed (if the export type is RAW)
160        SVAR gProtoStr = root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr
161        String rawTag=""
162        if(cmpstr(folderStr,"RAW")==0)
163                Make/O/T/N=(kNumProtocolSteps) proto
164                RawTag = "RAW Data File: "     
165        else
166                Wave/T proto=$("root:Packages:NIST:VSANS:Globals:Protocols:"+gProtoStr)
167        endif
168       
169        SVAR samFiles = $("root:Packages:NIST:VSANS:"+folderStr+":gFileList")
170       
171        ///////////////////////////////////////////////////////////////////////////
172        // Write all data
173       
174        // Define common attribute waves
175        Make/O/T/N=1 empty = {""}
176        Make/O/T/N=1 units = {"units"}
177        Make/O/T/N=1 inv_cm = {"1/cm"}
178        Make/O/T/N=1 inv_angstrom = {"1/A"}
179       
180        // Run Name and title
181        NewDataFolder/O/S $(parentBase)
182       
183        Make/O/T/N=1 $(parentBase + ":title") = {V_getTitle(folderStr)}
184        CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty)
185        Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)}
186        CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty)
187
188        // data values to populate the file header
189        String fileName,fileDate,fileLabel
190        Variable monCt,lambda,offset,dist,trans,thick
191        Variable bCentX,bCentY,a2,a1a2_dist,deltaLam,bstop
192        String a1Str
193        Variable pixX,pixY
194        Variable numTextLines,ii,jj,kk
195        Variable pixSizeX,pixSizeY
196        Variable duration
197
198        numTextLines = 30
199        Make/O/T/N=(numTextLines) labelWave
200       
201        //loop over all of the detector panels
202        NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB
203
204        String detList
205        if(gIgnoreDetB)
206                detList = ksDetectorListNoB
207        else
208                detList = ksDetectorListAll
209        endif
210       
211        for(kk=0;kk<ItemsInList(detList);kk+=1)
212
213                detStr = StringFromList(kk, detList, ";")
214                detSavePath = pathStr + "_" + detStr
215               
216                pixX = V_getDet_pixel_num_x(type,detStr)
217                pixY = V_getDet_pixel_num_y(type,detStr)
218               
219                fileName = newFileName
220                fileDate = V_getDataStartTime(type)             // already a string
221                fileLabel = V_getSampleDescription(type)
222               
223                monCt = V_getBeamMonNormData(type)
224                lambda = V_getWavelength(type)
225
226                offset = V_getDet_LateralOffset(type,detStr)
227       
228                dist = V_getDet_ActualDistance(type,detStr)
229                trans = V_getSampleTransmission(type)
230                thick = V_getSampleThickness(type)
231               
232                bCentX = V_getDet_beam_center_x(type,detStr)
233                bCentY = V_getDet_beam_center_y(type,detStr)
234                a1Str = V_getSourceAp_size(type)                //already a string
235                a2 = V_getSampleAp2_size(type)
236                a1a2_dist = V_getSourceAp_distance(type)
237                deltaLam = V_getWavelength_spread(type)
238                // TODO -- decipher which beamstop, if any is actually in place
239        // or -- V_getBeamStopC3_size(type)
240                bstop = V_getBeamStopC2_size(type)
241
242                pixSizeX = V_getDet_x_pixel_size(type,detStr)
243                pixSizeY = V_getDet_y_pixel_size(type,detStr)
244               
245                duration = V_getCount_time(type)
246               
247                WAVE data = V_getDetectorDataW(type,detStr)
248                WAVE data_err = V_getDetectorDataErrW(type,detStr)
249               
250                // TOOD - replace hard wired paths with Read functions
251                // hard-wired
252                Wave qx_val = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qx_"+detStr)
253                Wave qy_val = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qy_"+detStr)
254                Wave qz_val = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qz_"+detStr)
255                Wave qTot = $("root:Packages:NIST:VSANS:"+type+":entry:instrument:detector_"+detStr+":qTot_"+detStr)
256               
257        ///// calculation of the resolution function (2D)
258
259        //
260                Variable acc,ssd,lambda0,yg_d,qstar,g,L1,L2,vz_1,sdd
261                // L1 = source to sample distance [cm]
262                L1 = V_getSourceAp_distance(type)
263       
264        // L2 = sample to detector distance [cm]
265                L2 = V_getDet_ActualDistance(type,detStr)               //cm
266
267        //             
268                G = 981.  //!   ACCELERATION OF GRAVITY, CM/SEC^2
269                vz_1 =  3.956E5 //      3.956E5 //!     CONVERT WAVELENGTH TO VELOCITY CM/SEC
270                acc = vz_1
271                SDD = L2                //1317
272                SSD = L1                //1627          //cm
273                lambda0 = lambda                //              15
274                YG_d = -0.5*G*SDD*(SSD+SDD)*(LAMBDA0/acc)^2
275                Print "DISTANCE BEAM FALLS DUE TO GRAVITY (CM) = ",YG_d
276        ////            Print "Gravity q* = ",-2*pi/lambda0*2*yg_d/sdd
277                qstar = -2*pi/lambda0*2*yg_d/sdd
278        //     
279        //
280        //// the gravity center is not the resolution center
281        //// gravity center = beam center
282        //// resolution center = offset y = dy + (2)*yg_d
283        /////************
284        //// do everything to write out the resolution too
285        //      // un-comment these if you want to write out qz_val and qval too, then use the proper save command
286        //      qval = CalcQval(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10)
287                Duplicate/O qTot,phi,r_dist
288                Variable xctr,yctr
289
290
291                xctr = V_getDet_beam_center_x_pix(type,detStr)
292                yctr = V_getDet_beam_center_y_pix(type,detStr)
293                phi = V_FindPhi( pixSizeX*((p+1)-xctr) , pixSizeY*((q+1)-yctr)+(2)*yg_d)                //(dx,dy+yg_d)
294                r_dist = sqrt(  (pixSizeX*((p+1)-xctr))^2 +  (pixSizeY*((q+1)-yctr)+(2)*yg_d)^2 )               //radial distance from ctr to pt
295       
296                //make everything in 1D now
297                Duplicate/O qTot SigmaQX,SigmaQY,fsubS,qval     
298                Redimension/N=(pixX*pixY) SigmaQX,SigmaQY,fsubS,qval,phi,r_dist
299
300                Variable ret1,ret2,ret3,nq
301                String collimationStr
302               
303               
304                collimationStr = proto[9]
305               
306                nq = pixX*pixY
307                ii=0
308
309// TODO
310// 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)
311// find some way to speed this up!
312// MultiThreading will be difficult as it requires all the dependent functions (HDF5 reads, etc.) to be threadsafe as well
313// and there are a lot of them... and I don't know if opening a file multiple times is a threadsafe operation?
314//  -- multiple open attempts seems like a bad idea.
315                //type = work folder
316               
317//              (this doesn't work...and isn't any faster)
318//              Duplicate/O qval dum
319//              dum = V_get2DResolution(qval,phi,r_dist,type,detStr,collimationStr,SigmaQX,SigmaQY,fsubS)
320
321v_tic()
322                Make/O/N=(2,pixX,pixY) qxy_vals
323                //everything in 1D now
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 * pixelsX + jj
330                                get2DResolution(qval[nq],phi[nq],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,pixSize,usingLenses,r_dist[nq],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<pixelsX)
338                        ii+=1
339                while(ii<pixelsY)
340v_toc()
341        ////*********************       
342                Duplicate/O qx_val,qx_val_s
343                Duplicate/O qy_val,qy_val_s
344                Duplicate/O qz_val,qz_val_s
345                Duplicate/O data,z_val_s
346                Duplicate/O SigmaQx,sigmaQx_s
347                Duplicate/O SigmaQy,sigmaQy_s
348                Duplicate/O fSubS,fSubS_s
349                Duplicate/O data_err,sw_s
350               
351                //so that double precision data is not written out
352                Redimension/S qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s
353                Redimension/S SigmaQx_s,SigmaQy_s,fSubS_s
354       
355                Redimension/N=(pixX*pixY) qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s
356               
357                // SASData
358                String dataParent = nxcansasBase + "sasdata" + kk + "/"
359                // Create SASdata entry
360                String dataBase = parentBase + ":sasdata" + kk
361                NewDataFolder/O/S $(dataBase)
362                Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"}
363                Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q,Q","NXdata","0,1",textw[1]}
364                CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals"))
365                // Create i entry
366                NewDataFolder/O/S $(dataBase + ":i")
367                Make/O/T/N=2 $(dataBase + ":i:attr") = {"units","uncertainties"}
368                Make/O/T/N=2 $(dataBase + ":i:attrVals") = {"1/cm","Idev"}
369                CreateVarNxCansas(fileID,dataParent,"sasdata","I",data,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals"))
370                //
371                // TODO: Reinstate Qdev/resolutions when I can fix the reader issue
372                //
373                // Create qx and qy entry
374                NewDataFolder/O/S $(dataBase + ":q")
375                Make/O/T/N=2 $(dataBase + ":q:attr") = {"units"}//,"resolutions"}
376                Make/O/T/N=2 $(dataBase + ":q:attrVals") = {"1/angstrom"}//,"Qdev"}
377                CreateVarNxCansas(fileID,dataParent,"sasdata","Q",qxy_vals,$(dataBase + ":q:attr"),$(dataBase + ":q:attrVals"))
378                // Create idev entry
379                CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",data_err,units,inv_cm)
380                // Create qdev entry
381                CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",SigmaQ_combined,units,inv_angstrom)
382                // Create shadwfactor entry
383                CreateVarNxCansas(fileID,dataParent,"sasdata","ShadowFactor",shadow,empty,empty)
384                //
385                ///////////////////////////////////////////////////////////////////////////
386               
387                KillWaves/Z qx_val_s,qy_val_s,z_val_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s,sw,sw_s
388               
389                Killwaves/Z qval,sigmaQx,SigmaQy,fSubS,phi,r_dist
390               
391               
392       
393        endfor
394       
395        KillWaves/Z labelWave,dum
396       
397       
398       
399        // Write all meta data
400        WriteMetaData(fileID,parentBase,nxcansasBase,rw,textw)
401       
402        // Close the file
403        if(fileID)
404                HDF5CloseFile /Z fileID
405        endif
406       
407        KillDataFolder/Z $base
408       
409        return(0)
410End
411
412///////////////////////////////////////////////////////////////////////////
413// - V_WriteMetaData - Method used to write non data elements into NXcanSAS
414// format. This is common between 1D and 2D data sets.
415
416Function V_WriteMetaData(fileID,base,parentBase,folderStr,proto)
417        String base,parentBase,folderStr
418        Variable fileID
419        Wave/T proto
420       
421        // Define common attribute waves
422        Make/T/O/N=1 empty = {""}
423        Make/T/O/N=1 units = {"units"}
424        Make/T/O/N=1 m = {"m"}
425        Make/T/O/N=1 mm = {"mm"}
426        Make/T/O/N=1 cm = {"cm"}
427        Make/T/O/N=1 pixel = {"pixel"}
428        Make/T/O/N=1 angstrom = {"A"}
429       
430        // SASinstrument
431        String instrParent = parentBase + "sasinstrument/"
432        // Create SASinstrument entry
433        String instrumentBase = base + ":sasinstrument"
434        NewDataFolder/O/S $(instrumentBase)
435        Make/O/T/N=5 $(instrumentBase + ":attr") = {"canSAS_class","NX_class"}
436        Make/O/T/N=5 $(instrumentBase + ":attrVals") = {"SASinstrument","NXinstrument"}
437        CreateStrNxCansas(fileID,instrParent,"","",empty,$(instrumentBase + ":attr"),$(instrumentBase + ":attrVals"))
438        // Create SASinstrument name entry
439        Make/O/T/N=1 $(instrumentBase + ":name") = {V_getInstrumentName(folderStr)}
440        CreateStrNxCansas(fileID,instrParent,"","name",$(instrumentBase + ":name"),empty,empty)
441       
442        // SASaperture
443        String apertureParent = instrParent + "sasaperture/"
444        // Create SASaperture entry
445        String apertureBase = instrumentBase + ":sasaperture"
446        NewDataFolder/O/S $(apertureBase)
447        Make/O/T/N=5 $(apertureBase + ":attr") = {"canSAS_class","NX_class"}
448        Make/O/T/N=5 $(apertureBase + ":attrVals") = {"SASaperture","NXaperture"}
449        CreateStrNxCansas(fileID,apertureParent,"","",empty,$(apertureBase + ":attr"),$(apertureBase + ":attrVals"))
450       
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        // SASdetector - Back High Res
714        detectorParent = instrParent + "sasdetector9/"
715        // Create SASdetector entry
716        detectorBase = instrumentBase + ":sasdetector9"
717        NewDataFolder/O/S $(detectorBase)
718        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"}
719        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"}
720        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals"))
721        // Create SASdetector name entry
722        Make/O/T/N=1 $(detectorBase + ":name") = {"HighResolutionBack"}
723        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty)
724        // Create SASdetector type entry
725        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"}
726        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty)
727        // Create SASdetector distance entry
728        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"B")}
729        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm)
730        // Create SASdetector beam_center_x entry
731        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"B")}
732        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm)
733        // Create SASdetector beam_center_y entry
734        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"B")}
735        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm)
736        // Create SASdetector x_pixel_size entry
737        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"B")}
738        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm)
739        // Create SASdetector y_pixel_size entry
740        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"B")}
741        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)
742       
743        // SASsource
744        String sourceParent = instrParent + "sassource/"
745        // Create SASdetector entry
746        String sourceBase = instrumentBase + ":sassource"
747        NewDataFolder/O/S $(sourceBase)
748        Make/O/T/N=5 $(sourceBase + ":attr") = {"canSAS_class","NX_class"}
749        Make/O/T/N=5 $(sourceBase + ":attrVals") = {"SASsource","NXsource"}
750        CreateStrNxCansas(fileID,sourceParent,"","",empty,$(sourceBase + ":attr"),$(sourceBase + ":attrVals"))
751        // Create SASsource radiation entry
752        Make/O/T/N=1 $(sourceBase + ":radiation") = {V_getSourceType(folderStr)}
753        CreateStrNxCansas(fileID,sourceParent,"","radiation",$(sourceBase + ":radiation"),empty,empty)
754        // Create SASsource incident_wavelength entry
755        Make/O/N=1 $(sourceBase + ":incident_wavelength") = {V_getWavelength(folderStr)}
756        CreateVarNxCansas(fileID,sourceParent,"","incident_wavelength",$(sourceBase + ":incident_wavelength"),units,angstrom)
757        // Create SASsource incident_wavelength_spread entry
758        Make/O/N=1 $(sourceBase + ":incident_wavelength_spread") = {V_getWavelength_spread(folderStr)}
759        CreateVarNxCansas(fileID,sourceParent,"","incident_wavelength_spread",$(sourceBase + ":incident_wavelength_spread"),units,angstrom)
760       
761        // SASsample
762        String sampleParent = parentBase + "sassample/"
763        // Create SASsample entry
764        String sampleBase = base + ":sassample"
765        NewDataFolder/O/S $(sampleBase)
766        Make/O/T/N=5 $(sampleBase + ":attr") = {"canSAS_class","NX_class"}
767        Make/O/T/N=5 $(sampleBase + ":attrVals") = {"SASsample","NXsample"}
768        CreateStrNxCansas(fileID,sampleParent,"","",empty,$(sampleBase + ":attr"),$(sampleBase + ":attrVals"))
769        // Create SASsample name entry
770        Make/O/T/N=1 $(sampleBase + ":name") = {V_getSampleDescription(folderStr)}
771        CreateStrNxCansas(fileID,sampleParent,"","name",$(sampleBase + ":name"),empty,empty)
772        // Create SASsample thickness entry
773        Make/O/N=1 $(sampleBase + ":thickness") = {V_getSampleThickness(folderStr)}
774        CreateVarNxCansas(fileID,sampleParent,"","thickness",$(sampleBase + ":thickness"),units,cm)
775        // Create SASsample transmission entry
776        Make/O/N=1 $(sampleBase + ":transmission") = {V_getSampleTransmission(folderStr)}
777        CreateVarNxCansas(fileID,sampleParent,"","transmission",$(sampleBase + ":transmission"),empty,empty)
778       
779        // SASprocess
780        SVAR samFiles = root:Packages:NIST:VSANS:Globals:Protocols:gSAM
781        String protoStr7,protoStr8
782        if(strlen(proto[7]) == 0)
783                protoStr7 = "(Default) "+ ksBinTrimBegDefault
784        else
785                protoStr7 = proto[7]
786        endif
787        if(strlen(proto[8]) == 0)
788                protoStr8 = "(Default) "+ ksBinTrimEndDefault
789        else
790                protoStr8 = proto[8]
791        endif
792        String processNote = ""
793        sPrintf processNote,"SAM: %s\r\n",samFiles
794        sPrintf processNote,"%sBGD: %s\r\n",processNote,proto[0]
795        sPrintf processNote,"%sEMP: %s\r\n",processNote,Proto[1]
796        sPrintf processNote,"%sDIV: %s\r\n",processNote,Proto[2]
797        sPrintf processNote,"%sMASK: %s\r\n",processNote,Proto[3]
798        sPrintf processNote,"%sABS Parameters (3-6): %s\r\n",processNote,Proto[4]
799        sPrintf processNote,"%sAverage Choices: %s\r\n",processNote,Proto[5]
800        sPrintf processNote,"%sBeginning Trim Points: %s\r\n",processNote,ProtoStr7
801        sPrintf processNote,"%sEnd Trim Points: %s\r\n",processNote,ProtoStr8
802        sPrintf processNote,"%sCOLLIMATION=%s\r\n",processNote,proto[9]
803        String processParent = parentBase + "sasprocess/"
804        // Create SASprocess entry
805        String processBase = base + ":sasprocess"
806        NewDataFolder/O/S $(processBase)
807        Make/O/T/N=5 $(processBase + ":attr") = {"canSAS_class","NX_class"}
808        Make/O/T/N=5 $(processBase + ":attrVals") = {"SASprocess","NXprocess"}
809        CreateStrNxCansas(fileID,processParent,"","",empty,$(processBase + ":attr"),$(processBase + ":attrVals"))
810        // Create SASprocess name entry
811        Make/O/T/N=1 $(processBase + ":name") = {samFiles}
812        CreateStrNxCansas(fileID,processParent,"","name",$(processBase + ":name"),empty,empty)
813        // Create SASprocess note entry
814        Make/O/T/N=1 $(processBase + ":note") = {processNote}
815        CreateStrNxCansas(fileID,processParent,"","note",$(processBase + ":note"),empty,empty)
816End
817       
818//
819///////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.