Ignore:
Timestamp:
Jul 6, 2012 5:29:38 PM (10 years ago)
Author:
srkline
Message:

Added support for reading 4-column data into the 2D reader

Calculation of kappa for ABS now does a specific byte check for ensuring a "good" DIV file. hopefully this will eliminate errors where incorrect DIV files are selected and bad kappa values are generated - and the program thinks (incorrectly) that there is a valid DVI file present, when there really isn't one (and then there is no easy recovery from this)

Added CheckIfDIVData() functions to NCNR_Utils and to FACILITY_Utils, and to other (facility)_Utils

Changed the calls to writing BT5 files after adding so that it could be more easily scripted in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/BT5_AddFiles.ipf

    r807 r857  
    1212//      - it can be repeated multiple times to add more than two files together 
    1313//      - the two added files are listed in the title of the summed file. 
     14// -- see AddBT5AndSave() if you want something that cen be automated to bypass the user dialogs. 
    1415 
    1516// Adding two data sets: 
     
    758759        LoadAndAddUSANS(file1,file2) 
    759760         
    760 End 
     761        String filen = file1[0,strlen(file1)-5]+"_SUM"+".BT5" 
     762         
     763        GetAddedFileName(filen) 
     764End 
     765 
     766Proc GetAddedFileName(newName) 
     767        String newName 
     768        Prompt newName, "Enter new FileName" 
     769         
     770        SaveAddedBT5Files(newName,1)                    // 1 asks to confirm the name w/ a dialog 
     771End 
     772 
     773 
     774// this procedure will add two and name without any dialogs. Pass it the three names 
     775// if the save name is null, you'll get a dialog 
     776Proc AddBT5AndSave(file1,file2,filen) 
     777        String file1,file2,filen="TMP.BT5" 
     778        Prompt file1, "First File", popup, BT5FileList("") 
     779        Prompt file2, "Second File", popup, BT5FileList("") 
     780        Prompt filen, "output file name" 
     781         
     782        LoadAndAddUSANS(file1,file2) 
     783         
     784//      String filen = file1[0,strlen(file1)-5]+"_SUM"+".BT5" 
     785 
     786        PathInfo savePathName    
     787        filen = S_Path + filen  
     788        SaveAddedBT5Files(filen,0)              //0==no dialog 
     789 
     790End 
     791 
     792 
    761793 
    762794Function/S BT5FileList(filter) 
     
    896928        endfor 
    897929         
    898         // write out the final file (=tw3) 
    899         filen = file1[0,strlen(file1)-5]+"_SUM"+ext 
     930//      // write out the final file (=tw3) 
     931//      filen = file1[0,strlen(file1)-5]+"_SUM"+ext 
     932//       
     933//      if(dialog) 
     934//              PathInfo/S savePathName 
     935//              fullPath = DoSaveFileDialog("Save data as",fname=filen) 
     936//              If(cmpstr(fullPath,"")==0) 
     937//                      //user cancel, don't write out a file 
     938//                      Close/A 
     939//                      Abort "no data file was written" 
     940//              Endif 
     941//              //Print "dialog fullpath = ",fullpath 
     942//      Endif 
     943//       
     944//      Open refNum as fullPath 
     945//      wfprintf refnum, "%s",tw3 
     946//      Close refnum 
     947//               
     948//      //killwaves/Z tw1,tw2,tw3 
     949         
     950        return(0) 
     951end 
     952 
     953// if you bypass the dialog, newname needs to be a full path 
     954Function SaveAddedBT5Files(newName,dialog) 
     955        String newName 
     956        Variable dialog 
     957         
     958        Variable refnum 
     959        String fullPath 
     960         
     961        WAVE/T tw3=tw3 
    900962         
    901963        if(dialog) 
    902964                PathInfo/S savePathName 
    903                 fullPath = DoSaveFileDialog("Save data as",fname=filen) 
     965                fullPath = DoSaveFileDialog("Save data as",fname=newName) 
    904966                If(cmpstr(fullPath,"")==0) 
    905967                        //user cancel, don't write out a file 
     
    907969                        Abort "no data file was written" 
    908970                Endif 
     971                newName=FullPath 
    909972                //Print "dialog fullpath = ",fullpath 
    910973        Endif 
    911          
    912         Open refNum as fullPath 
     974 
     975 
     976        Open refNum as newName 
    913977        wfprintf refnum, "%s",tw3 
    914978        Close refnum 
    915                  
    916         //killwaves/Z tw1,tw2,tw3 
    917          
     979 
    918980        return(0) 
    919 end 
     981End 
    920982 
    921983//returns count time and start/stop angles as written in header 
Note: See TracChangeset for help on using the changeset viewer.