Ignore:
Timestamp:
Jun 7, 2019 2:50:13 PM (4 years ago)
Author:
srkline
Message:

changed the file extension on VSANS QxQyASCII output to have the panel tag in th
e middle of the name to keep the .DAT extension visible for sasView

Changed the behavior of the VSANS averaging protocol. When "saving file" is selceted, choices are either to concatenate or individual. concatenate has NOT been changed. Individual save will now save each individual detector panel data in as
eparate file with the detectr panel string tagged on the end. This replaces the
tedious procedure of multiple mask files an multiple reduction passes.

The save as ITX function is still available through a menu option but is current
ly not an option for a protocol.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf

    r1151 r1166  
    5757Strconstant ksBinType2 = "FTB;FLR;MTB;MLR;B;" 
    5858Strconstant ksBinType3 = "FLRTB;MLRTB;B;" 
    59 //Strconstant ksBinType4 = "FT;FB;FL;FR;MT;MB;ML;MR;B;" 
    6059Strconstant ksBinType4 = "FL;FR;ML;MR;B;"               //in SLIT mode, disregard the T/B panels 
    6160Strconstant ksBinType5 = "FTB;FLR;MLRTB;B;" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf

    r1154 r1166  
    33503350                                         
    33513351                                        V_Write1DData("root:Packages:NIST:VSANS:",activeType,newFileName+"."+exten)             //don't pass the full path, just the name 
    3352                                  
     3352                                        Print "data written to:  "+ newFileName+"."+exten 
    33533353                                endif 
    33543354                                 
     
    33573357                                        // does not trim any other points from the data 
    33583358                                        V_RemoveQ0_B(activeType) 
    3359                                         V_Write1DData_ITX("root:Packages:NIST:VSANS:",activeType,newFileName,binType) 
     3359//                                      V_Write1DData_ITX("root:Packages:NIST:VSANS:",activeType,newFileName,binType) 
     3360 
     3361                                        V_Write1DData_Individual("root:Packages:NIST:VSANS:",activeType,newFileName,exten,binType) 
    33603362                                endif 
    3361                                 Print "data written to:  "+ newFileName+"."+exten 
    33623363 
    33633364                                break 
    33643365         
    33653366                                 
    3366                                 case "2D_ASCII": 
     3367                        case "2D_ASCII": 
    33673368//                              Fast2DExport(activeType,fullPath,dialog) 
    33683369                                break 
    33693370                        case "QxQy_ASCII": 
    3370                                 fullPath = S_Path + newFileName+".DAT" 
     3371                                fullPath = S_Path + newFileName  //+".DAT"              add the .DAT and detector panel in the writer, not here 
    33713372                                V_QxQy_Export(activeType,fullPath,newFileName,dialog) 
    33723373                                break 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_QIS.ipf

    r1152 r1166  
    33 
    44 
    5  
    6 // TODO: 
    7 // -- this is a temporary solution before a real writer is created 
    8 // -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
    9 // -- but a real writer will need to be aware of resolution, and there may be different forms 
    10 // 
    11 // this will bypass save dialogs 
    12 // -- AND WILL OVERWITE DATA WITH THE SAME NAME 
     5// 
     6// this is the general writer for output of 1D averaged I(q) datasets 
    137// 
    148Function V_Write1DData(pathStr,folderStr,saveName) 
     
    148142        return(0) 
    149143End 
     144 
     145 
     146// 
     147// this is the general writer for output of 1D averaged I(q) datasets 
     148// this version is limited to three column data where there is no 
     149// resolution information present 
     150// 
     151Function V_Write1DData_3Col(pathStr,folderStr,saveName) 
     152        String pathStr,folderStr,saveName 
     153         
     154        String formatStr="",fullpath="" 
     155        Variable refnum,dialog=1 
     156 
     157        SetDataFolder $(pathStr+folderStr) 
     158 
     159        Wave qw = tmp_q 
     160        Wave iw = tmp_i 
     161        Wave sw = tmp_s 
     162//      Wave sigQ = tmp_sq 
     163//      Wave qbar = tmp_qb 
     164//      Wave fs = tmp_fs 
     165         
     166        String dataSetFolderParent,basestr 
     167         
     168        // ParseFilePath to get path without folder name 
     169//      dataSetFolderParent = ParseFilePath(1,folderStr,":",1,0) 
     170        // ParseFilePath to get basestr 
     171//      basestr = ParseFilePath(0,folderStr,":",1,0) 
     172         
     173        SVAR gProtoStr = root:Packages:NIST:VSANS:Globals:Protocols:gProtoStr 
     174        Wave/T proto=$("root:Packages:NIST:VSANS:Globals:Protocols:"+gProtoStr)  
     175         
     176        SVAR samFiles = root:Packages:NIST:VSANS:Globals:Protocols:gSAM 
     177         
     178        //make sure the waves exist 
     179         
     180        if(WaveExists(qw) == 0) 
     181                Abort "q is missing" 
     182        endif 
     183        if(WaveExists(iw) == 0) 
     184                Abort "i is missing" 
     185        endif 
     186        if(WaveExists(sw) == 0) 
     187                Abort "s is missing" 
     188        endif 
     189//      if(WaveExists(sigQ) == 0) 
     190//              Abort "Resolution information is missing." 
     191//      endif 
     192        if(WaveExists(proto) == 0) 
     193                Abort "protocol information is missing." 
     194        endif 
     195 
     196 
     197// if the "default" trimming is used, the proto[] values will be null 
     198// fill them in with the default values 
     199        String protoStr7,protoStr8 
     200        if(strlen(proto[7]) == 0) 
     201                protoStr7 = "(Default) "+ ksBinTrimBegDefault 
     202        else 
     203                protoStr7 = proto[7] 
     204        endif 
     205        if(strlen(proto[8]) == 0) 
     206                protoStr8 = "(Default) "+ ksBinTrimEndDefault 
     207        else 
     208                protoStr8 = proto[8] 
     209        endif    
     210 
     211        PathInfo catPathName 
     212        fullPath = S_Path + saveName 
     213 
     214        Open refnum as fullpath 
     215 
     216        fprintf refnum,"Combined data written from folder %s on %s\r\n",folderStr,(date()+" "+time()) 
     217 
     218        //insert protocol information here 
     219        //-1 list of sample files 
     220        //0 - bkg 
     221        //1 - emp 
     222        //2 - div 
     223        //3 - mask 
     224        //4 - abs params c2-c5 
     225        //5 - average params 
     226        //6 - DRK (unused in VSANS) 
     227        //7 - beginning trim points 
     228        //8 - end trim points 
     229        fprintf refnum, "SAM: %s\r\n",samFiles 
     230        fprintf refnum, "BGD: %s\r\n",proto[0] 
     231        fprintf refnum, "EMP: %s\r\n",Proto[1] 
     232        fprintf refnum, "DIV: %s\r\n",Proto[2] 
     233        fprintf refnum, "MASK: %s\r\n",Proto[3] 
     234        fprintf refnum, "ABS Parameters (3-6): %s\r\n",Proto[4] 
     235        fprintf refnum, "Average Choices: %s\r\n",Proto[5] 
     236        fprintf refnum, "Beginning Trim Points: %s\r\n",ProtoStr7 
     237        fprintf refnum, "End Trim Points: %s\r\n",ProtoStr8 
     238        fprintf refnum, "COLLIMATION=%s\r\n",proto[9] 
     239 
     240 
     241        // three column version 
     242        formatStr = "%15.4g %15.4g %15.4g\r\n"   
     243        fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm)\r\n"  
     244// 
     245        wfprintf refnum,formatStr,qw,iw,sw 
     246 
     247        Close refnum 
     248         
     249//      KillWaves/Z sigQ,qbar,fs 
     250        Print "Data written to: ",fullpath 
     251         
     252        SetDataFolder root: 
     253        return(0) 
     254End 
     255 
     256 
     257// 
     258// This saves the data in individual files for each detector panel. They are meant only for 
     259// troubleshooting, but the files are in the general ascii format (without resolution) 
     260// so only three columns are written out 
     261// 
     262// this will bypass save dialogs 
     263// -- AND WILL OVERWRITE DATA WITH THE SAME NAME 
     264// 
     265Function V_Write1DData_Individual(pathStr,folderStr,saveName,exten,binType) 
     266        String pathStr,folderStr,saveName,exten 
     267        Variable binType 
     268         
     269        String formatStr="",fullpath="",item,fileName,detList 
     270        Variable refnum,num,ii 
     271 
     272        SetDataFolder $(pathStr+folderStr) 
     273 
     274        NVAR gIgnoreB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB 
     275 
     276        // while in the proper data folder, loop through the detector files 
     277        // and write out each individual panel (or sets of panels) as specified  
     278        // by the binning type. 
     279        // 
     280        // copy the desired files over to tmp_q, tmp_i, and tmp_s, then  
     281        // pass to a worker Function 
     282        // 
     283         
     284        // 
     285        //  ksBinType1 = "FT;FB;FL;FR;MT;MB;ML;MR;B;"           //these are the "active" extensions 
     286        //  ksBinType2 = "FTB;FLR;MTB;MLR;B;" 
     287        //  ksBinType3 = "FLRTB;MLRTB;B;" 
     288        //  ksBinType4 = "FL;FR;ML;MR;B;"               //in SLIT mode, disregard the T/B panels 
     289         
     290         
     291        switch(binType) 
     292                case 1:         // 9 sets = 27 waves!  ksBinType1 
     293                        detList = ksBinType1 
     294                         
     295                        break 
     296                case 2:         // 5 sets 
     297                        detList = ksBinType2 
     298                        break 
     299                case 3:         // 3 sets 
     300                        detList = ksBinType3 
     301                        break 
     302                case 4:         // 9 sets 
     303                        detList = ksBinType4 
     304                        break 
     305                                         
     306                default: 
     307                // do nothing, just close 
     308 
     309        endswitch 
     310 
     311        num=ItemsInList(detList) 
     312        for(ii=0;ii<num;ii+=1) 
     313                SetDataFolder $(pathStr+folderStr) 
     314 
     315                item=StringFromList(ii, detList) 
     316                 
     317                if(gIgnoreB && cmpstr(item,"B") == 0) 
     318                        //do nothing 
     319                else 
     320                        fileName = saveName + "_"+item+"."+exten 
     321                        Wave qWave = $("qBin_qxqy_"+item) 
     322                        Wave iWave = $("iBin_qxqy_"+item) 
     323                        Wave eWave = $("eBin_qxqy_"+item) 
     324                        KillWaves/Z tmp_q, tmp_i, tmp_s 
     325                        Duplicate/O qWave tmp_q 
     326                        Duplicate/O iWave tmp_i 
     327                        Duplicate/O eWave tmp_s 
     328                        V_Write1DData_3Col(pathStr,folderStr,fileName) 
     329                endif 
     330                 
     331        endfor 
     332         
     333        SetDataFolder root: 
     334        return(0) 
     335End 
     336 
     337 
    150338 
    151339 
     
    416604 
    417605                detStr = StringFromList(kk, detList, ";") 
    418                 detSavePath = fullPath + "_" + detStr 
     606                detSavePath = fullPath + "_" + detStr + ".DAT" 
    419607                 
    420608                pixX = V_getDet_pixel_num_x(type,detStr) 
Note: See TracChangeset for help on using the changeset viewer.