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

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

Modify 2D VSANS NXcanSAS writer to write all data and meta data.

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