Ignore:
Timestamp:
Jun 7, 2019 2:50:13 PM (3 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.