Ignore:
Timestamp:
Jul 17, 2019 4:50:44 PM (4 years ago)
Author:
krzywon
Message:

Tie NXcanSAS into reduction methods and add debugging statements.

Location:
sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/VSANS
Files:
2 edited

Legend:

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

    r1154 r1182  
    32753275        String fullpath = "", newfileName="" 
    32763276        String saveType = StringByKey("SAVE",avgStr,"=",";")            //does user want to save data? 
     3277        NVAR useNXcanSASOutput = root:Packages:NIST:gNXcanSAS_Write 
    32773278 
    32783279        If( (cmpstr(saveType[0,2],"Yes")==0) && (cmpstr(av_type,"none") != 0) )          
     
    33413342//                              endif 
    33423343// 
     3344                                 
    33433345                                if(cmpstr(saveType,"Yes - Concatenate")==0) 
    33443346                                        V_Trim1DDataStr(activeType,binType,trimBegStr,trimEndStr)                       // x- passing null strings uses global or default trim values 
     
    33483350                                        V_RemoveDuplicateQvals("root:Packages:NIST:VSANS:",activeType)          // works with the "tmp_x" waves from concatenateForSave 
    33493351//                                      prot[9] = collimationStr 
    3350                                          
    3351                                         V_Write1DData("root:Packages:NIST:VSANS:",activeType,newFileName+"."+exten)             //don't pass the full path, just the name 
     3352                                        if (useNXcanSASOutput == 1) 
     3353                                                WriteNxCanSAS1D(activeType,fullPath,dialog) 
     3354                                        else 
     3355                                                V_Write1DData("root:Packages:NIST:VSANS:",activeType,newFileName+"."+exten)             //don't pass the full path, just the name 
     3356                                        EndIf 
    33523357                                 
    33533358                                endif 
     
    33713376                                V_QxQy_Export(activeType,fullPath,newFileName,dialog) 
    33723377                                break 
     3378                        case "2D_NXcanSAS": 
     3379                                fullPath = S_Path + newFileName+".h5" 
     3380                                V_WriteNXcanSAS2DData(activeType,fullPath,newFileName,dialog) 
     3381                                break 
    33733382                        case "PNG_Graphic": 
    33743383//                              SaveAsPNG(activeType,fullpath,dialog) 
  • sans/Dev/branches/nxcansas_writer/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_NXcanSAS.ipf

    r1181 r1182  
    1414         
    1515        SetDataFolder $(pathStr+folderStr) 
     16         
     17        Print "Starting the process of writing to NXcanSAS files" 
    1618         
    1719        // Check fullpath and dialog 
     
    7274        Make/O/T/N=1 $(parentBase + ":run") = {V_getExperiment_identifier(folderStr)} 
    7375        CreateStrNxCansas(fileID,nxcansasBase,"","run",$(parentBase + ":run"),empty,empty) 
     76         
     77        Print "Writing VSANS 1D Data in NXcanSAS format" 
    7478         
    7579        // SASData 
     
    97101        CreateVarNxCansas(fileID,dataParent,"sasdata","Qmean",qbar,units,inv_angstrom) 
    98102         
     103        Print "Writing VSANS Meta Data in NXcanSAS format" 
     104         
    99105        // Write all VSANS meta data 
    100106        V_WriteMetaData(fileID,parentBase,nxcansasBase,folderStr,proto) 
     
    217223                pixY = V_getDet_pixel_num_y(type,detStr) 
    218224                 
    219                 fileName = newFileName 
     225                fileName = saveName 
    220226                fileDate = V_getDataStartTime(type)             // already a string 
    221227                fileLabel = V_getSampleDescription(type) 
     
    299305 
    300306                Variable ret1,ret2,ret3,nq 
    301                 String collimationStr 
    302                  
    303                  
    304                 collimationStr = proto[9] 
     307                String collimationStr = proto[9] 
    305308                 
    306309                nq = pixX*pixY 
     
    321324v_tic() 
    322325                Make/O/N=(2,pixX,pixY) qxy_vals 
    323                 //everything in 1D now 
    324326                Make/O/N=(pixX,pixY) shadow 
    325327                Make/O/N=(2,pixX,pixY) SigmaQ_combined 
     
    327329                        jj = 0 
    328330                        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                                nq = ii * pixX + jj 
     332                                V_get2DResolution(qval[nq],phi[nq],r_dist[nq],folderStr,detStr,collimationStr,ret1,ret2,ret3) 
    331333                                qxy_vals[0][ii][jj] = qx_val[nq] 
    332334                                qxy_vals[1][ii][jj] = qy_val[nq] 
    333                                 SigmaQ_combined[0][ii][jj] = ret1        
     335                                SigmaQ_combined[0][ii][jj] = ret1 
    334336                                SigmaQ_combined[1][ii][jj] = ret2 
    335                                 shadow[ii][jj] = ret3    
     337                                shadow[ii][jj] = ret3 
    336338                                jj+=1 
    337                         while(jj<pixelsX) 
     339                        while(jj<pixX) 
    338340                        ii+=1 
    339                 while(ii<pixelsY) 
    340 v_toc()  
     341                while(ii<pixY) 
     342v_toc() 
     343 
    341344        ////*********************        
    342345                Duplicate/O qx_val,qx_val_s 
     
    355358                Redimension/N=(pixX*pixY) qx_val_s,qy_val_s,qz_val_s,z_val_s,sw_s 
    356359                 
     360                String dataParent,dataBase 
    357361                // SASData 
    358                 String dataParent = nxcansasBase + "sasdata" + kk + "/" 
     362                sPrintf dataParent,"%ssasdata%d/",nxcansasBase,kk 
    359363                // Create SASdata entry 
    360                 String dataBase = parentBase + ":sasdata" + kk 
     364                sPrintf dataBase,"%s:sasdata%d",parentBase,kk 
    361365                NewDataFolder/O/S $(dataBase) 
    362366                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]} 
     367                Make/O/T/N=5 $(dataBase + ":attrVals") = {"SASdata","I","Q,Q","NXdata","0,1",V_getDataEndTime(folderStr)} 
    364368                CreateStrNxCansas(fileID,dataParent,"","",empty,$(dataBase + ":attr"),$(dataBase + ":attrVals")) 
    365369                // Create i entry 
     
    386390                 
    387391                KillWaves/Z qx_val_s,qy_val_s,z_val_s,qz_val_s,SigmaQx_s,SigmaQy_s,fSubS_s,sw,sw_s 
    388                  
    389392                Killwaves/Z qval,sigmaQx,SigmaQy,fSubS,phi,r_dist 
    390                  
    391                  
    392393         
    393394        endfor 
     
    395396        KillWaves/Z labelWave,dum 
    396397         
    397          
    398          
    399         // Write all meta data 
    400         WriteMetaData(fileID,parentBase,nxcansasBase,rw,textw) 
     398        // Write all VSANS meta data 
     399        V_WriteMetaData(fileID,parentBase,nxcansasBase,folderStr,proto) 
     400                 
     401        // 
     402        /////////////////////////////////////////////////////////////////////////// 
    401403         
    402404        // Close the file 
Note: See TracChangeset for help on using the changeset viewer.