Changeset 1181


Ignore:
Timestamp:
Jul 17, 2019 3:14:10 PM (3 years ago)
Author:
krzywon
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_NXcanSAS.ipf

    r1180 r1181  
    33 
    44 
    5  
    6 // TODO: 
    7 // -- This is a placeholder for the final NXcanSAS writer for VSANS data. 
    8 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
    9 // -- The final writer will need to be aware of resolution, and there may be different forms 
    10 // 
    115Function V_WriteNXcanSAS1DData(pathStr,folderStr,saveName) 
    126        String pathStr,folderStr,saveName 
     
    10599        // Write all VSANS meta data 
    106100        V_WriteMetaData(fileID,parentBase,nxcansasBase,folderStr,proto) 
     101                 
     102        // 
     103        /////////////////////////////////////////////////////////////////////////// 
     104         
     105        // Close the file 
     106        if(fileID) 
     107                HDF5CloseFile /Z fileID 
     108        endif 
     109         
     110        KillDataFolder/Z $base 
    107111         
    108112End 
     
    115119// 
    116120// (see the similar-named SANS routine for additonal steps - like resolution, etc.) 
    117 //ASCII export of data as 8-columns qx-qy-Intensity-err-qz-sigmaQ_parall-sigmaQ_perp-fShad 
    118 // + limited header information 
     121// NXcanSAS output using the latest standard 
    119122// 
    120 //      Jan 2019 -- first version, simply exports the basic matrix of data with no resolution information 
     123//      July 2019 -- first version 
    121124// 
    122125// 
    123 Function V_WriteNXcanSAS2DData(type,fullpath,newFileName,dialog) 
    124         String type,fullpath,newFileName 
     126// TODO: 
     127// -- This is a placeholder for the final NXcanSAS writer for VSANS data. 
     128// -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
     129// -- The final writer will need to be aware of resolution, and there may be different forms 
     130// 
     131Function V_WriteNXcanSAS2DData(folderStr,pathStr,saveName,dialog) 
     132        String pathStr,folderStr,saveName 
    125133        Variable dialog         //=1 will present dialog for name 
    126134         
    127         String typeStr="" 
    128         Variable refnum 
    129         String detStr="",detSavePath 
    130  
     135        // Define local function variables 
     136        String formatStr="",detStr="",detSavePath 
     137        String destStr="",parentBase,nxcansasBase 
     138        String type=pathStr 
     139         
     140        Variable fileID 
     141        String/G base = "root:V_NXcanSAS_file" 
     142         
     143        SetDataFolder $(pathStr+folderStr) 
     144         
     145        // Check fullpath and dialog 
     146        if(dialog == 1 || stringmatch(saveName, "")) 
     147                fileID = NxCansas_DoSaveFileDialog() 
     148        else 
     149                fileID = NxCansas_CreateFile(saveName) 
     150        Endif 
     151        if(!fileID) 
     152                abort "Unable to create file at " + saveName + "." 
     153        else 
     154                Variable sasentry = NumVarOrDefault("root:Packages:NIST:gSASEntryNumber", 1) 
     155                sPrintf parentBase,"%s:sasentry%d",base,sasentry // Igor memory base path for all 
     156                sPrintf nxcansasBase,"/sasentry%d/",sasentry // HDF5 base path for all 
     157        EndIf 
     158         
     159        // declare, or make a fake protocol if needed (if the export type is RAW) 
    131160        SVAR gProtoStr = root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr 
    132          
    133         // declare, or make a fake protocol if needed (if the export type is RAW) 
    134161        String rawTag="" 
    135         if(cmpstr(type,"RAW")==0) 
     162        if(cmpstr(folderStr,"RAW")==0) 
    136163                Make/O/T/N=(kNumProtocolSteps) proto 
    137164                RawTag = "RAW Data File: "       
     
    140167        endif 
    141168         
    142         SVAR samFiles = $("root:Packages:NIST:VSANS:"+type+":gFileList") 
    143          
    144         //check each wave - MUST exist, or will cause a crash 
    145 //      If(!(WaveExists(data))) 
    146 //              Abort "data DNExist QxQy_Export()" 
    147 //      Endif 
    148  
    149         if(dialog) 
    150                 PathInfo/S catPathName 
    151                 fullPath = DoSaveFileDialog("Save data as") 
    152                 If(cmpstr(fullPath,"")==0) 
    153                         //user cancel, don't write out a file 
    154                         Close/A 
    155                         Abort "no data file was written" 
    156                 Endif 
    157                 //Print "dialog fullpath = ",fullpath 
    158         Endif 
     169        SVAR samFiles = $("root:Packages:NIST:VSANS:"+folderStr+":gFileList") 
     170         
     171        /////////////////////////////////////////////////////////////////////////// 
     172        // Write all data 
     173         
     174        // Define common attribute waves 
     175        Make/O/T/N=1 empty = {""} 
     176        Make/O/T/N=1 units = {"units"} 
     177        Make/O/T/N=1 inv_cm = {"1/cm"} 
     178        Make/O/T/N=1 inv_angstrom = {"1/A"} 
     179         
     180        // Run Name and title 
     181        NewDataFolder/O/S $(parentBase) 
     182         
     183        Make/O/T/N=1 $(parentBase + ":title") = {V_getTitle(folderStr)} 
     184        CreateStrNxCansas(fileID,nxcansasBase,"","title",$(parentBase + ":title"),empty,empty) 
     185        Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)} 
     186        CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty) 
    159187 
    160188        // data values to populate the file header 
     
    170198        numTextLines = 30 
    171199        Make/O/T/N=(numTextLines) labelWave 
    172  
    173         // 
    174200         
    175201        //loop over all of the detector panels 
     
    186212 
    187213                detStr = StringFromList(kk, detList, ";") 
    188                 detSavePath = fullPath + "_" + detStr 
     214                detSavePath = pathStr + "_" + detStr 
    189215                 
    190216                pixX = V_getDet_pixel_num_x(type,detStr) 
     
    197223                monCt = V_getBeamMonNormData(type) 
    198224                lambda = V_getWavelength(type) 
    199          
    200         // TODO - switch based on panel type 
    201         //      V_getDet_LateralOffset(fname,detStr) 
    202         //      V_getDet_VerticalOffset(fname,detStr) 
     225 
    203226                offset = V_getDet_LateralOffset(type,detStr) 
    204227         
     
    221244                 
    222245                duration = V_getCount_time(type) 
    223                  
    224         ///////// 
    225                 labelWave[0] = "FILE: "+fileName+"   CREATED: "+fileDate 
    226                 labelWave[1] = "LABEL: "+fileLabel 
    227                 labelWave[2] = "MON CNT   LAMBDA (A)  DET_OFF(cm)   DET_DIST(cm)   TRANS   THICK(cm)" 
    228                 labelWave[3] = num2str(monCt)+"  "+num2str(lambda)+"       "+num2str(offset)+"     "+num2str(dist) 
    229                 labelWave[3] += "     "+num2str(trans)+"     "+num2str(thick) 
    230                 labelWave[4] = "BCENT(X,Y)(cm)   A1(mm)   A2(mm)   A1A2DIST(m)   DL/L   BSTOP(mm)" 
    231                 labelWave[5] = num2str(bCentX)+"  "+num2str(bCentY)+"  "+a1Str+"    "+num2str(a2)+"    " 
    232                 labelWave[5] += num2str(a1a2_dist)+"    "+num2str(deltaLam)+"    "+num2str(bstop) 
    233                 labelWave[6] =  "SAM: "+rawTag+samFiles 
    234                 labelWave[7] =  "BGD: "+proto[0] 
    235                 labelWave[8] =  "EMP: "+proto[1] 
    236                 labelWave[9] =  "DIV: "+proto[2] 
    237                 labelWave[10] =  "MASK: "+proto[3] 
    238                 labelWave[11] =  "ABS Parameters (3-6): "+proto[4] 
    239                 labelWave[12] = "Average Choices: "+proto[5] 
    240                 labelWave[13] = "Collimation type: "+proto[9] 
    241                 labelWave[14] = "Panel="+detStr 
    242                 labelWave[15] = "NumXPixels="+num2str(pixX) 
    243                 labelWave[16] = "XPixelSize_mm="+num2str(pixSizeX) 
    244                 labelWave[17] = "NumYPixels="+num2str(pixY) 
    245                 labelWave[18] = "YPixelSize_mm="+num2str(pixSizeY) 
    246                 labelWave[19] = "Duration (s)="+num2str(duration) 
    247                 labelWave[20] = "reserved for future file definition changes" 
    248                 labelWave[21] = "reserved for future file definition changes" 
    249                 labelWave[22] = "reserved for future file definition changes" 
    250                 labelWave[23] = "reserved for future file definition changes" 
    251                 labelWave[24] = "reserved for future file definition changes" 
    252                 labelWave[25] = "reserved for future file definition changes" 
    253  
    254                 labelWave[26] = "*** Data written from "+type+" folder and may not be a fully corrected data file ***" 
    255 //              labelWave[20] = "Data columns are Qx - Qy - Qz - I(Qx,Qy) - Err I(Qx,Qy)" 
    256         //      labelWave[20] = "Data columns are Qx - Qy - I(Qx,Qy) - Qz - SigmaQ_parall - SigmaQ_perp - fSubS(beam stop shadow)" 
    257                 labelWave[27] = "Data columns are Qx - Qy - I(Qx,Qy) - err(I) - Qz - SigmaQ_parall - SigmaQ_perp - fSubS(beam stop shadow)" 
    258                 labelWave[28] = "The error wave may not be properly propagated (1/2019)" 
    259                 labelWave[29] = "ASCII data created " +date()+" "+time() 
    260                 //strings can be too long to print-- must trim to 255 chars 
    261                 for(jj=0;jj<numTextLines;jj+=1) 
    262                         labelWave[jj] = (labelWave[jj])[0,240] 
    263                 endfor 
    264          
    265          
    266         // get the data waves for output 
    267         // QxQyQz have already been calculated for VSANS data 
    268246                 
    269247                WAVE data = V_getDetectorDataW(type,detStr) 
     
    342320 
    343321v_tic() 
     322                Make/O/N=(2,pixX,pixY) qxy_vals 
     323                //everything in 1D now 
     324                Make/O/N=(pixX,pixY) shadow 
     325                Make/O/N=(2,pixX,pixY) SigmaQ_combined 
    344326                do 
    345                         V_get2DResolution(qval[ii],phi[ii],r_dist[ii],type,detStr,collimationStr,ret1,ret2,ret3) 
    346                         SigmaQX[ii] = ret1       
    347                         SigmaQY[ii] = ret2       
    348                         fsubs[ii] = ret3         
     327                        jj = 0 
     328                        do 
     329                                nq = ii * pixelsX + jj 
     330                                get2DResolution(qval[nq],phi[nq],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,pixSize,usingLenses,r_dist[nq],ret1,ret2,ret3) 
     331                                qxy_vals[0][ii][jj] = qx_val[nq] 
     332                                qxy_vals[1][ii][jj] = qy_val[nq] 
     333                                SigmaQ_combined[0][ii][jj] = ret1        
     334                                SigmaQ_combined[1][ii][jj] = ret2 
     335                                shadow[ii][jj] = ret3    
     336                                jj+=1 
     337                        while(jj<pixelsX) 
    349338                        ii+=1 
    350                 while(ii<nq)     
     339                while(ii<pixelsY) 
    351340v_toc()  
    352341        ////*********************        
     
    366355                Redimension/N=(pixX*pixY) qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s 
    367356                 
    368                 //not demo-compatible, but approx 8x faster!!    
    369 #if(strsearch(stringbykey("IGORKIND",IgorInfo(0),":",";"), "demo", 0 ) == -1) 
    370                  
    371 //              Save/O/G/M="\r\n" labelWave,qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s as detSavePath      // without resolution 
    372                 Save/O/G/M="\r\n" labelWave,qx_val_s,qy_val_s,z_val_s,sw_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s as detSavePath  // write out the resolution information 
    373 #else 
    374                 Open refNum as detSavePath 
    375                 wfprintf refNum,"%s\r\n",labelWave 
    376                 fprintf refnum,"\r\n" 
    377 //              wfprintf refNum,"%8g\t%8g\t%8g\t%8g\t%8g\r\n",qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s 
    378                 wfprintf refNum,"%8g\t%8g\t%8g\t%8g\t%8g\t%8g\t%8g\t%8g\r\n",qx_val_s,qy_val_s,z_val_s,sw_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s 
    379                 Close refNum 
    380 #endif 
     357                // SASData 
     358                String dataParent = nxcansasBase + "sasdata" + kk + "/" 
     359                // Create SASdata entry 
     360                String dataBase = parentBase + ":sasdata" + kk 
     361                NewDataFolder/O/S $(dataBase) 
     362                Make/O/T/N=5 $(dataBase + ":attr") = {"canSAS_class","signal","I_axes","NX_class","Q_indices", "timestamp"} 
     363                Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q,Q","NXdata","0,1",textw[1]} 
     364                CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals")) 
     365                // Create i entry 
     366                NewDataFolder/O/S $(dataBase + ":i") 
     367                Make/O/T/N=2 $(dataBase + ":i:attr") = {"units","uncertainties"} 
     368                Make/O/T/N=2 $(dataBase + ":i:attrVals") = {"1/cm","Idev"} 
     369                CreateVarNxCansas(fileID,dataParent,"sasdata","I",data,$(dataBase + ":i:attr"),$(dataBase + ":i:attrVals")) 
     370                // 
     371                // TODO: Reinstate Qdev/resolutions when I can fix the reader issue 
     372                // 
     373                // Create qx and qy entry 
     374                NewDataFolder/O/S $(dataBase + ":q") 
     375                Make/O/T/N=2 $(dataBase + ":q:attr") = {"units"}//,"resolutions"} 
     376                Make/O/T/N=2 $(dataBase + ":q:attrVals") = {"1/angstrom"}//,"Qdev"} 
     377                CreateVarNxCansas(fileID,dataParent,"sasdata","Q",qxy_vals,$(dataBase + ":q:attr"),$(dataBase + ":q:attrVals")) 
     378                // Create idev entry 
     379                CreateVarNxCansas(fileID,dataParent,"sasdata","Idev",data_err,units,inv_cm) 
     380                // Create qdev entry 
     381                CreateVarNxCansas(fileID,dataParent,"sasdata","Qdev",SigmaQ_combined,units,inv_angstrom) 
     382                // Create shadwfactor entry 
     383                CreateVarNxCansas(fileID,dataParent,"sasdata","ShadowFactor",shadow,empty,empty) 
     384                // 
     385                /////////////////////////////////////////////////////////////////////////// 
    381386                 
    382387                KillWaves/Z qx_val_s,qy_val_s,z_val_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s,sw,sw_s 
     
    384389                Killwaves/Z qval,sigmaQx,SigmaQy,fSubS,phi,r_dist 
    385390                 
    386                 Print "QxQy_Export File written: ", V_GetFileNameFromPathNoSemi(detSavePath) 
     391                 
    387392         
    388393        endfor 
    389394         
    390395        KillWaves/Z labelWave,dum 
     396         
     397         
     398         
     399        // Write all meta data 
     400        WriteMetaData(fileID,parentBase,nxcansasBase,rw,textw) 
     401         
     402        // Close the file 
     403        if(fileID) 
     404                HDF5CloseFile /Z fileID 
     405        endif 
     406         
     407        KillDataFolder/Z $base 
     408         
    391409        return(0) 
    392410End 
     
    395413// - V_WriteMetaData - Method used to write non data elements into NXcanSAS 
    396414// format. This is common between 1D and 2D data sets. 
    397  
    398 // 
    399 // FIXME: Remove textw and rw once locations of information are known 
    400 // 
    401415 
    402416Function V_WriteMetaData(fileID,base,parentBase,folderStr,proto) 
     
    457471        CreateVarNxCansas(fileID,collimationParent,"sasaperture","distance",$(collimationBase + ":distance"),units,m) 
    458472         
    459         // 
    460         // TODO: Create separate detector entry for each panel 
    461         // 
    462          
    463473        // SASdetector - Front Top 
    464         String detectorParent = instrParent + "sasdetector/" 
    465         // Create SASdetector entry 
    466         String detectorBase = instrumentBase + ":sasdetector" 
     474        String detectorParent = instrParent + "sasdetector1/" 
     475        // Create SASdetector entry 
     476        String detectorBase = instrumentBase + ":sasdetector1" 
    467477        NewDataFolder/O/S $(detectorBase) 
    468478        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     
    491501        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
    492502         
     503        // SASdetector - Front Bottom 
     504        detectorParent = instrParent + "sasdetector2/" 
     505        // Create SASdetector entry 
     506        detectorBase = instrumentBase + ":sasdetector2" 
     507        NewDataFolder/O/S $(detectorBase) 
     508        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     509        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     510        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     511        // Create SASdetector name entry 
     512        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontBottom"} 
     513        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     514        // Create SASdetector type entry 
     515        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     516        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     517        // Create SASdetector distance entry 
     518        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FB")} 
     519        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     520        // Create SASdetector beam_center_x entry 
     521        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FB")} 
     522        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     523        // Create SASdetector beam_center_y entry 
     524        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FB")} 
     525        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     526        // Create SASdetector x_pixel_size entry 
     527        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FB")} 
     528        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     529        // Create SASdetector y_pixel_size entry 
     530        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FB")} 
     531        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm)    
     532                 
     533        // SASdetector - Front Left 
     534        detectorParent = instrParent + "sasdetector3/" 
     535        // Create SASdetector entry 
     536        detectorBase = instrumentBase + ":sasdetector3" 
     537        NewDataFolder/O/S $(detectorBase) 
     538        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     539        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     540        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     541        // Create SASdetector name entry 
     542        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontLeft"} 
     543        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     544        // Create SASdetector type entry 
     545        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     546        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     547        // Create SASdetector distance entry 
     548        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FL")} 
     549        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     550        // Create SASdetector beam_center_x entry 
     551        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FL")} 
     552        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     553        // Create SASdetector beam_center_y entry 
     554        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FL")} 
     555        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     556        // Create SASdetector x_pixel_size entry 
     557        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FL")} 
     558        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     559        // Create SASdetector y_pixel_size entry 
     560        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FL")} 
     561        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     562                 
     563        // SASdetector - Front Right 
     564        detectorParent = instrParent + "sasdetector4/" 
     565        // Create SASdetector entry 
     566        detectorBase = instrumentBase + ":sasdetector4" 
     567        NewDataFolder/O/S $(detectorBase) 
     568        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     569        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     570        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     571        // Create SASdetector name entry 
     572        Make/O/T/N=1 $(detectorBase + ":name") = {"FrontRight"} 
     573        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     574        // Create SASdetector type entry 
     575        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     576        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     577        // Create SASdetector distance entry 
     578        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"FR")} 
     579        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     580        // Create SASdetector beam_center_x entry 
     581        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"FR")} 
     582        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     583        // Create SASdetector beam_center_y entry 
     584        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"FR")} 
     585        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     586        // Create SASdetector x_pixel_size entry 
     587        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"FR")} 
     588        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     589        // Create SASdetector y_pixel_size entry 
     590        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"FR")} 
     591        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     592                 
     593        // SASdetector - Middle Top 
     594        detectorParent = instrParent + "sasdetector5/" 
     595        // Create SASdetector entry 
     596        detectorBase = instrumentBase + ":sasdetector5" 
     597        NewDataFolder/O/S $(detectorBase) 
     598        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     599        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     600        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     601        // Create SASdetector name entry 
     602        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleTop"} 
     603        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     604        // Create SASdetector type entry 
     605        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     606        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     607        // Create SASdetector distance entry 
     608        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"MT")} 
     609        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     610        // Create SASdetector beam_center_x entry 
     611        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"MT")} 
     612        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     613        // Create SASdetector beam_center_y entry 
     614        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"MT")} 
     615        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     616        // Create SASdetector x_pixel_size entry 
     617        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"MT")} 
     618        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     619        // Create SASdetector y_pixel_size entry 
     620        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"MT")} 
     621        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     622                         
     623        // SASdetector - Middle Bottom 
     624        detectorParent = instrParent + "sasdetector6/" 
     625        // Create SASdetector entry 
     626        detectorBase = instrumentBase + ":sasdetector6" 
     627        NewDataFolder/O/S $(detectorBase) 
     628        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     629        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     630        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     631        // Create SASdetector name entry 
     632        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleBottom"} 
     633        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     634        // Create SASdetector type entry 
     635        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     636        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     637        // Create SASdetector distance entry 
     638        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"MB")} 
     639        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     640        // Create SASdetector beam_center_x entry 
     641        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"MB")} 
     642        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     643        // Create SASdetector beam_center_y entry 
     644        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"MB")} 
     645        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     646        // Create SASdetector x_pixel_size entry 
     647        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"MB")} 
     648        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     649        // Create SASdetector y_pixel_size entry 
     650        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"MB")} 
     651        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     652                         
     653        // SASdetector - Middle Left 
     654        detectorParent = instrParent + "sasdetector7/" 
     655        // Create SASdetector entry 
     656        detectorBase = instrumentBase + ":sasdetector7" 
     657        NewDataFolder/O/S $(detectorBase) 
     658        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     659        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     660        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     661        // Create SASdetector name entry 
     662        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleLeft"} 
     663        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     664        // Create SASdetector type entry 
     665        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     666        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     667        // Create SASdetector distance entry 
     668        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"ML")} 
     669        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     670        // Create SASdetector beam_center_x entry 
     671        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"ML")} 
     672        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     673        // Create SASdetector beam_center_y entry 
     674        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"ML")} 
     675        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     676        // Create SASdetector x_pixel_size entry 
     677        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"ML")} 
     678        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     679        // Create SASdetector y_pixel_size entry 
     680        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"ML")} 
     681        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     682                         
     683        // SASdetector - Middle Right 
     684        detectorParent = instrParent + "sasdetector8/" 
     685        // Create SASdetector entry 
     686        detectorBase = instrumentBase + ":sasdetector8" 
     687        NewDataFolder/O/S $(detectorBase) 
     688        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     689        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     690        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     691        // Create SASdetector name entry 
     692        Make/O/T/N=1 $(detectorBase + ":name") = {"MiddleRight"} 
     693        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     694        // Create SASdetector type entry 
     695        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     696        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     697        // Create SASdetector distance entry 
     698        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"MR")} 
     699        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     700        // Create SASdetector beam_center_x entry 
     701        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"MR")} 
     702        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     703        // Create SASdetector beam_center_y entry 
     704        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"MR")} 
     705        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     706        // Create SASdetector x_pixel_size entry 
     707        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"MR")} 
     708        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     709        // Create SASdetector y_pixel_size entry 
     710        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"MR")} 
     711        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     712                         
     713        // SASdetector - Back High Res 
     714        detectorParent = instrParent + "sasdetector9/" 
     715        // Create SASdetector entry 
     716        detectorBase = instrumentBase + ":sasdetector9" 
     717        NewDataFolder/O/S $(detectorBase) 
     718        Make/O/T/N=5 $(detectorBase + ":attr") = {"canSAS_class","NX_class"} 
     719        Make/O/T/N=5 $(detectorBase + ":attrVals") = {"SASdetector","NXdetector"} 
     720        CreateStrNxCansas(fileID,detectorParent,"","",empty,$(detectorBase + ":attr"),$(detectorBase + ":attrVals")) 
     721        // Create SASdetector name entry 
     722        Make/O/T/N=1 $(detectorBase + ":name") = {"HighResolutionBack"} 
     723        CreateStrNxCansas(fileID,detectorParent,"","name",$(detectorBase + ":name"),empty,empty) 
     724        // Create SASdetector type entry 
     725        Make/O/T/N=1 $(detectorBase + ":type") = {"He3 gas cylinder"} 
     726        CreateStrNxCansas(fileID,detectorParent,"","type",$(detectorBase + ":type"),empty,empty) 
     727        // Create SASdetector distance entry 
     728        Make/O/N=1 $(detectorBase + ":SDD") = {V_getDet_ActualDistance(folderStr,"B")} 
     729        CreateVarNxCansas(fileID,detectorParent,"","SDD",$(detectorBase + ":SDD"),units,cm) 
     730        // Create SASdetector beam_center_x entry 
     731        Make/O/N=1 $(detectorBase + ":beam_center_x") = {V_getDet_beam_center_x_mm(folderStr,"B")} 
     732        CreateVarNxCansas(fileID,detectorParent,"","beam_center_x",$(detectorBase + ":beam_center_x"),units,mm) 
     733        // Create SASdetector beam_center_y entry 
     734        Make/O/N=1 $(detectorBase + ":beam_center_y") = {V_getDet_beam_center_y_mm(folderStr,"B")} 
     735        CreateVarNxCansas(fileID,detectorParent,"","beam_center_y",$(detectorBase + ":beam_center_y"),units,mm) 
     736        // Create SASdetector x_pixel_size entry 
     737        Make/O/N=1 $(detectorBase + ":x_pixel_size") = {V_getDet_x_pixel_size(folderStr,"B")} 
     738        CreateVarNxCansas(fileID,detectorParent,"","x_pixel_size",$(detectorBase + ":x_pixel_size"),units,mm) 
     739        // Create SASdetector y_pixel_size entry 
     740        Make/O/N=1 $(detectorBase + ":y_pixel_size") = {V_getDet_y_pixel_size(folderStr,"B")} 
     741        CreateVarNxCansas(fileID,detectorParent,"","y_pixel_size",$(detectorBase + ":y_pixel_size"),units,mm) 
     742         
    493743        // SASsource 
    494744        String sourceParent = instrParent + "sassource/" 
     
    500750        CreateStrNxCansas(fileID,sourceParent,"","",empty,$(sourceBase + ":attr"),$(sourceBase + ":attrVals")) 
    501751        // Create SASsource radiation entry 
    502         Make/O/T/N=1 $(sourceBase + ":radiation") = {V_getSourceType(folderStr} 
     752        Make/O/T/N=1 $(sourceBase + ":radiation") = {V_getSourceType(folderStr)} 
    503753        CreateStrNxCansas(fileID,sourceParent,"","radiation",$(sourceBase + ":radiation"),empty,empty) 
    504754        // Create SASsource incident_wavelength entry 
Note: See TracChangeset for help on using the changeset viewer.