Changeset 1073 for sans/Dev/trunk


Ignore:
Timestamp:
Nov 16, 2017 10:57:32 AM (5 years ago)
Author:
srkline
Message:

lots of changes here:
many little fixes to clean up TODO items and marke them DONE

changed the handling of the panel "gap" to split the gap evenly. Q-calculations have been re-verified with this change.

re-named the list of "bin Type" values, and added a few more choices. Streamlined how the averaging and plotting works with this list so that it can be more easily modified as different combinations of binning are envisioned. This resulted in a lot of excess code being cut out and replaced with cleaner logic. This change has also been verified to work as intended.

Attenuation is now always calculated from the table. The table also by (NEW) definition has values for the white beam (one waelength) and graphite (multiple possible wavelengths) where the wavelengths are artificially scaled (*1000) or *1e6) so that the interpolations can be done internally without the need for multiple attenuator tables.

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

Legend:

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

    r1071 r1073  
    1616#include "PlotManager_v40" 
    1717#include "NIST_XML_v40" 
     18// 
     19//#include "NCNR_Utils"         //needed to load linear fits, mostly VAX file name junk 
     20//#include "LinearizedFits_v40"         //won't compile - needs NCNR_Utils (then starts a chain of dependencies...) 
    1821 
    1922 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Attenuation.ipf

    r1071 r1073  
    33 
    44 
     5// 
     6// 7-NOV-2017 
     7//  
     8// The attenuator tables are more complex now - since there are more ways to select wavelength 
     9// - there is the standard velocity selector (no tilt) 
     10// - a white beam mode (with a non-symmetric distribution) 
     11// - a graphite monochromator, allowing wavelength selection 
     12// 
     13// To accomodate this, I have chosen to alter the table to allow all of the wavelength "modes" 
     14// to be in the same table for interpolation, by use of the "correct" input wavelength 
     15// velocity_selector lambda is input as is 
     16// white beam lambda = (lambda * 1e3) 
     17// graphite crystal lambda = (lambda * 1e6) 
     18// 
     19// in this way, the interpolation will work just fine. Otherwise, the only solution I could see was to  
     20// have separate tables stored in the header for each of the "modes". 
     21// 
     22// 
     23 
     24// 
    525// functions to calculate attenuator values from the tables 
    626// 
     
    929// 
    1030// interpolate if necessary 
    11  
     31// 
    1232 
    1333// 
     
    1535// 
    1636// 
    17 // 
    18  
    19  
    20 // attenuator tables are currently /N=(8,17) 
     37// attenuator tables are currently /N=(n,17) 
    2138 
    2239 
     
    5471Proc V_WriteCSVAttenTable(lo,hi,atten_values) 
    5572        Variable lo,hi 
    56         String atten_values 
     73        String atten_values="atten_values" 
    5774 
    5875        V_fPatchAttenValueTable(lo,hi,$atten_values) 
     
    6178Proc V_WriteCSVAttenErrTable(lo,hi,atten_err) 
    6279        Variable lo,hi 
    63         String atten_err 
     80        String atten_err="atten_err" 
    6481 
    6582        V_fPatchAttenErrTable(lo,hi,$atten_err) 
     
    7895        String fname 
    7996         
    80         // check the dimensions of the attenW (8,17) 
    81         if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 ) 
    82                 Abort "attenuator wave is not of proper dimension (8,17)" 
    83         endif 
     97//      // check the dimensions of the attenW (8,17) 
     98//      if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 ) 
     99//              Abort "attenuator wave is not of proper dimension (8,17)" 
     100//      endif 
    84101         
    85102        //loop over all files 
     
    107124        String fname 
    108125         
    109         // check the dimensions of the attenW (8,17) 
    110         if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 ) 
    111                 Abort "attenuator wave is not of proper dimension (8,17)" 
    112         endif 
     126//      // check the dimensions of the attenW (8,17) 
     127//      if (DimSize(attenW, 0) != 8 || DimSize(attenW, 1) != 17 ) 
     128//              Abort "attenuator wave is not of proper dimension (8,17)" 
     129//      endif 
    113130         
    114131        //loop over all files 
     
    132149// 
    133150// fill in a "dummy" wavelength for White Beam and graphite 
    134 // == 100 for White Beam 
    135 // == 1000 for graphite 
     151// *= 1e3 for White Beam 
     152// *= 1e6 for graphite 
    136153// use these dummy values just for the lookup table 
    137154// 
    138155// TODO -- need the enumerated values for the monochromator type 
    139156// TODO -- V_getMonochromatorType(fname) is NOT written correctly by NICE 
    140 // 
     157// TODO -- determine the dimensions of the wave, don't hard-wire 
     158// TODO -- update to use separate tables for each monochromator mode 
     159// TODO -- (same updates for the error table) 
    141160// 
    142161Function V_CalculateAttenuationFactor(fname) 
     
    162181                        break           // exit from switch 
    163182                case "white_beam":      // execute if case matches expression 
    164                         lambda = 100 
     183                        lambda *= 1e3 
    165184                        break 
    166185                case "crystal": 
    167                         lambda = 1000 
     186                        lambda *= 1e6 
    168187                        break 
    169188                default:                        // optional default expression executed 
     
    172191         
    173192         
    174         Wave w = V_getAttenIndex_table(fname)           // N=(8,17) 
    175         Make/O/D/N=8 tmpVal,tmpLam 
     193        Wave w = V_getAttenIndex_table(fname)           // N=(x,17) 
     194        Variable num = DimSize(w,0) 
     195        Make/O/D/N=(num) tmpVal,tmpLam                                           
    176196         
    177197        tmpVal = w[p][numAtt+1]         // offset by one, 1st column is wavelength 
    178198        tmpLam = w[p][0] 
    179199        val = interp(lambda, tmpLam, tmpVal ) 
     200        Print "Calculated Atten = ",val 
    180201         
    181202        //killwaves/Z tmpVal,tmpLam 
     
    189210// 
    190211// fill in a "dummy" wavelength for White Beam and graphite 
    191 // == 100 for White Beam 
    192 // == 1000 for graphite 
     212// *= 1e3 for White Beam 
     213// *= 1e6 for graphite 
    193214// use these dummy values just for the lookup table 
    194215// 
     
    196217// TODO -- V_getMonochromatorType(fname) is NOT written correctly by NICE 
    197218// 
     219// 
    198220Function V_CalculateAttenuationError(fname) 
    199221        String fname 
     
    206228         
    207229        // TODO -- need to switch on "type" 
    208         //  == velocity_selector || ?? for white beam || graphite 
     230        //  == velocity_selector || ?? for white beam || crystal 
    209231//      monoType = V_getMonochromatorType(fname) 
    210232         
     
    217239                        break           // exit from switch 
    218240                case "white_beam":      // execute if case matches expression 
    219                         lambda = 100 
     241                        lambda *= 1e3 
    220242                        break 
    221243                case "crystal": 
    222                         lambda = 1000 
     244                        lambda *= 1e6 
    223245                        break 
    224246                default:                        // optional default expression executed 
     
    226248        endswitch        
    227249         
    228         Wave w = V_getAttenIndex_error_table(fname)             // N=(8,17) 
    229         Make/O/D/N=8 tmpVal,tmpLam 
     250        Wave w = V_getAttenIndex_error_table(fname)             // N=(x,17) 
     251        Variable num = DimSize(w,0) 
     252        Make/O/D/N=(num) tmpVal,tmpLam 
    230253         
    231254        tmpVal = w[p][numAtt+1]         // offset by one, 1st column is wavelength 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DataPlotting.ipf

    r1050 r1073  
    408408        SVAR type = root:Packages:NIST:VSANS:Globals:gCurDispType 
    409409 
    410         V_QBinAllPanels_Circular(type,popNum) 
     410// dispatch based on the string, not on the number of selection in the pop string 
     411        V_QBinAllPanels_Circular(type,V_BinTypeStr2Num(popStr)) 
    411412 
    412413        String str,winStr="V_1D_Data",workTypeStr 
    413414        workTypeStr = "root:Packages:NIST:VSANS:"+type 
    414415         
    415         sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,popNum,winStr 
     416        sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,V_BinTypeStr2Num(popStr),winStr 
    416417 
    417418        Execute ("V_Back_IQ_Graph"+str) 
     
    460461 
    461462// clear EVERYTHING 
    462  
     463        ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 
     464        ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 
     465        ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root: 
     466        ClearIQIfDisplayed_AllFldr("MT",winNameStr)      
     467        ClearIQIfDisplayed_AllFldr("ML",winNameStr)      
     468        ClearIQIfDisplayed_AllFldr("MR",winNameStr)      
     469        ClearIQIfDisplayed_AllFldr("MB",winNameStr)              
     470 
     471 
     472// then replace the traces as needed, depending on the binType 
    463473 
    464474        if(binType==1) 
    465                 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 
    466                 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 
    467                 ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root: 
    468                 ClearIQIfDisplayed_AllFldr("MT",winNameStr)      
    469                 ClearIQIfDisplayed_AllFldr("ML",winNameStr)      
    470                 ClearIQIfDisplayed_AllFldr("MR",winNameStr)      
    471                 ClearIQIfDisplayed_AllFldr("MB",winNameStr)                      
     475         
    472476                SetDataFolder $(fullPathToFolder) 
    473477                CheckDisplayed/W=$winNameStr iBin_qxqy_ML 
     
    495499         
    496500        if(binType==2) 
    497 // clear EVERYTHING 
    498                 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 
    499                 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 
    500                 ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root: 
    501                 ClearIQIfDisplayed_AllFldr("MT",winNameStr)      
    502                 ClearIQIfDisplayed_AllFldr("ML",winNameStr)      
    503                 ClearIQIfDisplayed_AllFldr("MR",winNameStr)      
    504                 ClearIQIfDisplayed_AllFldr("MB",winNameStr)              
    505          
    506 //              ClearIQIfDisplayed_AllFldr("MLRTB") 
    507 //              ClearIQIfDisplayed_AllFldr("MT")         
    508 //              ClearIQIfDisplayed_AllFldr("ML")         
    509 //              ClearIQIfDisplayed_AllFldr("MR")         
    510 //              ClearIQIfDisplayed_AllFldr("MB") 
    511          
    512  
    513501                SetDataFolder $(fullPathToFolder) 
    514502                CheckDisplayed/W=$winNameStr iBin_qxqy_MLR 
     
    535523         
    536524        if(binType==3) 
    537 // clear EVERYTHING 
    538                 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 
    539                 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 
    540                 ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root: 
    541                 ClearIQIfDisplayed_AllFldr("MT",winNameStr)      
    542                 ClearIQIfDisplayed_AllFldr("ML",winNameStr)      
    543                 ClearIQIfDisplayed_AllFldr("MR",winNameStr)      
    544                 ClearIQIfDisplayed_AllFldr("MB",winNameStr)              
    545          
    546 //              ClearIQIfDisplayed_AllFldr("MLR") 
    547 //              ClearIQIfDisplayed_AllFldr("MTB")        
    548 //              ClearIQIfDisplayed_AllFldr("MT")         
    549 //              ClearIQIfDisplayed_AllFldr("ML")         
    550 //              ClearIQIfDisplayed_AllFldr("MR")         
    551 //              ClearIQIfDisplayed_AllFldr("MB")         
    552          
     525 
    553526                SetDataFolder $(fullPathToFolder) 
    554527                CheckDisplayed/W=$winNameStr iBin_qxqy_MLRTB 
     
    572545 
    573546        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged 
    574 // clear EVERYTHING 
    575                 ClearIQIfDisplayed_AllFldr("MLRTB",winNameStr) 
    576                 ClearIQIfDisplayed_AllFldr("MLR",winNameStr) 
    577                 ClearIQIfDisplayed_AllFldr("MTB",winNameStr)            //this returns to root: 
    578                 ClearIQIfDisplayed_AllFldr("MT",winNameStr)      
    579                 ClearIQIfDisplayed_AllFldr("ML",winNameStr)      
    580                 ClearIQIfDisplayed_AllFldr("MR",winNameStr)      
    581                 ClearIQIfDisplayed_AllFldr("MB",winNameStr)              
    582          
    583          
    584 //              ClearIQIfDisplayed_AllFldr("MLRTB") 
    585 //              ClearIQIfDisplayed_AllFldr("MLR") 
    586 //              ClearIQIfDisplayed_AllFldr("MTB") 
    587                  
     547 
    588548                SetDataFolder $(fullPathToFolder) 
    589549                CheckDisplayed/W=$winNameStr iBin_qxqy_ML 
     
    592552                        AppendToGraph/W=$winNameStr iBin_qxqy_ML vs qBin_qxqy_ML 
    593553                        AppendToGraph/W=$winNameStr iBin_qxqy_MR vs qBin_qxqy_MR 
    594                         AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT 
    595                         AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB 
     554//                      AppendToGraph/W=$winNameStr iBin_qxqy_MT vs qBin_qxqy_MT 
     555//                      AppendToGraph/W=$winNameStr iBin_qxqy_MB vs qBin_qxqy_MB 
    596556                        ErrorBars/T=0 iBin_qxqy_ML Y,wave=(:eBin_qxqy_ML,:eBin_qxqy_ML) 
    597557                        ErrorBars/T=0 iBin_qxqy_MR Y,wave=(:eBin_qxqy_MR,:eBin_qxqy_MR) 
    598                         ErrorBars/T=0 iBin_qxqy_MT Y,wave=(:eBin_qxqy_MT,:eBin_qxqy_MT) 
    599                         ErrorBars/T=0 iBin_qxqy_MB Y,wave=(:eBin_qxqy_MB,:eBin_qxqy_MB) 
     558//                      ErrorBars/T=0 iBin_qxqy_MT Y,wave=(:eBin_qxqy_MT,:eBin_qxqy_MT) 
     559//                      ErrorBars/T=0 iBin_qxqy_MB Y,wave=(:eBin_qxqy_MB,:eBin_qxqy_MB) 
    600560                         
    601561                        ModifyGraph/W=$winNameStr mode=4 
    602562                        ModifyGraph/W=$winNameStr marker=19 
    603                         ModifyGraph/W=$winNameStr rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MR)=(65535,0,0),rgb(iBin_qxqy_MT)=(1,16019,65535) 
     563                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_ML)=(65535,0,0),rgb(iBin_qxqy_MR)=(65535,0,0) 
     564//                      ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MB)=(1,16019,65535),rgb(iBin_qxqy_MT)=(1,16019,65535) 
    604565                        ModifyGraph/W=$winNameStr msize=2 
    605                         ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MB)={0,2},muloffset(iBin_qxqy_MR)={0,8} 
     566                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_ML)={0,4},muloffset(iBin_qxqy_MR)={0,8} 
     567//                      ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_MB)={0,2} 
    606568                        ModifyGraph/W=$winNameStr grid=1 
    607569                        ModifyGraph/W=$winNameStr log=1 
    608570                        ModifyGraph/W=$winNameStr mirror=2 
    609571                endif            
     572                         
     573        endif 
     574 
     575        if(binType==5) 
     576 
     577                SetDataFolder $(fullPathToFolder) 
     578                CheckDisplayed/W=$winNameStr iBin_qxqy_MLRTB 
     579                 
     580                if(V_flag==0) 
     581                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLRTB vs qBin_qxqy_MLRTB 
     582                        ErrorBars/T=0 iBin_qxqy_MLRTB Y,wave=(:eBin_qxqy_MLRTB,:eBin_qxqy_MLRTB) 
     583                         
     584                        ModifyGraph/W=$winNameStr mode=4 
     585                        ModifyGraph/W=$winNameStr marker=19 
     586                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLRTB)=(65535,0,0) 
     587                        ModifyGraph/W=$winNameStr msize=2 
     588                        ModifyGraph/W=$winNameStr grid=1 
     589                        ModifyGraph/W=$winNameStr log=1 
     590                        ModifyGraph/W=$winNameStr mirror=2 
     591                        Label/W=$winNameStr left "Intensity (1/cm)" 
     592                        Label/W=$winNameStr bottom "Q (1/A)" 
     593                endif    
     594                         
     595        endif 
     596 
     597        if(binType==6) 
     598 
     599                SetDataFolder $(fullPathToFolder) 
     600                CheckDisplayed/W=$winNameStr iBin_qxqy_MLR 
     601                 
     602                if(V_flag==0) 
     603                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLR vs qBin_qxqy_MLR 
     604                        ErrorBars/T=0 iBin_qxqy_MLR Y,wave=(:eBin_qxqy_MLR,:eBin_qxqy_MLR) 
     605                         
     606                        ModifyGraph/W=$winNameStr mode=4 
     607                        ModifyGraph/W=$winNameStr marker=19 
     608                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLR)=(65535,0,0) 
     609                        ModifyGraph/W=$winNameStr msize=2 
     610                        ModifyGraph/W=$winNameStr grid=1 
     611                        ModifyGraph/W=$winNameStr log=1 
     612                        ModifyGraph/W=$winNameStr mirror=2 
     613                        Label/W=$winNameStr left "Intensity (1/cm)" 
     614                        Label/W=$winNameStr bottom "Q (1/A)" 
     615                endif    
     616                         
     617        endif 
     618 
     619        if(binType==7) 
     620 
     621                SetDataFolder $(fullPathToFolder) 
     622                CheckDisplayed/W=$winNameStr iBin_qxqy_MLR 
     623                 
     624                if(V_flag==0) 
     625                        AppendtoGraph/W=$winNameStr iBin_qxqy_MLR vs qBin_qxqy_MLR 
     626                        ErrorBars/T=0 iBin_qxqy_MLR Y,wave=(:eBin_qxqy_MLR,:eBin_qxqy_MLR) 
     627                         
     628                        ModifyGraph/W=$winNameStr mode=4 
     629                        ModifyGraph/W=$winNameStr marker=19 
     630                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_MLR)=(65535,0,0) 
     631                        ModifyGraph/W=$winNameStr msize=2 
     632                        ModifyGraph/W=$winNameStr grid=1 
     633                        ModifyGraph/W=$winNameStr log=1 
     634                        ModifyGraph/W=$winNameStr mirror=2 
     635                        Label/W=$winNameStr left "Intensity (1/cm)" 
     636                        Label/W=$winNameStr bottom "Q (1/A)" 
     637                endif    
    610638                         
    611639        endif 
     
    635663 
    636664// clear EVERYTHING 
    637 //              ClearIQIfDisplayed_AllFldr("FLRTB") 
    638 //               
    639 //              ClearIQIfDisplayed_AllFldr("FLR") 
    640 //              ClearIQIfDisplayed_AllFldr("FTB") 
    641 // 
    642 //              ClearIQIfDisplayed_AllFldr("FT")         
    643 //              ClearIQIfDisplayed_AllFldr("FL")         
    644 //              ClearIQIfDisplayed_AllFldr("FR")         
    645 //              ClearIQIfDisplayed_AllFldr("FB") 
     665        ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 
     666         
     667        ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 
     668        ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 
     669 
     670        ClearIQIfDisplayed_AllFldr("FT",winNameStr)      
     671        ClearIQIfDisplayed_AllFldr("FL",winNameStr)      
     672        ClearIQIfDisplayed_AllFldr("FR",winNameStr)      
     673        ClearIQIfDisplayed_AllFldr("FB",winNameStr) 
    646674                 
    647675        if(binType==1) 
    648                 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 
    649                  
    650                 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 
    651                 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 
    652  
    653                 ClearIQIfDisplayed_AllFldr("FT",winNameStr)      
    654                 ClearIQIfDisplayed_AllFldr("FL",winNameStr)      
    655                 ClearIQIfDisplayed_AllFldr("FR",winNameStr)      
    656                 ClearIQIfDisplayed_AllFldr("FB",winNameStr) 
    657                                  
     676 
    658677                SetDataFolder $(fullPathToFolder) 
    659678                CheckDisplayed/W=$winNameStr iBin_qxqy_FL 
     
    683702         
    684703        if(binType==2) 
    685         // clear EVERYTHING 
    686                 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 
    687                  
    688                 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 
    689                 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 
    690  
    691                 ClearIQIfDisplayed_AllFldr("FT",winNameStr)      
    692                 ClearIQIfDisplayed_AllFldr("FL",winNameStr)      
    693                 ClearIQIfDisplayed_AllFldr("FR",winNameStr)      
    694                 ClearIQIfDisplayed_AllFldr("FB",winNameStr) 
    695 //              ClearIQIfDisplayed_AllFldr("FLRTB") 
    696 //              ClearIQIfDisplayed_AllFldr("FT")         
    697 //              ClearIQIfDisplayed_AllFldr("FL")         
    698 //              ClearIQIfDisplayed_AllFldr("FR")         
    699 //              ClearIQIfDisplayed_AllFldr("FB")         
    700704 
    701705                SetDataFolder $(fullPathToFolder) 
     
    722726        endif 
    723727         
    724         if(binType==3) 
    725 // clear EVERYTHING 
    726                 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 
    727                  
    728                 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 
    729                 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 
    730  
    731                 ClearIQIfDisplayed_AllFldr("FT",winNameStr)      
    732                 ClearIQIfDisplayed_AllFldr("FL",winNameStr)      
    733                 ClearIQIfDisplayed_AllFldr("FR",winNameStr)      
    734                 ClearIQIfDisplayed_AllFldr("FB",winNameStr)      
    735          
    736 //              ClearIQIfDisplayed_AllFldr("FLR") 
    737 //              ClearIQIfDisplayed_AllFldr("FTB")        
    738 //              ClearIQIfDisplayed_AllFldr("FT")         
    739 //              ClearIQIfDisplayed_AllFldr("FL")         
    740 //              ClearIQIfDisplayed_AllFldr("FR")         
    741 //              ClearIQIfDisplayed_AllFldr("FB")         
     728        if(binType==3)   
    742729         
    743730                SetDataFolder $(fullPathToFolder) 
     
    762749 
    763750        if(binType==4)          // slit aperture binning - MT, ML, MR, MB are averaged 
    764 // clear EVERYTHING 
    765                 ClearIQIfDisplayed_AllFldr("FLRTB",winNameStr) 
    766                  
    767                 ClearIQIfDisplayed_AllFldr("FLR",winNameStr) 
    768                 ClearIQIfDisplayed_AllFldr("FTB",winNameStr) 
    769  
    770                 ClearIQIfDisplayed_AllFldr("FT",winNameStr)      
    771                 ClearIQIfDisplayed_AllFldr("FL",winNameStr)      
    772                 ClearIQIfDisplayed_AllFldr("FR",winNameStr)      
    773                 ClearIQIfDisplayed_AllFldr("FB",winNameStr)      
    774          
    775          
    776 //              ClearIQIfDisplayed_AllFldr("FLRTB") 
    777 //              ClearIQIfDisplayed_AllFldr("FLR") 
    778 //              ClearIQIfDisplayed_AllFldr("FTB") 
    779751                 
    780752                SetDataFolder $(fullPathToFolder) 
     
    784756                        AppendtoGraph/W=$winNameStr iBin_qxqy_FL vs qBin_qxqy_FL 
    785757                        AppendToGraph/W=$winNameStr iBin_qxqy_FR vs qBin_qxqy_FR 
    786                         AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT 
    787                         AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB 
     758//                      AppendToGraph/W=$winNameStr iBin_qxqy_FT vs qBin_qxqy_FT 
     759//                      AppendToGraph/W=$winNameStr iBin_qxqy_FB vs qBin_qxqy_FB 
    788760                        ErrorBars/T=0 iBin_qxqy_FL Y,wave=(:eBin_qxqy_FL,:eBin_qxqy_FL) 
    789761                        ErrorBars/T=0 iBin_qxqy_FR Y,wave=(:eBin_qxqy_FR,:eBin_qxqy_FR) 
    790                         ErrorBars/T=0 iBin_qxqy_FT Y,wave=(:eBin_qxqy_FT,:eBin_qxqy_FT) 
    791                         ErrorBars/T=0 iBin_qxqy_FB Y,wave=(:eBin_qxqy_FB,:eBin_qxqy_FB) 
     762//                      ErrorBars/T=0 iBin_qxqy_FT Y,wave=(:eBin_qxqy_FT,:eBin_qxqy_FT) 
     763//                      ErrorBars/T=0 iBin_qxqy_FB Y,wave=(:eBin_qxqy_FB,:eBin_qxqy_FB) 
    792764                         
    793765                        ModifyGraph/W=$winNameStr mode=4 
    794766                        ModifyGraph/W=$winNameStr marker=19 
    795                         ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FR)=(39321,26208,1),rgb(iBin_qxqy_FT)=(2,39321,1) 
     767                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FL)=(39321,26208,1),rgb(iBin_qxqy_FR)=(39321,26208,1) 
     768//                      ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FB)=(2,39321,1),rgb(iBin_qxqy_FT)=(2,39321,1) 
    796769                        ModifyGraph/W=$winNameStr msize=2 
    797                         ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FB)={0,2},muloffset(iBin_qxqy_FR)={0,8} 
     770                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FL)={0,4},muloffset(iBin_qxqy_FR)={0,8} 
     771//                      ModifyGraph/W=$winNameStr,muloffset(iBin_qxqy_FB)={0,2} 
    798772                        ModifyGraph/W=$winNameStr grid=1 
    799773                        ModifyGraph/W=$winNameStr log=1 
     
    802776                         
    803777        endif 
     778 
     779        if(binType==5) 
     780 
     781                SetDataFolder $(fullPathToFolder) 
     782                CheckDisplayed/W=$winNameStr iBin_qxqy_FLR 
     783                 
     784                if(V_flag==0) 
     785                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLR vs qBin_qxqy_FLR 
     786                        AppendToGraph/W=$winNameStr iBin_qxqy_FTB vs qBin_qxqy_FTB 
     787                        ErrorBars/T=0 iBin_qxqy_FLR Y,wave=(:eBin_qxqy_FLR,:eBin_qxqy_FLR) 
     788                        ErrorBars/T=0 iBin_qxqy_FTB Y,wave=(:eBin_qxqy_FTB,:eBin_qxqy_FTB) 
     789 
     790                        ModifyGraph/W=$winNameStr mode=4 
     791                        ModifyGraph/W=$winNameStr marker=19 
     792                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1) 
     793                        ModifyGraph/W=$winNameStr msize=2 
     794                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FLR)={0,2} 
     795                        ModifyGraph/W=$winNameStr grid=1 
     796                        ModifyGraph/W=$winNameStr log=1 
     797                        ModifyGraph/W=$winNameStr mirror=2 
     798//                      Label/W=$winNameStr left "Intensity (1/cm)" 
     799//                      Label/W=$winNameStr bottom "Q (1/A)" 
     800                endif    
     801                         
     802        endif 
     803 
     804        if(binType==6)   
     805         
     806                SetDataFolder $(fullPathToFolder) 
     807                CheckDisplayed/W=$winNameStr iBin_qxqy_FLRTB 
     808                 
     809                if(V_flag==0) 
     810                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLRTB vs qBin_qxqy_FLRTB 
     811                        ErrorBars/T=0 iBin_qxqy_FLRTB Y,wave=(:eBin_qxqy_FLRTB,:eBin_qxqy_FLRTB) 
     812 
     813                        ModifyGraph/W=$winNameStr mode=4 
     814                        ModifyGraph/W=$winNameStr marker=19 
     815                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLRTB)=(39321,26208,1) 
     816                        ModifyGraph/W=$winNameStr msize=2 
     817                        ModifyGraph/W=$winNameStr grid=1 
     818                        ModifyGraph/W=$winNameStr log=1 
     819                        ModifyGraph/W=$winNameStr mirror=2 
     820                        Label/W=$winNameStr left "Intensity (1/cm)" 
     821                        Label/W=$winNameStr bottom "Q (1/A)" 
     822                endif    
     823                         
     824        endif 
     825         
     826        if(binType==7) 
     827 
     828                SetDataFolder $(fullPathToFolder) 
     829                CheckDisplayed/W=$winNameStr iBin_qxqy_FLR 
     830                 
     831                if(V_flag==0) 
     832                        AppendtoGraph/W=$winNameStr iBin_qxqy_FLR vs qBin_qxqy_FLR 
     833                        AppendToGraph/W=$winNameStr iBin_qxqy_FTB vs qBin_qxqy_FTB 
     834                        ErrorBars/T=0 iBin_qxqy_FLR Y,wave=(:eBin_qxqy_FLR,:eBin_qxqy_FLR) 
     835                        ErrorBars/T=0 iBin_qxqy_FTB Y,wave=(:eBin_qxqy_FTB,:eBin_qxqy_FTB) 
     836 
     837                        ModifyGraph/W=$winNameStr mode=4 
     838                        ModifyGraph/W=$winNameStr marker=19 
     839                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_FLR)=(39321,26208,1),rgb(iBin_qxqy_FTB)=(2,39321,1) 
     840                        ModifyGraph/W=$winNameStr msize=2 
     841                        ModifyGraph/W=$winNameStr muloffset(iBin_qxqy_FLR)={0,2} 
     842                        ModifyGraph/W=$winNameStr grid=1 
     843                        ModifyGraph/W=$winNameStr log=1 
     844                        ModifyGraph/W=$winNameStr mirror=2 
     845//                      Label/W=$winNameStr left "Intensity (1/cm)" 
     846//                      Label/W=$winNameStr bottom "Q (1/A)" 
     847                endif    
     848                         
     849        endif 
     850 
    804851         
    805852        SetDataFolder root: 
     
    829876//      binType = V_GetBinningPopMode() 
    830877         
     878        ClearIQIfDisplayed_AllFldr("B",winNameStr) 
     879 
    831880 
    832881        SetDataFolder $(fullPathToFolder)        
    833882 
     883//      if(binType==1 || binType==2 || binType==3) 
    834884        if(binType==1 || binType==2 || binType==3) 
    835885         
    836                 ClearIQIfDisplayed_AllFldr("B",winNameStr) 
    837886                SetDataFolder $(fullPathToFolder)        
    838887                CheckDisplayed/W=$winNameStr iBin_qxqy_B 
     
    851900                endif 
    852901                 
    853 //              ClearIQIfDisplayed_AllFldr("B") 
    854 //              SetDataFolder $(fullPathToFolder)        
    855 //              CheckDisplayed/W=V_1D_Data iBin_qxqy_B 
    856 //               
    857 //              if(V_flag==0) 
    858 //                      AppendtoGraph/W=V_1D_Data iBin_qxqy_B vs qBin_qxqy_B 
    859 //                      ModifyGraph/W=V_1D_Data mode=4 
    860 //                      ModifyGraph/W=V_1D_Data marker=19 
    861 //                      ModifyGraph/W=V_1D_Data rgb(iBin_qxqy_B)=(1,52428,52428) 
    862 //                      ModifyGraph/W=V_1D_Data msize=2 
    863 //                      ModifyGraph/W=V_1D_Data grid=1 
    864 //                      ModifyGraph/W=V_1D_Data log=1 
    865 //                      ModifyGraph/W=V_1D_Data mirror=2 
    866 //              endif 
    867                  
    868902        endif 
    869903 
     
    871905        if(binType==4) 
    872906         
    873                 ClearIQIfDisplayed_AllFldr("B",winNameStr) 
    874907                SetDataFolder $(fullPathToFolder)                               // ClearIQIfDisplayed_AllFldr() resets to root: 
    875908                CheckDisplayed/W=$winNameStr iBin_qxqy_B 
     
    885918                        ModifyGraph/W=$winNameStr mirror=2 
    886919                endif 
     920        endif 
     921 
     922        if(binType==5 || binType==6 || binType==7) 
     923         
     924                SetDataFolder $(fullPathToFolder)        
     925                CheckDisplayed/W=$winNameStr iBin_qxqy_B 
     926                 
     927                if(V_flag==0) 
     928                        AppendtoGraph/W=$winNameStr iBin_qxqy_B vs qBin_qxqy_B 
     929                        ErrorBars/T=0 iBin_qxqy_B Y,wave=(:eBin_qxqy_B,:eBin_qxqy_B) 
     930                        ModifyGraph/W=$winNameStr mode(iBin_qxqy_B)=4 
     931                        ModifyGraph/W=$winNameStr rgb(iBin_qxqy_B)=(1,52428,52428) 
     932                        ModifyGraph/W=$winNameStr grid=1 
     933                        ModifyGraph/W=$winNameStr log=1 
     934                        ModifyGraph/W=$winNameStr mirror=2 
     935                        ModifyGraph/W=$winNameStr marker(iBin_qxqy_B)=19,msize(iBin_qxqy_B)=2 
     936//                      ModifyGraph/W=$winNameStr msize(iBin_qxqy_B)=3,textMarker(iBin_qxqy_B)={"B","default",1,0,5,0.00,0.00} 
     937 
     938                endif 
     939                 
    887940        endif 
    888941 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_DetectorCorrections.ipf

    r1071 r1073  
    2727// same old equation, just written in a more complex form. 
    2828// 
    29 // TODO 
     29// (DONE) 
    3030// x- verify the direction of the tubes and indexing 
    3131// x- decide on the appropriate functional form for the tubes 
     
    109109// 
    110110// 
    111 // TODO 
    112 // -- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 
     111// (DONE) 
     112// x- UNITS!!!! currently this is mm, which certainly doesn't match anything else!!! 
     113// 
    113114// x- verify the direction of the tubes and indexing 
    114115// x- be sure I'm working in the right data folder (it is passed in, and the full path is used) 
     
    151152         
    152153        // TODO 
    153         // -- GAP IS HARD-WIRED 
     154        // -- GAP IS HARD-WIRED as a single constant value (there really are 4 values) 
    154155        Variable offset,gap 
    155156 
    156157// kPanelTouchingGap is in mm    
     158// the gap is added to the RIGHT and TOP panels ONLY 
     159// TODO -- replace with V_getDet_panel_gap(fname,detStr) once it is added to the file 
    157160        gap = kPanelTouchingGap 
    158161         
    159162        if(cmpstr(orientation,"vertical")==0) 
    160163                //      this is data dimensioned as (Ntubes,Npix) 
    161                 data_realDistX[][] = tube_width*p 
    162                 data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q 
    163164         
    164165                // adjust the x postion based on the beam center being nominally (0,0) in units of cm, not pixels 
     
    180181                if(kBCTR_CM) 
    181182                        if(cmpstr("L",detStr[1]) == 0) 
    182                                 data_realDistX[][] = offset - (dimX - p)*tube_width                     // TODO should this be dimX-1-p = 47-p? 
    183 //                              data_realDistX[][] = -offset - (dimX - p)*tube_width                    // TODO should this be dimX-1-p = 47-p? 
     183//                              data_realDistX[][] = offset - (dimX - p)*tube_width                     // TODO should this be dimX-1-p = 47-p? 
     184                                data_realDistX[][] = offset - (dimX - p)*tube_width - gap/2             // TODO should this be dimX-1-p = 47-p? 
    184185                        else 
    185                                 data_realDistX[][] += offset + gap + tube_width                 //add to the Right det, not recalculate 
     186                        //      right 
     187//                              data_realDistX[][] = tube_width*(p+1) + offset + gap            //add to the Right det, 
     188                                data_realDistX[][] = tube_width*(p+1) + offset + gap/2          //add to the Right det 
    186189                        endif 
     190                else 
     191                        data_realDistX[][] = tube_width*(p) 
    187192                endif 
     193                data_realDistY[][] = coefW[0][p] + coefW[1][p]*q + coefW[2][p]*q*q 
    188194         
    189195         
    190196        elseif(cmpstr(orientation,"horizontal")==0) 
    191197                //      this is data (horizontal) dimensioned as (Npix,Ntubes) 
    192                 data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p 
    193198                data_realDistY[][] = tube_width*q 
    194199 
     
    208213                if(kBCTR_CM) 
    209214                        if(cmpstr("T",detStr[1]) == 0) 
    210                                 data_realDistY[][] += offset + gap + tube_width                  
     215//                              data_realDistY[][] = tube_width*(q+1) + offset + gap                     
     216                                data_realDistY[][] = tube_width*(q+1) + offset + gap/2                   
    211217                        else 
    212                                 data_realDistY[][] = offset - (dimY - q)*tube_width     // TODO should this be dimY-1-q = 47-q? 
     218                                // bottom 
     219//                              data_realDistY[][] = offset - (dimY - q)*tube_width     // TODO should this be dimY-1-q = 47-q? 
     220                                data_realDistY[][] = offset - (dimY - q)*tube_width - gap/2     // TODO should this be dimY-1-q = 47-q? 
    213221                        endif 
     222                else 
     223                        data_realDistY[][] = tube_width*(q) 
    214224                endif 
     225                data_realDistX[][] = coefW[0][q] + coefW[1][q]*p + coefW[2][q]*p*p 
    215226 
    216227        else             
     
    325336// 
    326337// 
    327 // TODO 
    328 // -- VERIFY the calculations 
    329 // -- verify where this needs to be done (if the beam center is changed) 
    330 // -- then the q-calculation needs to be re-done 
    331 // -- the position along the tube length is referenced to tube[0], for no particular reason 
     338// (DONE) 
     339// x- VERIFY the calculations 
     340// x- verify where this needs to be done (if the beam center is changed) 
     341// x- then the q-calculation needs to be re-done 
     342// x- the position along the tube length is referenced to tube[0], for no particular reason 
    332343//    It may be better to take an average? but [0] is an ASSUMPTION 
    333 // -- distance along tube is simple interpolation, or do I use the coefficients to 
    334 //    calculate the actual value 
    335 // 
    336 // -- distance in the lateral direction is based on tube width, which is a fixed parameter 
    337 // 
     344// x- distance along tube is simple interpolation 
     345// 
     346// x- distance in the lateral direction is based on tube width, which is a fixed parameter 
     347// 
     348// the value in pixels is written to the local data folder, NOT to disk (it is recalculated as needed) 
    338349// 
    339350Function V_ConvertBeamCtr_to_pix(folder,detStr,destPath) 
     
    364375 
    365376        variable edge,delta 
     377        Variable gap = kPanelTouchingGap                // TODO: -- replace with V_getDet_panel_gap(fname,detStr) 
    366378 
    367379// 
     
    377389                        // R panel 
    378390                                edge = data_realDistX[0][0] 
    379                                 delta = abs(xCtr*10 - edge + kPanelTouchingGap) 
     391                                delta = abs(xCtr*10 - edge + gap) 
    380392                                x_pix[0] = -delta/tube_width            //since the left edge of the R panel is pixel 0 
    381393                        endif 
     
    394406                        if(cmpstr("T",detStr[1]) == 0) 
    395407                                edge = data_realDistY[0][0]             //tube 0 
    396                                 delta = abs(yCtr*10 - edge + kPanelTouchingGap) 
     408                                delta = abs(yCtr*10 - edge + gap) 
    397409                                y_pix[0] =  -delta/tube_width           //since the bottom edge of the T panel is pixel 0 
    398410                        else 
     
    478490//// 
    479491 
    480 // TODO 
    481 // get rid of this in the real data 
     492 
    482493// 
    483494// TESTING ONLY 
     
    496507 
    497508 
    498 // TODO 
    499 // get rid of this in the real data 
    500509// 
    501510// TESTING ONLY 
     
    549558 
    550559// 
    551 // TODO: 
    552 // -- MUST VERIFY the definition of SDD and how (if) setback is written to the data files 
    553 // -- currently I'm assuming that the SDD is the "nominal" value which is correct for the  
     560// (DONE) 
     561// x- MUST VERIFY the definition of SDD and how (if) setback is written to the data files 
     562// x- currently I'm assuming that the SDD is the "nominal" value which is correct for the  
    554563//    L/R panels, but is not correct for the T/B panels (must add in the setback) 
    555564// 
     
    609618//function to calculate the overall q-value, given all of the necesary trig inputs 
    610619// 
    611 // TODO: 
    612 // -- verify the calculation (accuracy - in all input conditions) 
    613 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
    614 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
     620// (DONE) 
     621// x- verify the calculation (accuracy - in all input conditions) 
     622// x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
     623// x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
    615624//    to each pixel 
    616625// 
     
    642651 
    643652//calculates just the q-value in the x-direction on the detector 
    644 // TODO: 
    645 // -- verify the calculation (accuracy - in all input conditions) 
    646 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
    647 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
     653// (DONE) 
     654// x- verify the calculation (accuracy - in all input conditions) 
     655// x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
     656// x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
    648657//    to each pixel 
    649658// 
     
    676685 
    677686//calculates just the q-value in the y-direction on the detector 
    678 // TODO: 
    679 // -- verify the calculation (accuracy - in all input conditions) 
    680 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
    681 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
     687// (DONE) 
     688// x- verify the calculation (accuracy - in all input conditions) 
     689// x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
     690// x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
    682691//    to each pixel 
    683692// 
     
    710719 
    711720//calculates just the q-value in the z-direction on the detector 
    712 // TODO: 
    713 // -- verify the calculation (accuracy - in all input conditions) 
    714 // -- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
    715 // -- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
     721// (DONE) 
     722// x- verify the calculation (accuracy - in all input conditions) 
     723// x- verify the units of everything here, it's currently all jumbled and wrong... and repeated 
     724// x- the input data_realDistX and Y are essentially lookup tables of the real space distance corresponding 
    716725//    to each pixel 
    717726// 
    718727// not actually used for any calculations, but here for completeness if anyone asks, or for 2D data export 
    719728// 
    720 // this properly accounts for qz 
     729// this properly accounts for qz, because it is qz 
    721730// 
    722731Function V_CalcQZ(xaxval,yaxval,xctr,yctr,sdd,lam,distX,distY) 
     
    745754 
    746755// 
    747 // TODO -- VERIFY calculations 
    748 // -- This is the actual solid angle per pixel, not a ratio vs. some "unit SA"  
     756// (DONE) 
     757// x- VERIFY calculations 
     758// x- This is the actual solid angle per pixel, not a ratio vs. some "unit SA"  
    749759//    Do I just correct for the different area vs. the "nominal" central area? 
    750 // -- decide how to implement - either directly change the data values (as was done in the past) 
    751 //    or use this as a weighting for when the data is binned to I(q). In the second method, 2D data 
    752 //    would need this to be applied before exporting 
    753 // -- do I keep a wave note indicating that this correction has been applied to the data 
    754 //    so that it can be "un-applied"? 
    755 // -- do I calculate theta from geometry directly, or get it from Q (Assuming it's present?) 
    756 //    (probably just from geometry, since I need SDD and dx and dy values...) 
     760// x- decide how to implement - YES - directly change the data values (as was done in the past) 
     761//    or (NOT done this way...use this as a weighting for when the data is binned to I(q). In the second method, 2D data 
     762//    would need this to be applied before exporting) 
     763// x- do I keep a wave note indicating that this correction has been applied to the data 
     764//    so that it can be "un-applied"? NO 
     765// x- do I calculate theta from geometry directly, or get it from Q (Assuming it's present?) 
     766//    (YES just from geometry, since I need SDD and dx and dy values...) 
    757767// 
    758768// 
     
    827837        w /= solid_angle 
    828838         
    829          
    830         // TODO: 
     839        // 
    831840        // correctly apply the correction to the error wave (assume a perfect value?) 
    832         w_err /= solid_angle            //is this correct?? 
     841        w_err /= solid_angle            // 
    833842 
    834843// TODO -- clean up after I'm satisfied computations are correct                 
     
    844853// 
    845854// 
    846 // TODO :  
    847 //   -- DoAlert 0,"This has not yet been updated for VSANS" 
     855// NOV 2017 
     856// Currently, this is not called from any VSANS routines. it is only referenced 
     857// from V_Add_raw_to_work(), which would add two VSANS raw data files together. This has 
     858// not yet been implemented. I am only keeping this function around to be sure that  
     859// if/when V_Add_raw_to_work() is implemented, all of the functionality of V_DetCorr() is 
     860// properly duplicated. 
     861// 
     862// 
    848863// 
    849864//performs solid angle and non-linear detector corrections to raw data as it is "added" to a work folder 
     
    977992 
    978993 
    979  
     994// 
     995// Large angle transmission correction 
    980996// 
    981997// DIVIDE the intensity by this correction to get the right answer 
    982 // TODO: 
    983 //   --         DoAlert 0,"This has not yet been updated for VSANS" 
    984 // 
    985 // 
    986  
     998// 
     999// 
    9871000// Apply the large angle transmssion correction as the data is converted to WORK 
    9881001// so that whether the data is saved as 2D or 1D, the correction has properly been done. 
     
    10481061                        endif 
    10491062                          
    1050                         // TODO 
    1051                         // -- properly calculate and apply the 2D error propagation 
     1063                        // (DONE) 
     1064                        // x- properly calculate and apply the 2D error propagation 
    10521065                        if(trans == 1) 
    10531066                                lat_err[ii][jj] = 0             //no correction, no error 
     
    10771090        w_err = tmp_err  
    10781091         
    1079         // TODO: 
    1080         // correctly apply the correction to the error wave (assume a perfect value?) 
    1081         // w_err /= tmp         //is this correct?? 
    10821092 
    10831093        // TODO -- clean up after I'm satisfied computations are correct                 
     
    11271137 
    11281138// 
    1129 // TODO: 
    11301139// 
    11311140// kappa comes in as s_izero, so be sure to use 1/kappa_err 
     
    12561265 
    12571266// 
    1258 // TODO: 
    1259 //   --         DoAlert 0,"This has not yet been updated for VSANS" 
    1260 // 
    1261 //************************ 
    1262 //unused testing procedure, may not be up-to-date with other procedures 
    1263 //check before re-implementing 
     1267// testing procedure, called from a menu selection 
    12641268// 
    12651269Proc V_DIV_a_Workfile(type) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_FileCatalog.ipf

    r1064 r1073  
    1717//    some experiments (magnetic, rotation, temperature scans, etc.) but are necessary for others. 
    1818// 
    19 // TODO PRIORITY: 
     19// (DONE): 
    2020// x- clean up the list of files that now accumulates in the RawVSANS folder!!! Everything is there, including 
    2121//    files that are NOT RAW VSANS data (MASK and DIV, but these are HDF) 
     
    3131// clear out the folders in the RawVSANS folder, otherwise any changes/patches written to disk 
    3232// will not be read in, the "bad" local copy will be read in. 
    33 // TODO: 
     33// (DONE) 
    3434//  x- this *may* be a very slow operation. Warn users. Give them a choice to keep local copies. If 
    3535//     the "patched" values are written locally too, then maybe the update from disk is not needed. 
    3636//     But typically, I'd like to see that the disk version really did get updated... 
    37 // -- make a background task to periodically "kill" a few of the files? maybe too dangerous. 
    38 // -- change the V_GetHeaderInfoToWave function to allow "refreshing" of a single row, say after 
     37// x- (NO)make a background task to periodically "kill" a few of the files? maybe too dangerous. 
     38// x- (NO)change the V_GetHeaderInfoToWave function to allow "refreshing" of a single row, say after 
    3939//    a file has been patched - then the disk and local copies are in sync 
    4040// 
     
    160160                ModifyTable width(Point)=0              //JUN04, remove point numbers - confuses users since point != run 
    161161 
    162 // TODO: 
     162// (DONE) 
    163163//  x- experimental hook with contextual menu 
    164164//               
     
    171171// clear out the folders in the RawVSANS folder, otherwise any changes/patches written to disk 
    172172// will not be read in, the "bad" local copy will be read in for any subsequent operations. 
    173 // TODO: 
     173// (DONE) 
    174174//  x- this *may* be a very slow operation. Warn users. Give them a choice to keep local copies? If 
    175175//     the "patched" values are written locally too, then maybe the update from disk is not needed. 
     
    192192        numitems = ItemsInList(list,";") 
    193193         
     194        // show a progress bar for filling the file catalog 
     195        Variable indefinite=0,useIgorDraw=1 
     196        NewPanel /N=ProgressPanel /W=(285,111,739,193) 
     197        ValDisplay valdisp0,win=ProgressPanel,pos={18,32},size={342,18},limits={0,numitems,0},barmisc={0,0} 
     198        ValDisplay valdisp0,win=ProgressPanel,value= _NUM:0 
     199        DrawText 20,24,"Refreshing file catalog... Please Wait..." 
     200 
     201        if( indefinite ) 
     202                ValDisplay valdisp0,win=ProgressPanel,mode= 4   // candy stripe 
     203        else 
     204                ValDisplay valdisp0,win=ProgressPanel,mode= 3   // bar with no fractional part 
     205        endif 
     206        if( useIgorDraw ) 
     207                ValDisplay valdisp0,win=ProgressPanel,highColor=(49535,1000,1000)               //(0,65535,0) 
     208        endif 
     209        Button bStop,win=ProgressPanel,pos={375,32},size={50,20},title="Stop" 
     210        DoUpdate /W=ProgressPanel /E=1  // mark this as our progress window 
     211         
     212         
    194213        //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS 
    195         //***version numbers have been removed*** 
    196214        String str,fullName 
    197215        Variable lastPoint 
     
    232250                Endif 
    233251                ii+=1 
     252                 
     253                ValDisplay valdisp0,win=ProgressPanel,value= _NUM:ii 
     254                DoUpdate /W=ProgressPanel 
     255                 
    234256        while(ii<numitems) 
     257         
     258        KillWindow ProgressPanel 
     259 
    235260//Now sort them all based on some criterion that may be facility dependent (aim is to order them as collected) 
    236261        V_SortWaves() 
     262         
    237263//Append the files that are not raw files to the list 
    238  
    239264        V_AppendNotRAWFiles(notRAWlist)  
    240265        KillWaves/Z notRAWlist 
     
    245270        // 
    246271        // clean out again, so that the file SAVE is not slow due to the large experiment size 
    247         // TODO x- decide if this is really necessary (not necessary at this point) 
     272        // (DONE) x- decide if this is really necessary (not necessary at this point) 
    248273//       
    249274//      V_CleanOutRawVSANS() 
     
    339364End 
    340365 
    341 //sorts all of the waves of header information using the suffix (A123)  
    342 //the result is that all of the data is in the order that it was collected, 
    343 // regardless of how the prefix or run numbers were changed by the user 
     366// 
    344367Function V_SortWaves() 
    345368        Wave/T GFilenames = $"root:Packages:NIST:VSANS:CatVSHeaderInfo:Filenames" 
     
    463486         
    464487//      //read the file alphanumeric suffix 
    465 //      // TODO x- this does not exist for VSANS - so is there an equivalent, or delete? ((delete)) 
     488//      // (DONE) x- this does not exist for VSANS - so is there an equivalent, or delete? ((delete)) 
    466489//      InsertPoints lastPoint,1,GSuffix 
    467490//      GSuffix[lastPoint]="unknown" 
     
    492515         
    493516        //Attenuators 
    494         // TODO -- this is the "number" of the attenuator, but what is its relation to the 
    495         //   stack of 4 plates? binary representation? 
     517        // (DONE) x- this is the "number" of the attenuator 
    496518        InsertPoints lastPoint,1,GNumAttens 
    497519        GNumAttens[lastPoint]=V_getAtten_number(fname) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf

    r1072 r1073  
    468468        String fname 
    469469         
    470         Print "reading atten transmission" 
    471         String path = "entry:instrument:attenuator:attenuator_transmission"      
    472         return(V_getRealValueFromHDF5(fname,path)) 
     470        Print "Atten read - diverted to calculation" 
     471        return(V_CalculateAttenuationFactor(fname)) 
     472         
     473//      String path = "entry:instrument:attenuator:attenuator_transmission"      
     474//      return(V_getRealValueFromHDF5(fname,path)) 
     475 
    473476end 
    474477 
     
    478481        String fname 
    479482         
    480         String path = "entry:instrument:attenuator:attenuator_transmission_error"        
    481         return(V_getRealValueFromHDF5(fname,path)) 
     483        Print "Atten_err read - diverted to calculation" 
     484        return(V_CalculateAttenuationError(fname)) 
     485         
     486//      String path = "entry:instrument:attenuator:attenuator_transmission_error"        
     487//      return(V_getRealValueFromHDF5(fname,path)) 
     488         
    482489end 
    483490 
     
    16411648End 
    16421649 
     1650// gap when panels are "touching" 
     1651// units are mm 
     1652// returns gap value for TOP and RIGHT 
     1653// returns 0 for BACK, BOTTOM and LEFT 
     1654// force a return for BACK (no field in file) 
     1655// B/L detectors have this field, and it should be set to zero in the file 
     1656// 
     1657Function V_getDet_panel_gap(fname,detStr) 
     1658        String fname,detStr 
     1659 
     1660        if(cmpstr(detStr,"B") == 0) 
     1661                return(0) 
     1662        endif 
     1663//      if(cmpstr(detStr,"FB") == 0 || cmpstr(detStr,"FL") == 0) 
     1664//              return(0) 
     1665//      endif 
     1666//      if(cmpstr(detStr,"MB") == 0 || cmpstr(detStr,"ML") == 0) 
     1667//              return(0) 
     1668//      endif    
     1669         
     1670        String path = "entry:instrument:detector_"+detStr+":panel_gap" 
     1671        return(V_getRealValueFromHDF5(fname,path)) 
     1672         
     1673         
     1674End 
    16431675 
    16441676Function/S V_getDetSettings(fname,detStr) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Annular.ipf

    r1059 r1073  
    88// and the number of bins to divide the 360 degree circle 
    99// 
     10// qWidth is +/- around the q-center 
    1011// 
    1112// 
     
    3536// TODO -- binType == 4 (slit mode) should never end up here, as it makes no sense 
    3637// 
    37 // -- really, the onle binning that makes any sense is "one", treating each panel individually, 
     38// -- really, the only binning that makes any sense is "one", treating each panel individually, 
    3839// so I may scrap the parameter, or ignore it. so don't count on it in the future. 
    3940// 
     
    5657// TODO          
    5758                // detStr = "FLRTB" or "MLRTB", depending which panel the q-ring is centered on/ 
    58                 // for now, no crossing of the rings onto different panels 
     59                // for now, no crossing of the rings onto different carriages 
    5960                 
    6061        V_fDoAnnularBin_QxQy2D(folderStr,detStr,qCtr_Ann,qWidth) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf

    r1064 r1073  
    4040// *** When other bin types are developed, DO NOT reassign these numbers. 
    4141//  instead, skip the old numbers and assign new ones. 
    42 // old modes can be removed from the string constant ksBinTypeStr (above), but the  
     42// 
     43// - the numbers here in the switch can be out of order - it's fine 
     44// 
     45// old modes can be removed from the string constant ksBinTypeStr(n) (in V_Initialize.ipf), but the  
    4346// mode numbers are what many different binning, plotting, and reduction functions are 
    4447// switching on. In the future, it may be necessary to change the key (everywhere) to a string 
    4548// switch, but for now, stick with the numbers. 
     49// 
     50// Strconstant ksBinTypeStr = "F4-M4-B;F2-M2-B;F1-M1-B;F2-M1-B;F1-M2xTB-B;F2-M2xTB-B;SLIT-F2-M2-B;" 
     51// 
     52// 
    4653Function V_BinTypeStr2Num(binStr) 
    4754        String binStr 
     
    4956        Variable binType 
    5057        strswitch(binStr)       // string switch 
    51                 case "One": 
     58                case "F4-M4-B": 
    5259                        binType = 1 
    5360                        break           // exit from switch 
    54                 case "Two": 
     61                case "F2-M2-B": 
    5562                        binType = 2 
    5663                        break           // exit from switch 
    57                 case "Four": 
     64                case "F1-M1-B": 
    5865                        binType = 3 
    5966                        break           // exit from switch 
    60                 case "Slit Mode": 
     67                case "SLIT-F2-M2-B": 
    6168                        binType = 4 
    6269                        break           // exit from switch 
    6370 
     71                case "F2-M1-B": 
     72                        binType = 5 
     73                        break 
     74                case "F1-M2xTB-B": 
     75                        binType = 6 
     76                        break 
     77                case "F2-M2xTB-B": 
     78                        binType = 7 
     79                        break 
     80                         
    6481                default:                        // optional default expression executed 
    6582                        binType = 0 
    6683                        Abort "Binning mode not found"// when no case matches 
    6784        endswitch        
     85         
    6886        return(binType) 
    6987end 
     
    86104//      binType = V_GetBinningPopMode() 
    87105 
    88 //// TODO: 
    89 // 
    90 //      Back detector is handled spearately since there is nothing to combine 
    91 // 
    92         delQ = SetDeltaQ(folderStr,"B") 
    93          
    94         // dispatch based on binning type 
    95         if(binType == 1 || binType == 2 || binType == 3) 
    96                 VC_fDoBinning_QxQy2D(folderStr, "B")            //normal binning, nothing to combine 
    97         endif 
    98  
    99 // TODO -- this is only a temporary fix for slit mode    
    100         if(binType == 4) 
    101                 /// this is for a tall, narrow slit mode         
    102                 VC_fBinDetector_byRows(folderStr,"B") 
    103         endif    
    104  
    105  
    106  
    107 // these are the binning types where detectors are not combined 
    108 // other combined binning is below the loop 
    109         for(ii=0;ii<ItemsInList(ksDetectorListNoB);ii+=1) 
    110                 detStr = StringFromList(ii, ksDetectorListNoB, ";") 
     106        // set delta Q for binning (used later inside VC_fDoBinning_QxQy2D) 
     107        for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) 
     108                detStr = StringFromList(ii, ksDetectorListAll, ";") 
    111109                 
    112                 // set delta Q for binning 
    113                 delQ = SetDeltaQ(folderStr,detStr) 
     110                delQ = SetDeltaQ(folderStr,detStr)              // this sets (overwrites) the global value for each panel type 
     111        endfor 
     112         
     113 
     114        switch(binType) 
     115                case 1: 
     116                        VC_fDoBinning_QxQy2D(folderStr,"FL") 
     117                        VC_fDoBinning_QxQy2D(folderStr,"FR") 
     118                        VC_fDoBinning_QxQy2D(folderStr,"FT") 
     119                        VC_fDoBinning_QxQy2D(folderStr,"FB") 
     120                        VC_fDoBinning_QxQy2D(folderStr,"ML") 
     121                        VC_fDoBinning_QxQy2D(folderStr,"MR") 
     122                        VC_fDoBinning_QxQy2D(folderStr,"MT") 
     123                        VC_fDoBinning_QxQy2D(folderStr,"MB")                     
     124                        VC_fDoBinning_QxQy2D(folderStr, "B")             
     125 
     126                        break 
     127                case 2: 
     128                        VC_fDoBinning_QxQy2D(folderStr,"FLR") 
     129                        VC_fDoBinning_QxQy2D(folderStr,"FTB") 
     130                        VC_fDoBinning_QxQy2D(folderStr,"MLR") 
     131                        VC_fDoBinning_QxQy2D(folderStr,"MTB") 
     132                        VC_fDoBinning_QxQy2D(folderStr, "B")             
     133 
     134                        break 
     135                case 3: 
     136                        VC_fDoBinning_QxQy2D(folderStr,"MLRTB") 
     137                        VC_fDoBinning_QxQy2D(folderStr,"FLRTB") 
     138                        VC_fDoBinning_QxQy2D(folderStr, "B")             
     139                         
     140                        break 
     141                case 4:                         /// this is for a tall, narrow slit mode         
     142                        VC_fBinDetector_byRows(folderStr,"FL") 
     143                        VC_fBinDetector_byRows(folderStr,"FR") 
     144                        VC_fBinDetector_byRows(folderStr,"ML") 
     145                        VC_fBinDetector_byRows(folderStr,"MR") 
     146                        VC_fBinDetector_byRows(folderStr,"B") 
     147 
     148                        break 
     149                case 5: 
     150                        VC_fDoBinning_QxQy2D(folderStr,"FTB") 
     151                        VC_fDoBinning_QxQy2D(folderStr,"FLR") 
     152                        VC_fDoBinning_QxQy2D(folderStr,"MLRTB") 
     153                        VC_fDoBinning_QxQy2D(folderStr, "B")             
    114154                 
    115                 // dispatch based on binning type 
    116                 if(binType==1) 
    117                         VC_fDoBinning_QxQy2D(folderStr,detStr) 
    118                 endif 
     155                        break 
     156                case 6: 
     157                        VC_fDoBinning_QxQy2D(folderStr,"FLRTB") 
     158                        VC_fDoBinning_QxQy2D(folderStr,"MLR") 
     159                        VC_fDoBinning_QxQy2D(folderStr, "B")             
    119160                 
    120                 // TODO -- this is only a temporary fix for slit mode    
    121                 if(binType == 4) 
    122                         /// this is for a tall, narrow slit mode         
    123                         VC_fBinDetector_byRows(folderStr,detStr) 
    124                 endif    
     161                        break 
     162                case 7: 
     163                        VC_fDoBinning_QxQy2D(folderStr,"FTB") 
     164                        VC_fDoBinning_QxQy2D(folderStr,"FLR") 
     165                        VC_fDoBinning_QxQy2D(folderStr,"MLR") 
     166                        VC_fDoBinning_QxQy2D(folderStr, "B")             
    125167                 
    126         endfor 
    127          
    128         // bin in pairs 
    129         if(binType == 2) 
    130                 VC_fDoBinning_QxQy2D(folderStr,"MLR") 
    131                 VC_fDoBinning_QxQy2D(folderStr,"MTB") 
    132                 VC_fDoBinning_QxQy2D(folderStr,"FLR") 
    133                 VC_fDoBinning_QxQy2D(folderStr,"FTB")    
    134         endif 
    135          
    136         // bin everything on front or middle together 
    137         if(binType == 3) 
    138                 VC_fDoBinning_QxQy2D(folderStr,"MLRTB") 
    139                 VC_fDoBinning_QxQy2D(folderStr,"FLRTB") 
    140         endif 
     168                        break 
     169                         
     170                default: 
     171                        Abort "Binning mode not found in V_QBinAllPanels_Circular"// when no case matches        
     172        endswitch 
     173         
    141174 
    142175        return(0) 
     
    239272// 
    240273// TODO: 
    241 // -- !!! Resolution waves are currently skipped - these must be added 
     274// x- !!! Resolution waves are currently skipped - these must be added 
    242275// 
    243276// x- this currently ignores the binning type (one, two, etc. ) 
     
    255288//  root:Packages:NIST:VSANS:RAW:iBin_qxqy_FB 
    256289// 
     290// Now, the extensions needed for each binType are handled in a loop using the strings 
     291// defined globally for each of the numbered binTypes 
     292// 
    257293// binType = 1 = one 
    258294// binType = 2 = two 
    259295// binType = 3 = four 
    260296// binType = 4 = Slit Mode 
     297// binType = 5... 
    261298// 
    262299// if binType is passed in as -9999, get the binning mode from the popup 
     
    270307        Variable binType 
    271308         
     309 
    272310        if(binType==-9999) 
    273311                binType = V_GetBinningPopMode() 
    274312        endif    
    275313         
     314        String binTypeString = V_getBinTypeString(binType) 
     315        if(strlen(binTypeString) == 0) 
     316                DoAlert 0,"binTypeString is null in V_1DConcatenate" 
     317                return(0) 
     318        endif 
     319         
    276320//      SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr) 
    277321        SetDataFolder $(pathStr+folderStr) 
     
    280324        KillWaves/Z tmp_q,tmp_i,tmp_s,tmp_qb,tmp_sq,tmp_fs 
    281325 
     326        String q_waveListStr="" 
     327        String i_waveListStr="" 
     328        String s_waveListStr="" 
     329        String sq_waveListStr="" 
     330        String qb_waveListStr="" 
     331        String fs_waveListStr="" 
     332         
     333        Variable num,ii 
     334        String item="" 
     335         
     336        //Generate string lists of the waves to be concatenated based on the  
     337        // binTypeString (a global string constant with the extensions) 
     338        // 
     339         
    282340        NVAR gIgnoreDetB = root:Packages:NIST:VSANS:Globals:gIgnoreDetB 
    283          
    284         String waveListStr="" 
    285         if(binType == 1) 
    286                 // q-values 
    287                 waveListStr="" 
    288                 if(!gIgnoreDetB) 
    289                         waveListStr =  "qBin_qxqy_B" + tagStr + ";" 
     341        if(!gIgnoreDetB) 
     342                q_waveListStr =  "qBin_qxqy_B" + tagStr + ";" 
     343                i_waveListStr =  "iBin_qxqy_B" + tagStr + ";" 
     344                s_waveListStr =  "eBin_qxqy_B" + tagStr + ";" 
     345                sq_waveListStr =  "sigmaQ_qxqy_B" + tagStr + ";" 
     346                qb_waveListStr =  "qBar_qxqy_B" + tagStr + ";" 
     347                fs_waveListStr =  "fSubS_qxqy_B" + tagStr + ";"  
     348        endif 
     349 
     350        num = ItemsInList(binTypeString, ";") 
     351        for(ii=0;ii<num;ii+=1) 
     352                item = StringFromList(ii, binTypeString  ,";")   
     353         
     354        // "B" was handled outside the loop, be sure to skip here 
     355                if(cmpstr(item,"B") != 0) 
     356                        q_waveListStr +=  "qBin_qxqy_" + item + tagStr + ";" 
     357                        i_waveListStr +=  "iBin_qxqy_" + item + tagStr + ";" 
     358                        s_waveListStr +=  "eBin_qxqy_" + item + tagStr + ";" 
     359                        sq_waveListStr +=  "sigmaQ_qxqy_" + item + tagStr + ";" 
     360                        qb_waveListStr +=  "qBar_qxqy_" + item + tagStr + ";" 
     361                        fs_waveListStr +=  "fSubS_qxqy_" + item + tagStr + ";"   
    290362                endif 
    291                 waveListStr += "qBin_qxqy_MB" + tagStr + ";" 
    292                 waveListStr += "qBin_qxqy_MT" + tagStr + ";" 
    293                 waveListStr += "qBin_qxqy_ML" + tagStr + ";" 
    294                 waveListStr += "qBin_qxqy_MR" + tagStr + ";" 
    295                 waveListStr += "qBin_qxqy_FB" + tagStr + ";" 
    296                 waveListStr += "qBin_qxqy_FT" + tagStr + ";" 
    297                 waveListStr += "qBin_qxqy_FL" + tagStr + ";" 
    298                 waveListStr += "qBin_qxqy_FR" + tagStr + ";" 
    299  
    300                 Concatenate/NP/O waveListStr, tmp_q 
    301  
    302                 //intensity 
    303                 waveListStr="" 
    304                 if(!gIgnoreDetB) 
    305                         waveListStr =  "iBin_qxqy_B" + tagStr + ";" 
    306                 endif 
    307                 waveListStr += "iBin_qxqy_MB" + tagStr + ";" 
    308                 waveListStr += "iBin_qxqy_MT" + tagStr + ";" 
    309                 waveListStr += "iBin_qxqy_ML" + tagStr + ";" 
    310                 waveListStr += "iBin_qxqy_MR" + tagStr + ";" 
    311                 waveListStr += "iBin_qxqy_FB" + tagStr + ";" 
    312                 waveListStr += "iBin_qxqy_FT" + tagStr + ";" 
    313                 waveListStr += "iBin_qxqy_FL" + tagStr + ";" 
    314                 waveListStr += "iBin_qxqy_FR" + tagStr + ";" 
    315 //              waveListStr = "iBin_qxqy_B;iBin_qxqy_MB;iBin_qxqy_MT;iBin_qxqy_ML;iBin_qxqy_MR;" 
    316 //              waveListStr += "iBin_qxqy_FB;iBin_qxqy_FT;iBin_qxqy_FL;iBin_qxqy_FR;" 
     363        endfor 
     364         
     365        // concatenate each of the sets 
     366 
     367        Concatenate/NP/O q_waveListStr, tmp_q 
     368         
     369        Concatenate/NP/O i_waveListStr, tmp_i 
    317370                 
    318                 Concatenate/NP/O waveListStr, tmp_i 
    319  
    320                 //error 
    321                 waveListStr="" 
    322                 if(!gIgnoreDetB) 
    323                         waveListStr =  "eBin_qxqy_B" + tagStr + ";" 
    324                 endif 
    325                 waveListStr += "eBin_qxqy_MB" + tagStr + ";" 
    326                 waveListStr += "eBin_qxqy_MT" + tagStr + ";" 
    327                 waveListStr += "eBin_qxqy_ML" + tagStr + ";" 
    328                 waveListStr += "eBin_qxqy_MR" + tagStr + ";" 
    329                 waveListStr += "eBin_qxqy_FB" + tagStr + ";" 
    330                 waveListStr += "eBin_qxqy_FT" + tagStr + ";" 
    331                 waveListStr += "eBin_qxqy_FL" + tagStr + ";" 
    332                 waveListStr += "eBin_qxqy_FR" + tagStr + ";" 
    333 //              waveListStr = "eBin_qxqy_B;eBin_qxqy_MB;eBin_qxqy_MT;eBin_qxqy_ML;eBin_qxqy_MR;" 
    334 //              waveListStr += "eBin_qxqy_FB;eBin_qxqy_FT;eBin_qxqy_FL;eBin_qxqy_FR;" 
    335                          
    336                 Concatenate/NP/O waveListStr, tmp_s 
     371        Concatenate/NP/O s_waveListStr, tmp_s 
    337372                 
    338                 //sigma Q 
    339                 waveListStr="" 
    340                 if(!gIgnoreDetB) 
    341                         waveListStr =  "sigmaQ_qxqy_B" + tagStr + ";" 
    342                 endif 
    343                 waveListStr += "sigmaQ_qxqy_MB" + tagStr + ";" 
    344                 waveListStr += "sigmaQ_qxqy_MT" + tagStr + ";" 
    345                 waveListStr += "sigmaQ_qxqy_ML" + tagStr + ";" 
    346                 waveListStr += "sigmaQ_qxqy_MR" + tagStr + ";" 
    347                 waveListStr += "sigmaQ_qxqy_FB" + tagStr + ";" 
    348                 waveListStr += "sigmaQ_qxqy_FT" + tagStr + ";" 
    349                 waveListStr += "sigmaQ_qxqy_FL" + tagStr + ";" 
    350                 waveListStr += "sigmaQ_qxqy_FR" + tagStr + ";" 
    351 //              waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MB;sigmaQ_qxqy_MT;sigmaQ_qxqy_ML;sigmaQ_qxqy_MR;" 
    352 //              waveListStr += "sigmaQ_qxqy_FB;sigmaQ_qxqy_FT;sigmaQ_qxqy_FL;sigmaQ_qxqy_FR;" 
    353                          
    354                 Concatenate/NP/O waveListStr, tmp_sq 
    355  
    356                 //Q bar 
    357                 waveListStr="" 
    358                 if(!gIgnoreDetB) 
    359                         waveListStr =  "qBar_qxqy_B" + tagStr + ";" 
    360                 endif 
    361                 waveListStr += "qBar_qxqy_MB" + tagStr + ";" 
    362                 waveListStr += "qBar_qxqy_MT" + tagStr + ";" 
    363                 waveListStr += "qBar_qxqy_ML" + tagStr + ";" 
    364                 waveListStr += "qBar_qxqy_MR" + tagStr + ";" 
    365                 waveListStr += "qBar_qxqy_FB" + tagStr + ";" 
    366                 waveListStr += "qBar_qxqy_FT" + tagStr + ";" 
    367                 waveListStr += "qBar_qxqy_FL" + tagStr + ";" 
    368                 waveListStr += "qBar_qxqy_FR" + tagStr + ";" 
    369 //              waveListStr = "qBar_qxqy_B;qBar_qxqy_MB;qBar_qxqy_MT;qBar_qxqy_ML;qBar_qxqy_MR;" 
    370 //              waveListStr += "qBar_qxqy_FB;qBar_qxqy_FT;qBar_qxqy_FL;qBar_qxqy_FR;" 
    371                          
    372                 Concatenate/NP/O waveListStr, tmp_qb 
    373                                                                  
    374                 //shadow fs 
    375                 waveListStr="" 
    376                 if(!gIgnoreDetB) 
    377                         waveListStr =  "fSubS_qxqy_B" + tagStr + ";" 
    378                 endif 
    379                 waveListStr += "fSubS_qxqy_MB" + tagStr + ";" 
    380                 waveListStr += "fSubS_qxqy_MT" + tagStr + ";" 
    381                 waveListStr += "fSubS_qxqy_ML" + tagStr + ";" 
    382                 waveListStr += "fSubS_qxqy_MR" + tagStr + ";" 
    383                 waveListStr += "fSubS_qxqy_FB" + tagStr + ";" 
    384                 waveListStr += "fSubS_qxqy_FT" + tagStr + ";" 
    385                 waveListStr += "fSubS_qxqy_FL" + tagStr + ";" 
    386                 waveListStr += "fSubS_qxqy_FR" + tagStr + ";" 
    387 //              waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MB;fSubS_qxqy_MT;fSubS_qxqy_ML;fSubS_qxqy_MR;" 
    388 //              waveListStr += "fSubS_qxqy_FB;fSubS_qxqy_FT;fSubS_qxqy_FL;fSubS_qxqy_FR;" 
    389                          
    390                 Concatenate/NP/O waveListStr, tmp_fs 
     373        Concatenate/NP/O sq_waveListStr, tmp_sq 
     374 
     375        Concatenate/NP/O qb_waveListStr, tmp_qb 
     376                 
     377        Concatenate/NP/O fs_waveListStr, tmp_fs 
    391378                                                                                 
    392         endif 
    393  
    394         if(binType == 2)         
    395                 // q-values 
    396                 waveListStr="" 
    397                 if(!gIgnoreDetB) 
    398                         waveListStr =  "qBin_qxqy_B" + tagStr + ";" 
    399                 endif 
    400                 waveListStr += "qBin_qxqy_MTB" + tagStr + ";" 
    401                 waveListStr += "qBin_qxqy_MLR" + tagStr + ";" 
    402                 waveListStr += "qBin_qxqy_FTB" + tagStr + ";" 
    403                 waveListStr += "qBin_qxqy_FLR" + tagStr + ";" 
    404  
    405 //              waveListStr = "qBin_qxqy_B;qBin_qxqy_MTB;qBin_qxqy_MLR;" 
    406 //              waveListStr += "qBin_qxqy_FTB;qBin_qxqy_FLR;" 
    407  
    408                 Concatenate/NP/O waveListStr, tmp_q 
    409  
    410                 //intensity 
    411                 waveListStr="" 
    412                 if(!gIgnoreDetB) 
    413                         waveListStr =  "iBin_qxqy_B" + tagStr + ";" 
    414                 endif 
    415                 waveListStr += "iBin_qxqy_MTB" + tagStr + ";" 
    416                 waveListStr += "iBin_qxqy_MLR" + tagStr + ";" 
    417                 waveListStr += "iBin_qxqy_FTB" + tagStr + ";" 
    418                 waveListStr += "iBin_qxqy_FLR" + tagStr + ";" 
    419                  
    420 //              waveListStr = "iBin_qxqy_B;iBin_qxqy_MTB;iBin_qxqy_MLR;" 
    421 //              waveListStr += "iBin_qxqy_FTB;iBin_qxqy_FLR;" 
    422                  
    423                 Concatenate/NP/O waveListStr, tmp_i 
    424  
    425                 //error 
    426                 waveListStr="" 
    427                 if(!gIgnoreDetB) 
    428                         waveListStr =  "eBin_qxqy_B" + tagStr + ";" 
    429                 endif 
    430                 waveListStr += "eBin_qxqy_MTB" + tagStr + ";" 
    431                 waveListStr += "eBin_qxqy_MLR" + tagStr + ";" 
    432                 waveListStr += "eBin_qxqy_FTB" + tagStr + ";" 
    433                 waveListStr += "eBin_qxqy_FLR" + tagStr + ";" 
    434                  
    435 //              waveListStr = "eBin_qxqy_B;eBin_qxqy_MTB;eBin_qxqy_MLR;" 
    436 //              waveListStr += "eBin_qxqy_FTB;eBin_qxqy_FLR;" 
    437                          
    438                 Concatenate/NP/O waveListStr, tmp_s 
    439                  
    440                 // sigma Q 
    441                 waveListStr="" 
    442                 if(!gIgnoreDetB) 
    443                         waveListStr =  "sigmaQ_qxqy_B" + tagStr + ";" 
    444                 endif 
    445                 waveListStr += "sigmaQ_qxqy_MTB" + tagStr + ";" 
    446                 waveListStr += "sigmaQ_qxqy_MLR" + tagStr + ";" 
    447                 waveListStr += "sigmaQ_qxqy_FTB" + tagStr + ";" 
    448                 waveListStr += "sigmaQ_qxqy_FLR" + tagStr + ";" 
    449                  
    450 //              waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MTB;sigmaQ_qxqy_MLR;" 
    451 //              waveListStr += "sigmaQ_qxqy_FTB;sigmaQ_qxqy_FLR;" 
    452                          
    453                 Concatenate/NP/O waveListStr, tmp_sq 
    454                  
    455                                 // Q bar 
    456                 waveListStr="" 
    457                 if(!gIgnoreDetB) 
    458                         waveListStr =  "qBar_qxqy_B" + tagStr + ";" 
    459                 endif 
    460                 waveListStr += "qBar_qxqy_MTB" + tagStr + ";" 
    461                 waveListStr += "qBar_qxqy_MLR" + tagStr + ";" 
    462                 waveListStr += "qBar_qxqy_FTB" + tagStr + ";" 
    463                 waveListStr += "qBar_qxqy_FLR" + tagStr + ";" 
    464                  
    465 //              waveListStr = "qBar_qxqy_B;qBar_qxqy_MTB;qBar_qxqy_MLR;" 
    466 //              waveListStr += "qBar_qxqy_FTB;qBar_qxqy_FLR;" 
    467                          
    468                 Concatenate/NP/O waveListStr, tmp_qb 
    469                  
    470                 // shadow fs 
    471                 waveListStr="" 
    472                 if(!gIgnoreDetB) 
    473                         waveListStr =  "fSubS_qxqy_B" + tagStr + ";" 
    474                 endif 
    475                 waveListStr += "fSubS_qxqy_MTB" + tagStr + ";" 
    476                 waveListStr += "fSubS_qxqy_MLR" + tagStr + ";" 
    477                 waveListStr += "fSubS_qxqy_FTB" + tagStr + ";" 
    478                 waveListStr += "fSubS_qxqy_FLR" + tagStr + ";" 
    479                  
    480 //              waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MTB;fSubS_qxqy_MLR;" 
    481 //              waveListStr += "fSubS_qxqy_FTB;fSubS_qxqy_FLR;" 
    482                          
    483                 Concatenate/NP/O waveListStr, tmp_fs 
    484                  
    485         endif 
    486  
    487         if(binType == 3)         
    488                 // q-values 
    489                 waveListStr="" 
    490                 if(!gIgnoreDetB) 
    491                         waveListStr =  "qBin_qxqy_B" + tagStr + ";" 
    492                 endif 
    493                 waveListStr += "qBin_qxqy_MLRTB" + tagStr + ";" 
    494                 waveListStr += "qBin_qxqy_FLRTB" + tagStr + ";" 
    495                  
    496 //              waveListStr = "qBin_qxqy_B;qBin_qxqy_MLRTB;qBin_qxqy_FLRTB;" 
    497  
    498                 Concatenate/NP/O waveListStr, tmp_q 
    499  
    500                 //intensity 
    501                 waveListStr="" 
    502                 if(!gIgnoreDetB) 
    503                         waveListStr =  "iBin_qxqy_B" + tagStr + ";" 
    504                 endif 
    505                 waveListStr += "iBin_qxqy_MLRTB" + tagStr + ";" 
    506                 waveListStr += "iBin_qxqy_FLRTB" + tagStr + ";" 
    507                  
    508 //              waveListStr = "iBin_qxqy_B;iBin_qxqy_MLRTB;iBin_qxqy_FLRTB;" 
    509                  
    510                 Concatenate/NP/O waveListStr, tmp_i 
    511  
    512                 //error 
    513                 waveListStr="" 
    514                 if(!gIgnoreDetB) 
    515                         waveListStr =  "eBin_qxqy_B" + tagStr + ";" 
    516                 endif 
    517                 waveListStr += "eBin_qxqy_MLRTB" + tagStr + ";" 
    518                 waveListStr += "eBin_qxqy_FLRTB" + tagStr + ";" 
    519                  
    520 //              waveListStr = "eBin_qxqy_B;eBin_qxqy_MLRTB;eBin_qxqy_FLRTB;" 
    521                          
    522                 Concatenate/NP/O waveListStr, tmp_s 
    523                  
    524                 // sigma Q 
    525                 waveListStr="" 
    526                 if(!gIgnoreDetB) 
    527                         waveListStr =  "sigmaQ_qxqy_B" + tagStr + ";" 
    528                 endif 
    529                 waveListStr += "sigmaQ_qxqy_MLRTB" + tagStr + ";" 
    530                 waveListStr += "sigmaQ_qxqy_FLRTB" + tagStr + ";" 
    531                  
    532 //              waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MLRTB;sigmaQ_qxqy_FLRTB;" 
    533                          
    534                 Concatenate/NP/O waveListStr, tmp_sq 
    535                  
    536                 // Q bar 
    537                 waveListStr="" 
    538                 if(!gIgnoreDetB) 
    539                         waveListStr =  "qBar_qxqy_B" + tagStr + ";" 
    540                 endif 
    541                 waveListStr += "qBar_qxqy_MLRTB" + tagStr + ";" 
    542                 waveListStr += "qBar_qxqy_FLRTB" + tagStr + ";" 
    543                  
    544 //              waveListStr = "qBar_qxqy_B;qBar_qxqy_MLRTB;qBar_qxqy_FLRTB;" 
    545                          
    546                 Concatenate/NP/O waveListStr, tmp_qb 
    547                  
    548                 // shadow fs 
    549                 waveListStr="" 
    550                 if(!gIgnoreDetB) 
    551                         waveListStr =  "fSubS_qxqy_B" + tagStr + ";" 
    552                 endif 
    553                 waveListStr += "fSubS_qxqy_MLRTB" + tagStr + ";" 
    554                 waveListStr += "fSubS_qxqy_FLRTB" + tagStr + ";" 
    555                  
    556 //              waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MLRTB;fSubS_qxqy_FLRTB;" 
    557                          
    558                 Concatenate/NP/O waveListStr, tmp_fs 
    559         endif 
    560  
    561 // TODO - This is the identical set of waves as for the case of binType = 1. 
    562 // they have the same names, but are averaged differently since it's slit mode. 
    563 // I have separated this, since in practice the TB panels are probably best to ignore 
    564 // and NOT include in the averaging since the Qy range is so limited. 
    565         if(binType == 4)         
    566                 // q-values 
    567                 waveListStr="" 
    568                 if(!gIgnoreDetB) 
    569                         waveListStr =  "qBin_qxqy_B" + tagStr + ";" 
    570                 endif 
    571 //              waveListStr += "qBin_qxqy_MB" + tagStr + ";" 
    572 //              waveListStr += "qBin_qxqy_MT" + tagStr + ";" 
    573                 waveListStr += "qBin_qxqy_ML" + tagStr + ";" 
    574                 waveListStr += "qBin_qxqy_MR" + tagStr + ";" 
    575 //              waveListStr += "qBin_qxqy_FB" + tagStr + ";" 
    576 //              waveListStr += "qBin_qxqy_FT" + tagStr + ";" 
    577                 waveListStr += "qBin_qxqy_FL" + tagStr + ";" 
    578                 waveListStr += "qBin_qxqy_FR" + tagStr + ";" 
    579 //              waveListStr = "qBin_qxqy_B;qBin_qxqy_MB;qBin_qxqy_MT;qBin_qxqy_ML;qBin_qxqy_MR;" 
    580 //              waveListStr += "qBin_qxqy_FB;qBin_qxqy_FT;qBin_qxqy_FL;qBin_qxqy_FR;" 
    581  
    582                 Concatenate/NP/O waveListStr, tmp_q 
    583  
    584                 //intensity 
    585                 waveListStr="" 
    586                 if(!gIgnoreDetB) 
    587                         waveListStr =  "iBin_qxqy_B" + tagStr + ";" 
    588                 endif 
    589 //              waveListStr += "iBin_qxqy_MB" + tagStr + ";" 
    590 //              waveListStr += "iBin_qxqy_MT" + tagStr + ";" 
    591                 waveListStr += "iBin_qxqy_ML" + tagStr + ";" 
    592                 waveListStr += "iBin_qxqy_MR" + tagStr + ";" 
    593 //              waveListStr += "iBin_qxqy_FB" + tagStr + ";" 
    594 //              waveListStr += "iBin_qxqy_FT" + tagStr + ";" 
    595                 waveListStr += "iBin_qxqy_FL" + tagStr + ";" 
    596                 waveListStr += "iBin_qxqy_FR" + tagStr + ";" 
    597 //              waveListStr = "iBin_qxqy_B;iBin_qxqy_MB;iBin_qxqy_MT;iBin_qxqy_ML;iBin_qxqy_MR;" 
    598 //              waveListStr += "iBin_qxqy_FB;iBin_qxqy_FT;iBin_qxqy_FL;iBin_qxqy_FR;" 
    599                  
    600                 Concatenate/NP/O waveListStr, tmp_i 
    601  
    602                 //error 
    603                 waveListStr="" 
    604                 if(!gIgnoreDetB) 
    605                         waveListStr =  "eBin_qxqy_B" + tagStr + ";" 
    606                 endif 
    607 //              waveListStr += "eBin_qxqy_MB" + tagStr + ";" 
    608 //              waveListStr += "eBin_qxqy_MT" + tagStr + ";" 
    609                 waveListStr += "eBin_qxqy_ML" + tagStr + ";" 
    610                 waveListStr += "eBin_qxqy_MR" + tagStr + ";" 
    611 //              waveListStr += "eBin_qxqy_FB" + tagStr + ";" 
    612 //              waveListStr += "eBin_qxqy_FT" + tagStr + ";" 
    613                 waveListStr += "eBin_qxqy_FL" + tagStr + ";" 
    614                 waveListStr += "eBin_qxqy_FR" + tagStr + ";" 
    615 //              waveListStr = "eBin_qxqy_B;eBin_qxqy_MB;eBin_qxqy_MT;eBin_qxqy_ML;eBin_qxqy_MR;" 
    616 //              waveListStr += "eBin_qxqy_FB;eBin_qxqy_FT;eBin_qxqy_FL;eBin_qxqy_FR;" 
    617                          
    618                 Concatenate/NP/O waveListStr, tmp_s 
    619                  
    620                 //sigma Q 
    621                 waveListStr="" 
    622                 if(!gIgnoreDetB) 
    623                         waveListStr =  "sigmaQ_qxqy_B" + tagStr + ";" 
    624                 endif 
    625 //              waveListStr += "sigmaQ_qxqy_MB" + tagStr + ";" 
    626 //              waveListStr += "sigmaQ_qxqy_MT" + tagStr + ";" 
    627                 waveListStr += "sigmaQ_qxqy_ML" + tagStr + ";" 
    628                 waveListStr += "sigmaQ_qxqy_MR" + tagStr + ";" 
    629 //              waveListStr += "sigmaQ_qxqy_FB" + tagStr + ";" 
    630 //              waveListStr += "sigmaQ_qxqy_FT" + tagStr + ";" 
    631                 waveListStr += "sigmaQ_qxqy_FL" + tagStr + ";" 
    632                 waveListStr += "sigmaQ_qxqy_FR" + tagStr + ";" 
    633 //              waveListStr = "sigmaQ_qxqy_B;sigmaQ_qxqy_MB;sigmaQ_qxqy_MT;sigmaQ_qxqy_ML;sigmaQ_qxqy_MR;" 
    634 //              waveListStr += "sigmaQ_qxqy_FB;sigmaQ_qxqy_FT;sigmaQ_qxqy_FL;sigmaQ_qxqy_FR;" 
    635                          
    636                 Concatenate/NP/O waveListStr, tmp_sq 
    637  
    638                 //Q bar 
    639                 waveListStr="" 
    640                 if(!gIgnoreDetB) 
    641                         waveListStr =  "qBar_qxqy_B" + tagStr + ";" 
    642                 endif 
    643 //              waveListStr += "qBar_qxqy_MB" + tagStr + ";" 
    644 //              waveListStr += "qBar_qxqy_MT" + tagStr + ";" 
    645                 waveListStr += "qBar_qxqy_ML" + tagStr + ";" 
    646                 waveListStr += "qBar_qxqy_MR" + tagStr + ";" 
    647 //              waveListStr += "qBar_qxqy_FB" + tagStr + ";" 
    648 //              waveListStr += "qBar_qxqy_FT" + tagStr + ";" 
    649                 waveListStr += "qBar_qxqy_FL" + tagStr + ";" 
    650                 waveListStr += "qBar_qxqy_FR" + tagStr + ";" 
    651 //              waveListStr = "qBar_qxqy_B;qBar_qxqy_MB;qBar_qxqy_MT;qBar_qxqy_ML;qBar_qxqy_MR;" 
    652 //              waveListStr += "qBar_qxqy_FB;qBar_qxqy_FT;qBar_qxqy_FL;qBar_qxqy_FR;" 
    653                          
    654                 Concatenate/NP/O waveListStr, tmp_qb 
    655                                                                  
    656                 //shadow fs 
    657                 waveListStr="" 
    658                 if(!gIgnoreDetB) 
    659                         waveListStr =  "fSubS_qxqy_B" + tagStr + ";" 
    660                 endif 
    661 //              waveListStr += "fSubS_qxqy_MB" + tagStr + ";" 
    662 //              waveListStr += "fSubS_qxqy_MT" + tagStr + ";" 
    663                 waveListStr += "fSubS_qxqy_ML" + tagStr + ";" 
    664                 waveListStr += "fSubS_qxqy_MR" + tagStr + ";" 
    665 //              waveListStr += "fSubS_qxqy_FB" + tagStr + ";" 
    666 //              waveListStr += "fSubS_qxqy_FT" + tagStr + ";" 
    667                 waveListStr += "fSubS_qxqy_FL" + tagStr + ";" 
    668                 waveListStr += "fSubS_qxqy_FR" + tagStr + ";" 
    669 //              waveListStr = "fSubS_qxqy_B;fSubS_qxqy_MB;fSubS_qxqy_MT;fSubS_qxqy_ML;fSubS_qxqy_MR;" 
    670 //              waveListStr += "fSubS_qxqy_FB;fSubS_qxqy_FT;fSubS_qxqy_FL;fSubS_qxqy_FR;" 
    671                          
    672                 Concatenate/NP/O waveListStr, tmp_fs 
    673                  
    674         endif 
     379 
    675380 
    676381// Can't kill here, since they are still needed to sort and write out! 
     
    711416 
    712417 
    713 // TODO 
    714 // (appears to be unused, in favor of the version that uses the global strings) 
    715 // needs: 
    716 // -- trim the beamstop out (based on shadow?) 
    717 // -- trim out zero q from the file (bad actor in analysis functions) 
    718 // -- trim num from the highQ end or lowQ end? 
    719 // -- splits the res wave into individual waves in anticipation of concatenation 
    720 //   -- or -- deal with the res wave after? 
    721 // 
    722 // -- make a copy of the waves? 
    723 // -- then, what is the concatenate function looking for?? 
    724 // 
    725 Function V_Trim1DData(dataFolder,binType,nBeg,nEnd) 
    726         String dataFolder 
    727         Variable binType,nBeg,nEnd 
    728  
    729         Variable npt,ii 
    730    SetDataFolder $("root:Packages:NIST:VSANS:"+dataFolder) 
    731  
    732         Printf "%d points removed from beginning, %d points from the end (of each set) before concatenating\r",nbeg,nend 
    733          
    734 // for each binType block: 
    735 // declare the waves 
    736 // make a copy of the waves?? 
    737 //      //Break out resolution wave into separate waves 
    738 // delete the beginning points from everything 
    739         // trim off the last nEnd points from everything 
    740 //      DeletePoints num-nEnd,nEnd, qw,iw,sw 
    741 //      // delete all points where the shadow is < 0.98 
    742 ////Put resolution contents back??? 
    743  
    744         if(binType == 1)         
    745                 Wave/Z q_fb = qBin_qxqy_FB 
    746                 Wave/Z q_ft = qBin_qxqy_FT 
    747                 Wave/Z q_fl = qBin_qxqy_FL 
    748                 Wave/Z q_fr = qBin_qxqy_FR 
    749                 Wave/Z q_mb = qBin_qxqy_MB 
    750                 Wave/Z q_mt = qBin_qxqy_MT 
    751                 Wave/Z q_ml = qBin_qxqy_ML 
    752                 Wave/Z q_mr = qBin_qxqy_MR 
    753                 Wave/Z q_b = qBin_qxqy_B 
    754          
    755                 Wave/Z i_fb = iBin_qxqy_FB 
    756                 Wave/Z i_ft = iBin_qxqy_FT 
    757                 Wave/Z i_fl = iBin_qxqy_FL 
    758                 Wave/Z i_fr = iBin_qxqy_FR 
    759                 Wave/Z i_mb = iBin_qxqy_MB 
    760                 Wave/Z i_mt = iBin_qxqy_MT 
    761                 Wave/Z i_ml = iBin_qxqy_ML 
    762                 Wave/Z i_mr = iBin_qxqy_MR 
    763                 Wave/Z i_b = iBin_qxqy_B 
    764                  
    765                 Wave/Z s_fb = eBin_qxqy_FB 
    766                 Wave/Z s_ft = eBin_qxqy_FT 
    767                 Wave/Z s_fl = eBin_qxqy_FL 
    768                 Wave/Z s_fr = eBin_qxqy_FR 
    769                 Wave/Z s_mb = eBin_qxqy_MB 
    770                 Wave/Z s_mt = eBin_qxqy_MT 
    771                 Wave/Z s_ml = eBin_qxqy_ML 
    772                 Wave/Z s_mr = eBin_qxqy_MR 
    773                 Wave/Z s_b = eBin_qxqy_B 
    774  
    775  
    776                                  
    777                 DeletePoints 0,nBeg, q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b 
    778                 DeletePoints 0,nBeg, i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b 
    779                 DeletePoints 0,nBeg, s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b 
    780                 //since each set may have a different number of points 
    781                 npt = numpnts(q_fb)  
    782                 DeletePoints npt-nEnd,nEnd, q_fb,i_fb,s_fb 
    783  
    784                 npt = numpnts(q_ft)  
    785                 DeletePoints npt-nEnd,nEnd, q_ft,i_ft,s_ft 
    786  
    787                 npt = numpnts(q_fl)  
    788                 DeletePoints npt-nEnd,nEnd, q_fl,i_fl,s_fl 
    789  
    790                 npt = numpnts(q_fr)  
    791                 DeletePoints npt-nEnd,nEnd, q_fr,i_fr,s_fr 
    792  
    793                 npt = numpnts(q_mb)  
    794                 DeletePoints npt-nEnd,nEnd, q_mb,i_mb,s_mb 
    795  
    796                 npt = numpnts(q_mt)  
    797                 DeletePoints npt-nEnd,nEnd, q_mt,i_mt,s_mt 
    798  
    799                 npt = numpnts(q_ml)  
    800                 DeletePoints npt-nEnd,nEnd, q_ml,i_ml,s_ml 
    801  
    802                 npt = numpnts(q_mr)  
    803                 DeletePoints npt-nEnd,nEnd, q_mr,i_mr,s_mr 
    804  
    805                 npt = numpnts(q_b)  
    806                 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b 
    807                  
    808         endif 
    809  
    810         if(binType == 2)         
    811                 Wave/Z q_ftb = qBin_qxqy_FTB 
    812                 Wave/Z q_flr = qBin_qxqy_FLR 
    813                 Wave/Z q_mtb = qBin_qxqy_MTB 
    814                 Wave/Z q_mlr = qBin_qxqy_MLR 
    815                 Wave/Z q_b = qBin_qxqy_B 
    816                  
    817                 Wave/Z i_ftb = iBin_qxqy_FTB 
    818                 Wave/Z i_flr = iBin_qxqy_FLR 
    819                 Wave/Z i_mtb = iBin_qxqy_MTB 
    820                 Wave/Z i_mlr = iBin_qxqy_MLR 
    821                 Wave/Z i_b = iBin_qxqy_B 
    822                                  
    823                 Wave/Z s_ftb = eBin_qxqy_FTB 
    824                 Wave/Z s_flr = eBin_qxqy_FLR 
    825                 Wave/Z s_mtb = eBin_qxqy_MTB 
    826                 Wave/Z s_mlr = eBin_qxqy_MLR 
    827                 Wave/Z s_b = eBin_qxqy_B 
    828                  
    829  
    830                 DeletePoints 0,nBeg, q_ftb,q_flr,q_mtb,q_mlr,q_b 
    831                 DeletePoints 0,nBeg, i_ftb,i_flr,i_mtb,i_mlr,i_b 
    832                 DeletePoints 0,nBeg, s_ftb,s_flr,s_mtb,s_mlr,s_b 
    833                 //since each set may have a different number of points 
    834                 npt = numpnts(q_ftb)  
    835                 DeletePoints npt-nEnd,nEnd, q_ftb,i_ftb,s_ftb            
    836                  
    837                 npt = numpnts(q_flr)  
    838                 DeletePoints npt-nEnd,nEnd, q_flr,i_flr,s_flr            
    839                  
    840                 npt = numpnts(q_mtb)  
    841                 DeletePoints npt-nEnd,nEnd, q_mtb,i_mtb,s_mtb            
    842                  
    843                 npt = numpnts(q_mlr)  
    844                 DeletePoints npt-nEnd,nEnd, q_mlr,i_mlr,s_mlr            
    845                  
    846                 npt = numpnts(q_b)  
    847                 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b          
    848                  
    849  
    850         endif 
    851  
    852         if(binType == 3)         
    853                 Wave/Z q_flrtb = qBin_qxqy_FLRTB 
    854                 Wave/Z q_mlrtb = qBin_qxqy_MLRTB 
    855                 Wave/Z q_b = qBin_qxqy_B 
    856                  
    857                 Wave/Z i_flrtb = iBin_qxqy_FLRTB 
    858                 Wave/Z i_mlrtb = iBin_qxqy_MLRTB 
    859                 Wave/Z i_b = iBin_qxqy_B         
    860                  
    861                 Wave/Z s_flrtb = eBin_qxqy_FLRTB 
    862                 Wave/Z s_mlrtb = eBin_qxqy_MLRTB 
    863                 Wave/Z s_b = eBin_qxqy_B 
    864                  
    865                 DeletePoints 0,nBeg, q_flrtb,q_mlrtb,q_b 
    866                 DeletePoints 0,nBeg, i_flrtb,i_mlrtb,i_b 
    867                 DeletePoints 0,nBeg, s_flrtb,s_mlrtb,s_b 
    868                 //since each set may have a different number of points 
    869                 npt = numpnts(q_flrtb)  
    870                 DeletePoints npt-nEnd,nEnd, q_flrtb,i_flrtb,s_flrtb              
    871                  
    872                 npt = numpnts(q_mlrtb)  
    873                 DeletePoints npt-nEnd,nEnd, q_mlrtb,i_mlrtb,s_mlrtb              
    874                  
    875                 npt = numpnts(q_b)  
    876                 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b          
    877  
    878         endif 
    879  
    880 // TODO - This is the identical set of waves as for the case of binType = 1. 
    881 // they have the same names, but are averaged differently since it's slit mode. 
    882 // I have separated this, since in practice the TB panels are probably best to ignore 
    883 // and NOT include in the averaging since the Qy range is so limited. 
    884         if(binType == 4)         
    885                 Wave/Z q_fb = qBin_qxqy_FB 
    886                 Wave/Z q_ft = qBin_qxqy_FT 
    887                 Wave/Z q_fl = qBin_qxqy_FL 
    888                 Wave/Z q_fr = qBin_qxqy_FR 
    889                 Wave/Z q_mb = qBin_qxqy_MB 
    890                 Wave/Z q_mt = qBin_qxqy_MT 
    891                 Wave/Z q_ml = qBin_qxqy_ML 
    892                 Wave/Z q_mr = qBin_qxqy_MR 
    893                 Wave/Z q_b = qBin_qxqy_B 
    894          
    895                 Wave/Z i_fb = iBin_qxqy_FB 
    896                 Wave/Z i_ft = iBin_qxqy_FT 
    897                 Wave/Z i_fl = iBin_qxqy_FL 
    898                 Wave/Z i_fr = iBin_qxqy_FR 
    899                 Wave/Z i_mb = iBin_qxqy_MB 
    900                 Wave/Z i_mt = iBin_qxqy_MT 
    901                 Wave/Z i_ml = iBin_qxqy_ML 
    902                 Wave/Z i_mr = iBin_qxqy_MR 
    903                 Wave/Z i_b = iBin_qxqy_B 
    904                  
    905                 Wave/Z s_fb = eBin_qxqy_FB 
    906                 Wave/Z s_ft = eBin_qxqy_FT 
    907                 Wave/Z s_fl = eBin_qxqy_FL 
    908                 Wave/Z s_fr = eBin_qxqy_FR 
    909                 Wave/Z s_mb = eBin_qxqy_MB 
    910                 Wave/Z s_mt = eBin_qxqy_MT 
    911                 Wave/Z s_ml = eBin_qxqy_ML 
    912                 Wave/Z s_mr = eBin_qxqy_MR 
    913                 Wave/Z s_b = eBin_qxqy_B 
    914                                  
    915                 DeletePoints 0,nBeg, q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b 
    916                 DeletePoints 0,nBeg, i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b 
    917                 DeletePoints 0,nBeg, s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b 
    918                 //since each set may have a different number of points 
    919                 npt = numpnts(q_fb)  
    920                 DeletePoints npt-nEnd,nEnd, q_fb,i_fb,s_fb 
    921  
    922                 npt = numpnts(q_ft)  
    923                 DeletePoints npt-nEnd,nEnd, q_ft,i_ft,s_ft 
    924  
    925                 npt = numpnts(q_fl)  
    926                 DeletePoints npt-nEnd,nEnd, q_fl,i_fl,s_fl 
    927  
    928                 npt = numpnts(q_fr)  
    929                 DeletePoints npt-nEnd,nEnd, q_fr,i_fr,s_fr 
    930  
    931                 npt = numpnts(q_mb)  
    932                 DeletePoints npt-nEnd,nEnd, q_mb,i_mb,s_mb 
    933  
    934                 npt = numpnts(q_mt)  
    935                 DeletePoints npt-nEnd,nEnd, q_mt,i_mt,s_mt 
    936  
    937                 npt = numpnts(q_ml)  
    938                 DeletePoints npt-nEnd,nEnd, q_ml,i_ml,s_ml 
    939  
    940                 npt = numpnts(q_mr)  
    941                 DeletePoints npt-nEnd,nEnd, q_mr,i_mr,s_mr 
    942  
    943                 npt = numpnts(q_b)  
    944                 DeletePoints npt-nEnd,nEnd, q_b,i_b,s_b 
    945                  
    946         endif 
    947                          
    948         SetDataFolder root: 
    949         return(0) 
    950 end 
    951  
    952  
    953  
    954 / 
     418// 
    955419Proc V_Load_Data_ITX() 
    956420        V_Load_itx("","",0,0) 
     
    1050514//                      Duplicate/O $("root:"+n2), $w2 
    1051515         
    1052                         // no resolution matrix to make 
     516        // no resolution matrix to make 
    1053517 
    1054518         
     
    1056520End 
    1057521 
     522 
     523 
     524// string function to select the correct string constant 
     525// that corresponds to the selected binType. This string constant 
     526// contains the list of extensions to be used for plotting, saving, etc. 
     527// 
     528// returns null string if no match 
     529// 
     530Function/S V_getBinTypeString(binType) 
     531        Variable binType 
     532         
     533        String detListStr="" 
     534        if(binType == 1) 
     535                detListStr = ksBinType1 
     536        endif 
     537        if(binType == 2) 
     538                detListStr = ksBinType2 
     539        endif 
     540        if(binType == 3) 
     541                detListStr = ksBinType3 
     542        endif 
     543        if(binType == 4) 
     544                detListStr = ksBinType4 
     545        endif 
     546        if(binType == 5) 
     547                detListStr = ksBinType5 
     548        endif 
     549        if(binType == 6) 
     550                detListStr = ksBinType6 
     551        endif 
     552        if(binType == 7) 
     553                detListStr = ksBinType7 
     554        endif 
     555         
     556         
     557        return(detListStr) 
     558End 
    1058559 
    1059560// given strings of the number of points to remove, loop over the detectors 
     
    1067568        String nBegStr,nEndStr 
    1068569         
    1069         String detListStr 
    1070         if(binType == 1) 
    1071                 detListStr = ksBinType1 
    1072         endif 
    1073         if(binType == 2) 
    1074                 detListStr = ksBinType2 
    1075         endif 
    1076         if(binType == 3) 
    1077                 detListStr = ksBinType3 
    1078         endif 
    1079         if(binType == 4) 
    1080                 detListStr = ksBinType4 
    1081         endif 
     570        String detListStr="" 
     571 
     572        detListStr = V_getBinTypeString(binType)                //the list of extensions 
    1082573        if(strlen(detListStr)==0) 
    1083574                return(0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Initialize.ipf

    r1064 r1073  
    3131// this need never change from 1 
    3232Constant kBCTR_CM = 1                   //set to 1 to use beam center in cm. O to use pixels 
     33 
     34// // TODO: -- replace this constant with V_getDet_panel_gap(fname,detStr) 
    3335Constant kPanelTouchingGap = 10                 // TODO -- measure this gap when panels "touch", UNITS OF mm, not cm 
    3436 
     
    4648 
    4749// for defining which "bin type" corresponds to which set of extensions for I(q) data 
     50// !! see V_BinTypeStr2Num() for the numbering, not the order of the list 
     51// 
    4852////////////////// 
    49 Strconstant ksBinTypeStr = "One;Two;Four;Slit Mode;" 
    50 Strconstant ksBinType1 = "B;FT;FB;FL;FR;MT;MB;ML;MR;"           //these are the "active" extensions 
    51 Strconstant ksBinType2 = "B;FTB;FLR;MTB;MLR;" 
    52 Strconstant ksBinType3 = "B;FLRTB;MLRTB;" 
    53 Strconstant ksBinType4 = "B;FT;FB;FL;FR;MT;MB;ML;MR;" 
     53//Strconstant ksBinTypeStr = "One;Two;Four;Slit Mode;" 
     54Strconstant ksBinTypeStr = "F4-M4-B;F2-M2-B;F1-M1-B;F2-M1-B;F1-M2xTB-B;F2-M2xTB-B;SLIT-F2-M2-B;" 
     55Strconstant ksBinType1 = "FT;FB;FL;FR;MT;MB;ML;MR;B;"           //these are the "active" extensions 
     56Strconstant ksBinType2 = "FTB;FLR;MTB;MLR;B;" 
     57Strconstant ksBinType3 = "FLRTB;MLRTB;B;" 
     58//Strconstant ksBinType4 = "FT;FB;FL;FR;MT;MB;ML;MR;B;" 
     59Strconstant ksBinType4 = "FL;FR;ML;MR;B;"               //in SLIT mode 
     60Strconstant ksBinType5 = "FTB;FLR;MLRTB;B;" 
     61Strconstant ksBinType6 = "FLRTB;MLR;B;" 
     62Strconstant ksBinType7 = "FTB;FLR;MLR;B;" 
    5463/////////////////// 
    5564 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Instrument_Resolution.ipf

    r1072 r1073  
    228228// MAR 2011 - removed the del_r terms, they don't apply since no bining is done to the 2D data 
    229229// 
    230 Function get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS) 
     230Function V_get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS) 
    231231        Variable inQ, phi,lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses,r_dist 
    232232        Variable &SigmaQX,&SigmaQY,&fSubS               //these are the output quantities at the input Q value 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MainPanel.ipf

    r1050 r1073  
    114114        String ctrlName 
    115115 
    116         ReduceAFile() 
     116        V_ReductionProtocolPanel() 
     117//      ReduceAFile() 
    117118End 
    118119 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Marquee_Operations.ipf

    r1064 r1073  
    242242                bottom = round(V_bottom) 
    243243 
    244                 // NOTE: 
    245                 // this function MODIFIES x and y values on return, converting them to panel coordinates 
    246244                // detector panel is identified from the (left,top) coordinate (x1,y2) 
    247245                String detStr = V_FindDetStrFromLoc(left,right,bottom,top)               
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MaskUtils.ipf

    r1064 r1073  
    4040//// DRAWING/SAVING 
    4141// 
    42 // TODO: 
     42// (DONE) 
    4343// x- CHANGE the mask behavior to a more logical choice - and consistent with SANS 
    4444//   x- CHANGE to: 
     
    4646// 0 == no Mask == keep data 
    4747// x- and then make the corresponding changes in the I(Q) routines 
    48  
    49  
     48// 
    5049// x- move the mask generating utilities from VC_HDF5_Utils into this procedure - to keep 
    5150// all of the mask procedures together 
     
    5655//  this is done through a window hook function (LR moves tube number, up/down = add/delete) 
    5756// 
    58 // TODO 
    59 // -- make the arrow keys Igor 6 compatible - search for specialKeyCode or Keyboard Events in the help file 
     57// (DONE) 
     58// x- (NO)- Igor 7 is necessary for some VSANS functionality, so do not support Igor 6 
     59//    x (no)make the arrow keys Igor 6 compatible - search for specialKeyCode or Keyboard Events in the help file 
    6060//     and what needs to be replaced for Igor 6 
    61 // TODO 
    62 // -- for L/R panels, the maksing of columns should be sufficient. Tubes are vertical. For the T/B panels 
     61// DONE 
     62// x- for L/R panels, the maksing of columns should be sufficient. Tubes are vertical. For the T/B panels 
    6363//         the L/R panels cast a vertical shadow (=vertical mask) AND the tubes are horizontal, so the individual 
    6464//         tubes will likely need to be masked in a horizontal line too, per tube. ADD this in... 
     
    455455// x- currently is hard-wired for the simulation path!   need to make it more generic, especially for RAW data 
    456456// 
    457 // -- need to adjust the size of the image subwindows to keep the model 
    458 //    calculation from spilling over onto the table (maybe just move the table) 
     457// -- need to adjust the size of the image subwindows  
     458// 
    459459// -- need to do something for panel "B". currently ignored 
    460 // -- currently the pixel sizes for "real" data is incorrect in the file 
    461 //     and this is why the plots are incorrectly sized 
    462 // -- error checking if the data does not exist in selected work folder 
     460// 
    463461// 
    464462// draw the selected panel and the model calculation, adjusting for the  
     
    595593// overlay the mask 
    596594// 
    597 //  
     595// (DONE) 
    598596// x- remove the old mask first 
    599597// x- make the mask "toggle" to remove it 
     
    728726// 
    729727// TODO 
    730 // -- make the number of pixels GLOBAL 
     728// -- make the number of pixels GLOBAL to pick up the right numbers for the detector dimensions 
    731729//  x- there will be lots of work to do to develop the procedures necessary to actually generate the  
    732730//      9 data sets to become the MASK file contents. More complexity here than for the simple SANS case. 
     
    843841 
    844842 
    845 // TODO 
    846 // -- currently, there are no dummy fill values or attributes for the fake MASK file 
     843// (DONE) 
     844// x- currently, there are no dummy fill values or attributes for the fake MASK file 
    847845// 
    848846Proc Setup_VSANS_MASK_Struct() 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Menu.ipf

    r1070 r1073  
    6969 
    7070// 
    71 Menu "SANS" 
     71xMenu "SANS" 
    7272        "Initialize" 
    7373        "SANS Help" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_MultipleReduce.ipf

    r1050 r1073  
    66// 
    77// Procedures for the MRED panel to allow quick batch reduction of data files 
    8 // -as of 8/01, use the new method of requiring only run numbers to select the datafiles 
    9 //              and these data failes need not be consecutively numbered 
    108// 
    119//****note that much of this file is becoming obsolete as improved methods for  
     
    1715// TODO 
    1816// -- these procedures are in the process of being updated for VSANS 
    19 //    and are highly susceptible to change as user preferences bocome apparent 
    20  
     17//    and are highly susceptible to change pending user feedback 
     18// 
    2119 
    2220//panel to allow reduction of a series of files using a selected  protocol 
     
    102100EndMacro 
    103101 
    104 ////simple procedure to bring the CAT TABLE to the front if it is present 
    105 ////alerts user, but does nothing else if CAT TABLE is not present  
    106 ////called by several panels 
    107 //// 
    108 //Proc ShowCATWindow() 
    109 //      DoWindow/F CatVSTable 
    110 //      if(V_flag==0) 
    111 //              DoAlert 0,"There is no File Catalog table. Use the File Catalog button to create one." 
    112 //      Endif 
    113 //End 
    114102 
    115103 
     
    117105//that is COMMA delimited, and creates a new list that is also COMMA delimited 
    118106//and contains the full path:file;vers for each file in the list 
    119 //and ensures that files in returned list are RAW data , and can be found on disk 
     107//and ensures that files in returned list are RAW data, and can be found on disk 
    120108// 
    121109Function/S  V_FullNameListFromFileList(list) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Protocol_Reduction.ipf

    r1072 r1073  
    22162216 
    22172217//////////////////////////////////////////////////////// 
    2218  
    2219 // TODO: 
    2220 // -- calculation works, needs proper inputs (solid angle aware) 
    2221 // --   Open beam method needs to be verified in V_AskForAbsoluteParams_Quest() 
     2218// Absolute scale 
     2219 
     2220// x- calculation works, needs proper inputs (solid angle aware) 
     2221// x-   Open beam method needs to be verified in V_AskForAbsoluteParams_Quest() 
    22222222        Variable c2,c3,c4,c5,kappa_err 
    22232223        //do absolute scaling if desired 
     
    22732273                If(cmpstr("ask",prot[3])==0) 
    22742274                        //get file from user 
    2275                         // TODO 
    22762275                        // x- fill in the get file prompt, and handle the result 
    22772276                        Prompt mskFileName,"MASK File",popup,V_PickMASKButton("") 
     
    23342333        // bin and plot the data 
    23352334         
    2336         // TODO 
    2337 // -- this switch does nothing -- fill it in 
     2335// 
    23382336//       x- need to convert BINTYPE keyword into a numerical value to pass 
    23392337// 
     
    23512349// TODO: 
    23522350// -- do I calculate the proper resolution here? I've already decoded the binning type 
    2353 //   and the averaging type has been specified by the protocol 
     2351//   and the averaging type has been specified by the protocol. 
     2352// 
     2353// currently, the resolution is calculated every time that the data is averaged (in VC_fDoBinning_QxQy2D) 
     2354// 
    23542355// -- if I calculate the resolution here, then the Trimming routines must be updated 
    2355 //    to trim the resolution waves also. This positioning may work for  
     2356//    to trim the resolution waves also. This will work for the columns present in 
    23562357//    pinhole resolution, but anything using the matrix method - it won't work - and I'll need  
    23572358//    a different solution 
     
    24102411 
    24112412 
    2412 // TODO 
     2413//  
    24132414// x- how do I get the sample file name? 
    24142415//    local variable samFileLoaded is the file name loaded (contains the extension) 
    24152416//       
    2416         //save data if desired 
     2417        //save data if desired - dispatch as needed 
    24172418        String fullpath = "", newfileName="" 
    24182419        String saveType = StringByKey("SAVE",prot[5],"=",";")           //does user want to save data? 
     2420 
    24192421        If( (cmpstr(saveType[0,2],"Yes")==0) && (cmpstr(av_type,"none") != 0) )          
    24202422                //then save 
     
    24442446                //if this doesn't exist, a dialog will be presented by setting dialog = 1 
    24452447                // 
    2446                 // 
    24472448                Variable dialog = 0 
    24482449 
    2449 // TODO 
    2450 // -- need to define nBeg and nEnd somewhere 
    2451 // -- currently hard-wired 
    2452 // --do I need to define these "per-panel"?              
    2453                  
    24542450                PathInfo/S catPathName 
    24552451                String item = StringByKey("NAME",prot[5],"=",";")               //Auto or Manual naming 
     
    24852481//                              SaveAsPNG(activeType,fullpath,dialog) 
    24862482                                break 
    2487                         default: 
     2483                        case "Circular":                //in SANS, this was the default, but is dangerous, so make it explicit here 
    24882484//                              if (useXMLOutput == 1) 
    24892485//                                      WriteXMLWaves_W_Protocol(activeType,fullPath,dialog) 
     
    24922488//                              endif 
    24932489// 
    2494 // TODO: 
    2495 // -- fill in all of the cases, default is only the "standard" circular average I(q) 
    2496 // -- get the trim strings from somewhere-- from the file or from the protocol?? 
     2490// x- get the trim strings from somewhere-- from the file or from the protocol?? 
    24972491//   then replace the null strings being passed 
    24982492 
    24992493                                if(cmpstr(saveType,"Yes - Concatenate")==0) 
    2500                                         V_Trim1DDataStr(activeType,binType,prot[7],prot[8])                     // TODO -- passing null strings uses global or default trim values 
    2501 //                                      V_Trim1DData(activeType,binType,nBeg,nEnd) 
     2494                                        V_Trim1DDataStr(activeType,binType,prot[7],prot[8])                     // x- passing null strings uses global or default trim values 
     2495 
    25022496                                        V_ConcatenateForSave("root:Packages:NIST:VSANS:",activeType,"",binType)         // this removes q=0 point, concatenates, sorts 
    25032497                                        V_Write1DData("root:Packages:NIST:VSANS:",activeType,newFileName+"."+exten)             //don't pass the full path, just the name 
     
    25092503                                endif 
    25102504                                Print "data written to:  "+ newFileName+"."+exten 
     2505 
     2506                                break 
     2507                        default: 
     2508                                DoAlert 0, "av_type not found in dispatch to write file" 
    25112509 
    25122510                endswitch 
     
    26602658                // store these locally 
    26612659                 
    2662                 // TODO 
     2660 
    26632661                // x- need to get the panel string for the sum. 
    26642662                // x- the detector string is currently hard-wired 
     
    26702668                Print "empty err/counts = ",empty_ct_err/emptyCts 
    26712669 
    2672                 //              TODO 
    2673                 // -- get all of the proper values for the calculation 
     2670// 
     2671                // x- get all of the proper values for the calculation 
    26742672                // -x currently the attenuation is incorrect 
    26752673                //   such that kappa_err = 1*kappa 
    2676                 // -- verify the calculation (no solid angle needed??) 
    2677                  
    2678                 DoAlert 0,"This calculation is not reliable - something is wrong" 
    2679                  
     2674                // x- verify the calculation (no solid angle needed??) 
     2675                                 
    26802676                // get the attenuation factor for the empty beam 
    2681                 // TODO -- the attenuation is not written by NICE to the file 
     2677                // -- the attenuation is not written by NICE to the file 
    26822678                //  so I need to calculate it myself from the tables 
    26832679                //  
     
    27062702                kappa_err = sqrt(kappa_err) * kappa 
    27072703                 
    2708                 // TODO 
    2709                 // -- set the parameters in the global string 
     2704                // x- set the parameters in the global string 
    27102705                junkStr = num2str(kappa) 
    27112706                errStr = num2Str(kappa_err) 
     
    27132708                 
    27142709 
    2715                 Printf "Kappa was (maybe) successfully calculated as = %g +/- %g (%g %)\r",kappa,kappa_err,(kappa_err/kappa)*100 
     2710                Printf "Kappa was successfully calculated as = %g +/- %g (%g %)\r",kappa,kappa_err,(kappa_err/kappa)*100 
    27162711         
    27172712                // restore preferences on exit 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_RAW_Data_Panel.ipf

    r1064 r1073  
    179179        TitleBox title_file,pos={606,178},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gLastLoadedFile 
    180180        TitleBox title_dataPresent,pos={606,210},size={76,20},variable= root:Packages:NIST:VSANS:Globals:gCurDispFile 
    181         TitleBox title_status,pos={606,240},size={200,200},variable= root:Packages:NIST:VSANS:Globals:gStatusText 
     181        TitleBox title_status,pos={606,240},size={200,200},fsize=12,variable= root:Packages:NIST:VSANS:Globals:gStatusText 
    182182         
    183183//      Button button_tagFile,pos={720,412},size={70,20},proc=V_TagFileButtonProc,title="Tag File" 
     
    832832 
    833833 
    834 // TODO 
     834// 
    835835// 
    836836// opens a separate panel with the I(q) representation of the data 
    837 // ? controls here to select how the data is processed/grouped/saved, etc. 
    838 // 
    839 // -- currently just the graph, no controls 
    840 // -- this re-bins the data every time by calling V_QBinAllPanels(folderStr,binType) from inside V_BinningModePopup() 
     837//  controls on the panel select how the data is processed/grouped, etc. 
     838// 
     839// 
    841840Function V_IvsQPanelButtonProc(ba) : ButtonControl 
    842841        STRUCT WMButtonAction &ba 
     
    848847                        V_PlotData_Panel()              //-9999 requests a read from the popup on the panel 
    849848                        Variable binType = V_GetBinningPopMode() 
    850                         V_BinningModePopup("",binType,"")               // does default circular binning and updates the graph 
     849                        ControlInfo/W=V_1D_Data popup0 
     850                        V_BinningModePopup("",binType,S_Value)          // does binning of current popString and updates the graph 
    851851                         
    852852                        break 
     
    864864//  see the file V_IQ_Annular.ipf for all of the features yet to be added. 
    865865// 
    866 // -- currently just the graph, no controls 
    867 // -- this re-bins the data every time by calling V_QBinAllPanels(folderStr,binType) from inside V_BinningModePopup() 
     866// x- currently just the graph, no controls 
     867// 
    868868Function V_annularAvgButtonProc(ba) : ButtonControl 
    869869        STRUCT WMButtonAction &ba 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Utilities_General.ipf

    r1064 r1073  
    66// 
    77// for use by multiple panels and packages 
    8  
    9  
    10 //prompts user to choose the local folder that contains the SANS Data 
     8// 
     9 
     10 
     11//prompts user to choose the local folder that contains the VSANS Data 
    1112//only one folder can be used, and its path is catPathName (and is a NAME, not a string) 
    1213//this will overwrite the path selection 
     
    7677        return(WaveExists(w)) 
    7778end 
     79 
     80 
    7881// 
    7982// tests if two values are close enough to each other 
     
    9497 
    9598 
    96 // TODO: 
    97 // -- this must be called as needed to force a re-read of the data from disk 
     99// (DONE): 
     100// x- this must be called as needed to force a re-read of the data from disk 
    98101//    "as needed" means that when an operation is done that needs to ensure 
    99102//     a fresh read from disk, it must take care of the kill. 
    100 // -- the ksBaseDFPath needs to be removed. It's currently pointing to RawVSANS, which is 
     103// x- the ksBaseDFPath needs to be removed. It's currently pointing to RawVSANS, which is 
    101104//    really not used as intended anymore. 
     105// 
     106// *** this appears to be unused, in favor of V_CleanupData_w_Progress(0,1)  ********** 
    102107// 
    103108Function V_KillNamedDataFolder(fname) 
     
    115120end 
    116121 
    117 // TODO: 
     122// (DONE) 
    118123// x- this still does not quite work. If there are no sub folders present in the RawVSANS folder 
    119124//    it still thinks there is (1) item there. 
    120 // -- if I replace the semicolon with a comma, it thinks there are two folders present and appears 
     125// x- if I replace the semicolon with a comma, it thinks there are two folders present and appears 
    121126//    to delete the RawVSANS folder itself! seems very dangerous...this is because DataFolderDir returns 
    122127//    a comma delimited list, but with a semicolon and \r at the end. need to remove these... 
     
    212217                endif 
    213218                 
    214                 ValDisplay valdisp0,win=ProgressPanel,value= _NUM:num,win=ProgressPanel 
     219                ValDisplay valdisp0,win=ProgressPanel,value= _NUM:num 
    215220                DoUpdate /W=ProgressPanel 
    216221        while(1) 
     
    501506        V_PlotData_Panel()              // read the binType from the panel 
    502507        Variable binType = V_GetBinningPopMode() 
    503         V_BinningModePopup("",binType,"")               // does default circular binning and updates the graph 
     508        ControlInfo/W=V_1D_Data popup0 
     509        V_BinningModePopup("",binType,S_Value)          // does default circular binning and updates the graph 
    504510 
    505511 
     
    607613//      (check the instrument name...) 
    608614 
    609 // TODO -- as was written by SANS, this function is expecting fname to be the path:fileName 
     615// (DONE) x- as was written by SANS, this function is expecting fname to be the path:fileName 
    610616// - but are the V_get() functions OK with getting a full path, and what do they 
    611617//  do when they fail? I don't want them to spit up another open file dialog 
    612618// 
    613 // -- problem -- if "sans1234.abs" is passed, then V_getStringFromHDF5(fname,path,num) 
     619// x- problem -- if "sans1234.abs" is passed, then V_getStringFromHDF5(fname,path,num) 
    614620//  will remove the extension and look for the sans1234 folder -- which may or may not be present. 
    615621//  If it is present, then sans1234 validates as RAW data -- which is incorrect! 
    616 // -- so I need a way to exclude everything that does not have the proper extension... 
     622// x- so I need a way to exclude everything that does not have the proper extension... 
    617623// 
    618624// 
     
    673679 
    674680 
    675 // TODO -- the file name structure for VSANS file is undecided 
     681// (DONE) x- the file name structure for VSANS file is undecided 
    676682// so some of these base functions will need to change 
    677683// 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_VSANS_Preferences.ipf

    r1056 r1073  
    9393        // Special global to prevent fake data from "B" detector from being written out 
    9494        val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gIgnoreDetB", 1 ) 
    95         Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 0 
     95        Variable/G root:Packages:NIST:VSANS:Globals:gIgnoreDetB = 1 
    9696                 
    97  
     97        DoAlert 0,"The Back detector will be ignored. Change this in the Preferences Panel" 
     98         
    9899// flag to allow adding raw data files with different attenuation (normally not done)    
    99100//      val = NumVarOrDefault("root:Packages:NIST:VSANS:Globals:gDoAdjustRAW_Atten",0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_WorkFolderUtils.ipf

    r1055 r1073  
    607607        // (3) dead time correction 
    608608        // TODO: 
    609         // x- remove the hard-wired test - done 
    610609        // -- test for correct operation 
    611610        // x- loop over all of the detectors 
     
    646645 
    647646        // (4) solid angle correction 
    648         // TODO -- this currently calculates the correction factor AND applys it to the data 
     647        // -- this currently calculates the correction factor AND applys it to the data 
    649648        //  -- as a result, the data values are very large since they are divided by a very small 
    650649        //     solid angle per pixel. But all of the count values are now on the basis of  
    651650        //    counts/(solid angle) --- meaning that they can all be binned together for I(q) 
    652         //    -and- TODO - this will need to be taken into account for absolute scaling (this part is already done) 
     651        //    -and- - this is taken into account for absolute scaling (this part is already done) 
    653652        // 
    654653        // the solid angle correction is calculated for ALL detector panels. 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_Write_VSANS_QIS.ipf

    r1064 r1073  
    44 
    55 
    6 / TODO: 
     6// TODO: 
    77// -- this is a temporary solution before a real writer is created 
    88// -- resolution is not generated here (and it shouldn't be) since resolution is not known yet. 
Note: See TracChangeset for help on using the changeset viewer.