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

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

Tie NXcanSAS into reduction methods and add debugging statements.

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