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

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

Create a method to open or create a new file for all NXcanSAS writers.

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