Ignore:
Timestamp:
Mar 29, 2007 4:02:33 PM (16 years ago)
Author:
srkline
Message:

more file adjustments to clean out NCNR bits

Location:
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/FIT_Ops.ipf

    r47 r70  
    170170        String popStr 
    171171         
    172         String tempStr=filterButtonProc(ctrlName) 
     172        String tempStr=ReducedDataFileList(ctrlName) 
    173173        if(strlen(tempStr)==0) 
    174174                tempStr = "Pick the data path" 
     
    723723        String popStr 
    724724 
    725         String tempStr=filterButtonProc(ctrlName) 
     725        String tempStr=ReducedDataFileList(ctrlName) 
    726726        if(strlen(tempStr)==0) 
    727727                tempStr = "Pick the data path" 
     
    739739//** not used anymore - simpler file filter is used instead 
    740740// 
    741 Function/S GetValidFITRPAPopupList() 
    742  
    743         String list = "none;something;" 
    744          
    745         PathInfo catPathName 
    746         String path = S_path 
    747         if(V_flag == 0) 
    748                 Abort "path does not exist - use Pick Path button" 
    749         Endif 
    750          
    751         list = IndexedFile(catPathName,-1,"????")               //get all files in folder 
    752          
    753         //trim version numbers from list 
    754         Variable num = ItemsInList(list,";") 
    755         Variable ii,isRAW 
    756         String item = "",listCopy = "", fullName = "",partialName = "" 
    757          
    758         ii=1 
    759         do 
    760                 item = num2str(ii) 
    761                 list = RemoveFromList(item,list,";") 
    762                 ii+=1 
    763         while (ii<12) 
    764          
    765         //trim raw data files from list 
    766         listCopy = list                                 //scan through items in copy, change list 
    767         num = ItemsInList(listCopy,";")         //get the new number of items in the list 
    768         ii=0 
    769         do 
    770                 //build valid fileName 
    771                 item = StringFromList(ii,listCopy,";") 
    772                 if (strlen(item) !=0 ) 
    773                         partialName  = FindValidFileName(item) 
    774                         if(strlen(partialName) !=0)             //non-null return from FindValidFileName() 
    775                                 fullName = path + partialName 
    776                                 //check if RAW, if so, remove from list 
    777                                 isRAW = CheckIfRAWData(fullName) 
    778                                 if(isRAW) 
    779                                         list = RemoveFromList(item,list,";") 
    780                                 Endif 
    781                         Endif 
    782                 Endif 
    783                 ii+=1 
    784         While(ii<num) 
    785          
    786         return list 
    787 End 
     741//Function/S GetValidFITRPAPopupList() 
     742// 
     743//      String list = "none;something;" 
     744//       
     745//      PathInfo catPathName 
     746//      String path = S_path 
     747//      if(V_flag == 0) 
     748//              Abort "path does not exist - use Pick Path button" 
     749//      Endif 
     750//       
     751//      list = IndexedFile(catPathName,-1,"????")               //get all files in folder 
     752//       
     753//      //trim version numbers from list 
     754//      Variable num = ItemsInList(list,";") 
     755//      Variable ii,isRAW 
     756//      String item = "",listCopy = "", fullName = "",partialName = "" 
     757//       
     758//      ii=1 
     759//      do 
     760//              item = num2str(ii) 
     761//              list = RemoveFromList(item,list,";") 
     762//              ii+=1 
     763//      while (ii<12) 
     764//       
     765//      //trim raw data files from list 
     766//      listCopy = list                                 //scan through items in copy, change list 
     767//      num = ItemsInList(listCopy,";")         //get the new number of items in the list 
     768//      ii=0 
     769//      do 
     770//              //build valid fileName 
     771//              item = StringFromList(ii,listCopy,";") 
     772//              if (strlen(item) !=0 ) 
     773//                      partialName  = FindValidFileName(item) 
     774//                      if(strlen(partialName) !=0)             //non-null return from FindValidFileName() 
     775//                              fullName = path + partialName 
     776//                              //check if RAW, if so, remove from list 
     777//                              isRAW = CheckIfRAWData(fullName) 
     778//                              if(isRAW) 
     779//                                      list = RemoveFromList(item,list,";") 
     780//                              Endif 
     781//                      Endif 
     782//              Endif 
     783//              ii+=1 
     784//      While(ii<num) 
     785//       
     786//      return list 
     787//End 
    788788 
    789789// window recreation macro to draw the fit/rpa panel 
     
    10361036        tempName = FindValidFilename(partialName) 
    10371037 
     1038        Variable lambdaFromFile=GetLambdaFromReducedData(tempName) 
     1039        Variable/G root:myGlobals:FITRPA:gLambda = lambdaFromFile 
     1040        Print "Lambda in file read as:", lambdaFromFile 
     1041         
    10381042        //prepend path to tempName for read routine  
    10391043        PathInfo catPathName 
    1040  
    1041         String junkString 
    1042         Variable lambdaFromFile, fileVar 
    1043         lambdaFromFile = 6.0 
    1044         Open/R/P=catPathName fileVar as tempName 
    1045         FReadLine fileVar, junkString 
    1046         FReadLine fileVar, junkString 
    1047         FReadLine fileVar, junkString 
    1048         if(strsearch(LowerStr(junkString),"lambda",0) != -1) 
    1049                 FReadLine/N=11 fileVar, junkString 
    1050                 FReadLine/N=10 fileVar, junkString 
    1051                 lambdaFromFile = str2num(junkString) 
    1052         endif 
    1053         Close fileVar 
    1054          
    1055         Variable/G root:myGlobals:FITRPA:gLambda = lambdaFromFile 
    1056          
    1057         Print "Lambda in file read as:", lambdaFromFile 
    1058          
    10591044        tempName = S_path + tempName 
    10601045         
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Marquee.ipf

    r40 r70  
    2424//the x,y values must also be in axis coordinates[0,127] NOT (1,128) detector coords. 
    2525// 
     26// accepts arbitrary detector coordinates. calling function is responsible for  
     27// keeping selection in bounds 
    2628Function SumCountsInBox(x1,x2,y1,y2,type) 
    2729        Variable x1,x2,y1,y2 
     
    5456End 
    5557 
    56 //b BGtoFIX 
    57 // this function is a hard-coded special case of SumCountsInBox (that you copied) 
    58 // - delete this function, and call SumCountsInBox with the appropriate xy range 
    59 Function SumTotalCounts(type) 
    60 //      Variable x1,x2,y1,y2 
    61         String type 
    62          
    63         Variable counts = 0,ii,jj 
    64          
    65         String dest =  "root:"+type 
    66          
    67         //check for logscale data, but don't change the data 
    68         NVAR gIsLogScale = $(dest + ":gIsLogScale") 
    69         if (gIsLogScale) 
    70                 wave w=$(dest + ":linear_data") 
    71         else 
    72                 wave w=$(dest + ":data") 
    73         endif 
    74          
    75         ii=0 
    76         jj=0 
    77         do 
    78                 do 
    79                         counts += w[ii][jj] 
    80                         jj+=1 
    81                 while(jj<=127) 
    82                 jj=0 
    83                 ii+=1 
    84         while(ii<=127) 
    85          
    86         Return (counts) 
    87 End 
    88 //e BGtoFix 
    8958 
    9059//from a marquee selection: 
     
    13099                Execute "InitializeTransPanel()" 
    131100        Endif 
    132          
    133         //need to do error checking for in-bounds selection of marquee (0,127) inclusive 
    134         //reset to valid range or abort? 
    135 //      if((x1<0) || (x1>127)) 
    136 //              Abort "selection out-of-range" 
    137 //      endif 
    138 //      if((x2<0) || (x2>127)) 
    139 //              Abort "selection out-of-range" 
    140 //      endif 
    141 //      if((y1<0) || (y1>127)) 
    142 //              Abort "selection out-of-range" 
    143 //      endif 
    144 //      if((y2<0) || (y2>127)) 
    145 //              Abort "selection out-of-range" 
    146 //      endif 
    147101         
    148102        //write string as keyword-packed string, to use IGOR parsing functions 
     
    239193                 
    240194                KeepSelectionInBounds(left,right,bottom,top) 
    241                  
    242                 //test for selection out-of-bounds 
    243                 //reset to valid range or abort? 
    244 //              if((left<0) || (left>127)) 
    245 //                      Abort "selection out-of-range" 
    246 //              endif 
    247 //              if((right<0) || (right>127)) 
    248 //                      Abort "selection out-of-range" 
    249 //              endif 
    250 //              if((top<0) || (top>127)) 
    251 //                      Abort "selection out-of-range" 
    252 //              endif 
    253 //              if((bottom<0) || (bottom>127)) 
    254 //                      Abort "selection out-of-range" 
    255 //              endif 
    256195                 
    257196                // selection valid now, calculate beamcenter 
     
    326265// measuring the beam center. Note that you need to ADD ONE to fitted x0 and y0 to get detector 
    327266// coordinates rather than the zero-indexed array. 2D fitting does have the benefit of  
    328 // reporting error bars on the xy (if you believe that 2D gaussian is correct            
     267// reporting error bars on the xy (if you believe that 2D gaussian is correct)           
    329268                SetScale/I x qxlo,qxhi,"",data 
    330269                SetScale/I y qylo,qyhi,"",data 
     
    347286                y2=V_top 
    348287                KeepSelectionInBounds(x1,x2,y1,y2) 
    349 //              x1 = (round(V_left) >= 0) ? round(V_left) : 0 
    350 //              x2 = (round(V_right) <= 127) ? round(V_Right) : 127 
    351 //              y1 = (round(V_bottom) >= 0) ? round(V_bottom) : 0 
    352 //              y2 = (round(V_top) <= 127) ? round(V_top) : 127 
    353 //              Print "x1,x2,y1,y2 = ",x1,x2,y1,y2 
    354288 
    355289                //cross correlation coefficent (K6) must be between 0 and 1, need constraints 
     
    357291                temp_constr = {"K6>0","K6<1"} 
    358292                 
    359                 CurveFit/N Gauss2D data[(x1),(x2)][(y1),(y2)] /I=1 /W=data_err /D /R /A=0 /C=temp_constr 
     293                CurveFit/N Gauss2D data[x1,x2][y1,y2] /I=1 /W=data_err /D /R /A=0 /C=temp_constr 
    360294                 
    361295                Killwaves/Z temp_constr 
     
    479413// y2 = top 
    480414// 
     415// accepts any detector size 
    481416Function KeepSelectionInBounds(x1,x2,y1,y2) 
    482417        Variable &x1,&x2,&y1,&y2 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf

    r69 r70  
    829829// 
    830830 
    831 //returns a string containg the transmision stored in the file that is  
    832 //currently in the "type" folder (not from the binary header) 
    833 //returns "none" if the value (in RealsRead) cannot be found 
    834 // 
    835 Function/S GetTrans(type) 
    836         String type 
    837          
    838         String name="root:"+type+":realsread" 
    839         WAVE reals = $name 
    840         if(waveExists(reals)) 
    841                 return(num2str(reals[4])) 
    842         else 
    843                 return("none") 
    844         endif    
    845 End 
    846  
    847 //returns a string containg the sample thickness stored in the file that is  
    848 //currently in the "type" folder (not from the binary header) 
    849 //returns "none" if the value (in RealsRead) cannot be found 
    850 // 
    851 Function/S GetThick(type) 
    852         String type 
    853          
    854         String name="root:"+type+":realsread" 
    855         WAVE reals = $name 
    856         if(waveExists(reals)) 
    857                 return(num2str(reals[5])) 
    858         else 
    859                 return("none") 
    860         endif    
    861 End 
     831 
    862832 
    863833/////***************** 
     
    936906        Return(0) 
    937907End 
     908 
     909// read specific bits of information from the header 
     910// each of these operations MUST take care of open/close on their own 
     911 
     912Function/S getStringFromHeader(fname,start,num) 
     913        String fname                            //full path:name 
     914        Variable start,num              //starting byte and number of characters to read 
     915         
     916        String str 
     917        Variable refnum 
     918        Open/R refNum as fname 
     919        FSetPos refNum,start 
     920        FReadLine/N=(num) refNum,str 
     921        Close refnum 
     922         
     923        return(str) 
     924End 
     925// file suffix (4 characters @ byte 19) 
     926Function/S getSuffix(fname) 
     927        String fname 
     928         
     929        return(getStringFromHeader(fname,19,4)) 
     930End 
     931 
     932// sample label (60 characters @ byte 98) 
     933Function/S getSampleLabel(fname) 
     934        String fname 
     935         
     936        return(getStringFromHeader(fname,98,60)) 
     937End 
     938 
     939// read a single real value with GBLoadWave 
     940Function getRealValueFromHeader(fname,start) 
     941        String fname 
     942        Variable start 
     943 
     944        String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 
     945         
     946        GBLoadStr += "/S="+num2str(start)+"/U=1" + "\"" + fname + "\"" 
     947        Execute GBLoadStr 
     948        Wave w=$"tempGBWave0" 
     949         
     950        return(w[0]) 
     951End 
     952 
     953//SDD is at byte 260 
     954Function getSDD(fname) 
     955        String fname 
     956         
     957        return(getRealValueFromHeader(fname,260)) 
     958end 
     959//reads the wavelength from a reduced data file (not very reliable) 
     960// - does not work with NSORTed files 
     961// - only used in FIT/RPA (which itself is almost NEVER used...) 
     962// 
     963Function GetLambdaFromReducedData(tempName) 
     964        String tempName 
     965         
     966        String junkString 
     967        Variable lambdaFromFile, fileVar 
     968        lambdaFromFile = 6.0 
     969        Open/R/P=catPathName fileVar as tempName 
     970        FReadLine fileVar, junkString 
     971        FReadLine fileVar, junkString 
     972        FReadLine fileVar, junkString 
     973        if(strsearch(LowerStr(junkString),"lambda",0) != -1) 
     974                FReadLine/N=11 fileVar, junkString 
     975                FReadLine/N=10 fileVar, junkString 
     976                lambdaFromFile = str2num(junkString) 
     977        endif 
     978        Close fileVar 
     979         
     980        return(lambdaFromFile) 
     981End 
     982 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf

    r69 r70  
    968968End 
    969969 
     970//function called byt the popups to get a file list of data that can be sorted 
     971// this procedure simply removes the raw data files from the string - there 
     972//can be lots of other junk present, but this is very fast... 
     973// 
     974// could also use the alternate procedure of keeping only file with the proper extension 
     975// 
     976// another possibility is to get a listing of the text files, but is unreliable on  
     977// Windows, where the data file must be .txt (and possibly OSX) 
     978// 
     979Function/S ReducedDataFileList(ctrlName) 
     980        String ctrlName 
     981 
     982        String list="",newList="",item="" 
     983        Variable num,ii 
     984         
     985        //check for the path 
     986        PathInfo catPathName 
     987        if(V_Flag==0) 
     988                DoAlert 0, "Data path does not exist - pick the data path from the button on the main panel" 
     989                Return("") 
     990        Endif 
     991         
     992        list = IndexedFile(catpathName,-1,"????") 
     993        num=ItemsInList(list,";") 
     994        //print "num = ",num 
     995        for(ii=(num-1);ii>=0;ii-=1) 
     996                item = StringFromList(ii, list  ,";") 
     997                //simply remove all that are not raw data files (SA1 SA2 SA3) 
     998                if( !stringmatch(item,"*.SA1*") && !stringmatch(item,"*.SA2*") && !stringmatch(item,"*.SA3*") ) 
     999                        if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV"))                //eliminate mac "hidden" files, pxp, and div files 
     1000                                newlist += item + ";" 
     1001                        endif 
     1002                endif 
     1003        endfor 
     1004        //remove VAX version numbers 
     1005        newList = RemoveVersNumsFromList(newList) 
     1006        //sort 
     1007        newList = SortList(newList,";",0) 
     1008 
     1009        return newlist 
     1010End 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NSORT.ipf

    r59 r70  
    759759                SVAR popList = root:myGlobals:NSORT:gDataPopList 
    760760                SVAR popList_3 = root:myGlobals:NSORT:gDataPopList_3 
    761                 popList  = filterButtonProc("") 
    762                 popList_3 = "none;" +  filterButtonProc("") 
     761                popList  = ReducedDataFileList("") 
     762                popList_3 = "none;" +  ReducedDataFileList("") 
    763763                return(0) 
    764764        endif 
     
    776776        SVAR popList = root:myGlobals:NSORT:gDataPopList 
    777777        SVAR popList_3 = root:myGlobals:NSORT:gDataPopList_3 
    778         popList  = filterButtonProc("") 
    779         popList_3 = "none;" +  filterButtonProc("") 
     778        popList  = ReducedDataFileList("") 
     779        popList_3 = "none;" +  ReducedDataFileList("") 
    780780         
    781781        return(0) 
     
    956956         
    957957//      If(checked) 
    958                 String/G root:myGlobals:NSORT:gDataPopList = filterButtonProc("") 
     958                String/G root:myGlobals:NSORT:gDataPopList = ReducedDataFileList("") 
    959959                ControlUpdate popup_1 
    960960//      Endif 
     
    977977         
    978978//      If(checked)              
    979                 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  filterButtonProc("") 
     979                String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  ReducedDataFileList("") 
    980980                ControlUpdate popup_2 
    981981                if(cmpstr(popStr,"none")==0) 
     
    10061006//      If(checked) 
    10071007                //add the option "none" to the file list (which should already end with a semicolon) 
    1008                 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  filterButtonProc("") 
     1008                String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  ReducedDataFileList("") 
    10091009 
    10101010                ControlUpdate popup_3 
     
    10201020End 
    10211021 
    1022 //function returning a string (list) of semicolon separated filenames 
    1023 //that are not version numbers, and not raw data files 
    1024 //(can't really pare out other files any better - trying to just get ascii I vs. q) 
    1025 //works in folder specified by catPathName, (abort if it doesn't exist) 
    1026 // 
    1027 //***** UNUSED ******** - simpler fileFilter is used to simply filter out the raw data 
    1028 // 
    1029 Function/S GetValidNSORTPopupList() 
    1030  
    1031         String list = "none;something;" 
    1032          
    1033         PathInfo catPathName 
    1034         String path = S_path 
    1035         if(V_flag == 0) 
    1036                 Abort "path does not exist - use Pick Path button" 
    1037         Endif 
    1038          
    1039         list = IndexedFile(catPathName,-1,"????")               //get all files in folder 
    1040          
    1041         //trim version numbers from list 
    1042         Variable num = ItemsInList(list,";") 
    1043         Variable ii,isRAW 
    1044         String item = "",listCopy = "", fullName = "",partialName = "" 
    1045          
    1046         ii=1 
    1047         do 
    1048                 item = num2str(ii) 
    1049                 list = RemoveFromList(item,list,";") 
    1050                 ii+=1 
    1051         while (ii<12) 
    1052          
    1053         //trim raw data files from list 
    1054         listCopy = list                                 //scan through items in copy, change list 
    1055         num = ItemsInList(listCopy,";")         //get the new number of items in the list 
    1056         ii=0 
    1057         do 
    1058                 //build valid fileName 
    1059                 item = StringFromList(ii,listCopy,";") 
    1060                 if (strlen(item) !=0 ) 
    1061                         partialName  = FindValidFileName(item) 
    1062                         if(strlen(partialName) !=0)             //non-null return from FindValidFileName() 
    1063                                 fullName = path + partialName 
    1064                                 //check if RAW, if so, remove from list 
    1065                                 isRAW = CheckIfRAWData(fullName) 
    1066                                 if(isRAW) 
    1067                                         list = RemoveFromList(item,list,";") 
    1068                                 Endif 
    1069                         Endif 
    1070                 Endif 
    1071                 ii+=1 
    1072         While(ii<num) 
    1073          
    1074         return list 
    1075 End 
     1022////function returning a string (list) of semicolon separated filenames 
     1023////that are not version numbers, and not raw data files 
     1024////(can't really pare out other files any better - trying to just get ascii I vs. q) 
     1025////works in folder specified by catPathName, (abort if it doesn't exist) 
     1026//// 
     1027////***** UNUSED ******** - simpler fileFilter is used to simply filter out the raw data 
     1028//// 
     1029//Function/S GetValidNSORTPopupList() 
     1030// 
     1031//      String list = "none;something;" 
     1032//       
     1033//      PathInfo catPathName 
     1034//      String path = S_path 
     1035//      if(V_flag == 0) 
     1036//              Abort "path does not exist - use Pick Path button" 
     1037//      Endif 
     1038//       
     1039//      list = IndexedFile(catPathName,-1,"????")               //get all files in folder 
     1040//       
     1041//      //trim version numbers from list 
     1042//      Variable num = ItemsInList(list,";") 
     1043//      Variable ii,isRAW 
     1044//      String item = "",listCopy = "", fullName = "",partialName = "" 
     1045//       
     1046//      ii=1 
     1047//      do 
     1048//              item = num2str(ii) 
     1049//              list = RemoveFromList(item,list,";") 
     1050//              ii+=1 
     1051//      while (ii<12) 
     1052//       
     1053//      //trim raw data files from list 
     1054//      listCopy = list                                 //scan through items in copy, change list 
     1055//      num = ItemsInList(listCopy,";")         //get the new number of items in the list 
     1056//      ii=0 
     1057//      do 
     1058//              //build valid fileName 
     1059//              item = StringFromList(ii,listCopy,";") 
     1060//              if (strlen(item) !=0 ) 
     1061//                      partialName  = FindValidFileName(item) 
     1062//                      if(strlen(partialName) !=0)             //non-null return from FindValidFileName() 
     1063//                              fullName = path + partialName 
     1064//                              //check if RAW, if so, remove from list 
     1065//                              isRAW = CheckIfRAWData(fullName) 
     1066//                              if(isRAW) 
     1067//                                      list = RemoveFromList(item,list,";") 
     1068//                              Endif 
     1069//                      Endif 
     1070//              Endif 
     1071//              ii+=1 
     1072//      While(ii<num) 
     1073//       
     1074//      return list 
     1075//End 
    10761076 
    10771077//be sure to use the "Trim.." datasets that have had the bad points removed 
     
    15501550End 
    15511551 
    1552 //function called byt the popups to get a file list of data that can be sorted 
    1553 // this procedure simply removes the raw data files from the string - there 
    1554 //can be lots of other junk present, but this is very fast... 
    1555 // 
    1556 // could also use the alternate procedure of keeping only file with the proper extension 
    1557 // 
    1558 // another possibility is to get a listing of the text files, but is unreliable on  
    1559 // Windows, where the data file must be .txt (and possibly OSX) 
    1560 // 
    1561 Function/S filterButtonProc(ctrlName) 
    1562         String ctrlName 
    1563  
    1564         String list="",newList="",item="" 
    1565         Variable num,ii 
    1566          
    1567         //check for the path 
    1568         PathInfo catPathName 
    1569         if(V_Flag==0) 
    1570                 DoAlert 0, "Data path does not exist - pick the data path from the button on the main panel" 
    1571                 Return("") 
    1572         Endif 
    1573          
    1574         list = IndexedFile(catpathName,-1,"????") 
    1575         num=ItemsInList(list,";") 
    1576         //print "num = ",num 
    1577         for(ii=(num-1);ii>=0;ii-=1) 
    1578                 item = StringFromList(ii, list  ,";") 
    1579                 //simply remove all that are not raw data files (SA1 SA2 SA3) 
    1580                 if( !stringmatch(item,"*.SA1*") && !stringmatch(item,"*.SA2*") && !stringmatch(item,"*.SA3*") ) 
    1581                         if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV"))                //eliminate mac "hidden" files, pxp, and div files 
    1582                                 newlist += item + ";" 
    1583                         endif 
    1584                 endif 
    1585         endfor 
    1586         //remove VAX version numbers 
    1587         newList = RemoveVersNumsFromList(newList) 
    1588         //sort 
    1589         newList = SortList(newList,";",0) 
    1590  
    1591         return newlist 
    1592 End 
     1552 
    15931553 
    15941554///////////////////////////////////////////////////////////// 
     
    17991759         
    18001760        lastPoint = numpnts(GLambda) 
    1801          
    1802         Open/R refNum as fname 
    1803          
     1761                 
    18041762        InsertPoints lastPoint,1,GFilenames 
    18051763        GFilenames[lastPoint]=sname 
    18061764         
    18071765        //read the file suffix 
    1808         FSetPos refNum,19 
    1809         FReadLine/N=4 refNum,suffix 
    18101766        InsertPoints lastPoint,1,GSuffix 
    1811         GSuffix[lastPoint]=suffix 
     1767        GSuffix[lastPoint]=getSuffix(fname) 
    18121768 
    18131769        // read the sample.label text field 
    1814         FSetPos refNum,98               //will start reading at byte 99 
    1815         FReadLine/N=60 refNum,lbl 
    18161770        InsertPoints lastPoint,1,GLabels 
    1817         GLabels[lastPoint]=lbl 
    1818          
    1819         Close refNum 
    1820          
    1821         //read the reals with GBLoadWave 
    1822         String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 
    1823         String strToExecute 
    1824  
    1825         //SDD 
    1826         strToExecute = GBLoadStr + "/S=260/U=1" + "\"" + fname + "\"" 
    1827         Execute strToExecute 
    1828         Wave w=$"tempGBWave0" 
    1829         sdd = w[0] 
     1771        GLabels[lastPoint]=getSampleLabel(fname) 
     1772         
     1773        //read in the SDD 
    18301774        InsertPoints lastPoint,1,GSDD 
    1831         GSDD[lastPoint]=sdd 
     1775        GSDD[lastPoint]= getSDD(fname) 
    18321776 
    18331777        //the run number (not displayed in the table, but carried along) 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/PlotUtils.ipf

    r41 r70  
    663663        Endif 
    664664         
    665         String list=IndexedFile(catPathName,-1,"????") 
    666         String newList="",item="" 
    667         Variable num=ItemsInList(list,";"),ii 
    668         newList = list 
    669         for(ii=0;ii<num;ii+=1) 
    670                 item = StringFromList(ii, list  ,";") 
    671                 if( stringmatch(item,"*.sa1*") ) 
    672                         newlist  = RemoveFromList(item,newlist,";") 
    673                 endif 
    674                 if( stringmatch(item,"*.sa2*") ) 
    675                         newlist  = RemoveFromList(item,newlist,";") 
    676                 endif 
    677                 if( stringmatch(item,"*.sa3*") ) 
    678                         newlist  = RemoveFromList(item,newlist,";") 
    679                 endif 
    680                 if( stringmatch(item,".*") )            //remove "hidden" files starting with "." 
    681                         newlist  = RemoveFromList(item,newlist,";") 
    682                 endif 
    683                 //print "ii=",ii 
    684         endfor 
    685         newList = SortList(newList,";",0) 
     665        String newList = ReducedDataFileList("") 
     666        Variable num 
     667         
    686668        num=ItemsInList(newlist,";") 
    687669        WAVE/T fileWave=$"root:myGlobals:OneDLoader:fileWave" 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Schematic.ipf

    r41 r70  
    107107        //attenuators used in sample measurement 
    108108 
    109         text23 = "SAM Attenuator = "+num2str($"root:SAM:RealsRead"[3]) 
     109        text23 = "SAM Attenuator = "+GetAttenNum("SAM") 
    110110         
    111111        text11 = "Final 1-D Dataset" 
     
    438438        //attenuators used in sample measurement 
    439439 
    440         text23 = "SAM Attenuator = "+num2str($"root:SAM:RealsRead"[3]) 
     440        text23 = "SAM Attenuator = "+GetAttenNum("SAM") 
    441441         
    442442        text11 = "Final 1-D Dataset" 
     
    617617 
    618618End 
     619 
     620 
     621//returns a string containg the transmision stored in the file that is  
     622//currently in the "type" folder (not from the binary header) 
     623//returns "none" if the value (in RealsRead) cannot be found 
     624// 
     625Function/S GetTrans(type) 
     626        String type 
     627         
     628        String name="root:"+type+":realsread" 
     629        WAVE reals = $name 
     630        if(waveExists(reals)) 
     631                return(num2str(reals[4])) 
     632        else 
     633                return("none") 
     634        endif    
     635End 
     636 
     637//returns a string containg the sample thickness stored in the file that is  
     638//currently in the "type" folder (not from the binary header) 
     639//returns "none" if the value (in RealsRead) cannot be found 
     640// 
     641Function/S GetThick(type) 
     642        String type 
     643         
     644        String name="root:"+type+":realsread" 
     645        WAVE reals = $name 
     646        if(waveExists(reals)) 
     647                return(num2str(reals[5])) 
     648        else 
     649                return("none") 
     650        endif    
     651End 
     652 
     653//returns a string containg the sample thickness stored in the file that is  
     654//currently in the "type" folder (not from the binary header) 
     655//returns "none" if the value (in RealsRead) cannot be found 
     656// 
     657Function/S GetAttenNum(type) 
     658        String type 
     659         
     660        String name="root:"+type+":realsread" 
     661        WAVE reals = $name 
     662        if(waveExists(reals)) 
     663                return(num2str(reals[3])) 
     664        else 
     665                return("none") 
     666        endif    
     667End 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Transmission.ipf

    r69 r70  
    11951195// For the calculation of the Transmission using only the whole detector 
    11961196// Used to compute the transmission for the TransmissionFiles table using 
    1197 // the entire computer. For comparison with the "box" trans 
    1198 // updated: 5/11/2006 bo Bryan Greenwald 
     1197// the entire detector. For comparison with the "box" trans 
     1198// updated: 5/11/2006 by Bryan Greenwald 
    11991199Function CalcWholeTrans(startRow,endRow) 
    12001200        Variable startRow,endRow 
    12011201//      GetSelection table,ScatterFileTable,1 
    12021202 
     1203        NVAR pixelsX = root:myGlobals:gNPixelsX 
     1204        NVAR pixelsY = root:myGlobals:gNPixelsY 
     1205         
    12031206        String filename 
    12041207        Wave/T T_EMP_Filenames = $"root:myGlobals:TransHeaderInfo:T_EMP_Filenames" 
     
    12691272                                                err = Raw_to_work("SAM") 
    12701273                                                //sum region in SAM 
    1271                                                 transCts =  SumTotalCounts("SAM")        
     1274                                                transCts =  SumCountsInBox(0,pixelsX-1,0,pixelsY-1,"SAM")        
    12721275                                                // get the attenuator, lambda, and sample string (to get the instrument) 
    12731276                                                WAVE/T samText = $"root:SAM:textRead" 
     
    16101613End 
    16111614 
    1612 // b BGtoFix -comment to describe the workings of the function 
    1613 // since it's different than calculating the regular transmission 
    16141615// 
    16151616// I am not sure what the difference is inthe function of CalcTotalTrans and CalcWholeTrans ?  
    16161617// do they really do anything different? 
     1618// is it a useful calculation at all? 
    16171619//  
    16181620Function TotalTrans(ctrlName) : ButtonControl 
     
    16201622  
    16211623   Variable transTableExists 
    1622    transTableExists = WinType("ScatterFileTable")               // b BGtoFix -checking for the existence of the wrong table 
     1624   transTableExists = WinType("TransFileTable") 
    16231625   if (transTableExists != 0) 
    16241626                GetSelection table,transFileTable,1 
     
    16291631                        CalcWholeTrans(V_StartRow,V_EndRow) 
    16301632                Else 
    1631                         DoAlert 0,"No selection from Scattering Files table"                    // b BGtoFix - really looking for files from the Trans Table... 
     1633                        DoAlert 0,"No selection from Trans Files table" 
    16321634                Endif 
    16331635   Else 
    1634                 DoAlert 0,"No file selected from Scattering Files table or no Scattering Files table available"  // b BGtoFix - really looking for files from the Trans Table... 
     1636                DoAlert 0,"No file selected from Trans Files table or no Trans Files table available" 
    16351637   Endif 
    16361638End 
Note: See TracChangeset for help on using the changeset viewer.