Ignore:
Timestamp:
Apr 9, 2007 3:42:39 PM (15 years ago)
Author:
srkline
Message:

2nd pass of pulling out NCNR calls. Also cleared a lot of deadwood from the code, removing depricated functions that were mostly already commented out.

File:
1 edited

Legend:

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

    r74 r76  
    345345End 
    346346 
    347 //unused tesing procedure 
    348 // 
    349 Proc AskToStripPoints(nb,ne) 
    350         Variable nb=7,ne=0 
    351         Prompt nb,"Points to strip from beginning of file" 
    352         Prompt ne,"Points to strip from end of file" 
    353          
    354         gBegPts = nb 
    355         gEndPts = ne 
    356          
    357 End 
    358  
    359347//gets the scaling constant to make (best) overlap of the specified datasets 
    360348//the scaling value is an average value of the individual scaling values for  
     
    380368                ii+=1 
    381369        while(ii<=num2) 
    382         Variable norm 
    383         norm = ratio/(num2+1)           // +1 counts for point zero 
    384         //Print "norm = ",norm 
    385  
    386         Return norm 
     370        Variable val 
     371        val = ratio/(num2+1)            // +1 counts for point zero 
     372        //Print "val = ",val 
     373 
     374        Return val 
    387375End 
    388376 
     
    593581//when a value is entered, the global value is set, and the corresponding dataset 
    594582//is updated on the plot, showing the new result of removing this number of points 
     583// 
     584//      SetVar boxes are named beg_N and end_N (so 4th element is the number) 
     585// 
     586// 1 == LowQ 
     587// 2 == MedQ 
     588// 3 == HighQ 
     589// 
    595590//"Plot_1" is the low-q button name 
    596591//"Plot_2" is the med-q button name 
    597592//"Plot_3" is the high-q button name 
     593// 
    598594//calling plot_0_Button() responds as if that named button were pressed 
     595// and gets the proper number to trim directly from the SetVar 
    599596// 
    600597Function SetBegOrEnd(ctrlName,varNum,varStr,varName) : SetVariableControl 
     
    609606        DoWindow/F NSORT_Panel 
    610607End 
    611  
    612 //Function SetEnd_1(ctrlName,varNum,varStr,varName) : SetVariableControl 
    613 //      String ctrlName 
    614 //      Variable varNum 
    615 //      String varStr 
    616 //      String varName 
    617 //       
    618 //      //Variable/G root:myGlobals:NSORT:gPtsEnd1 = varNum 
    619 //      print str2num(ctrlName[4]),ctrlName,varNum,varStr,varName 
    620 //      Plot_0_Button("Plot_1") 
    621 //      DoWindow/F NSORT_Panel 
    622 //End 
    623 // 
    624 ////see comments on SetEnd_1() 
    625 //// 
    626 //Function SetEnd_2(ctrlName,varNum,varStr,varName) : SetVariableControl 
    627 //      String ctrlName 
    628 //      Variable varNum 
    629 //      String varStr 
    630 //      String varName 
    631 //       
    632 //      Variable/G root:myGlobals:NSORT:gPtsEnd2 = varNum 
    633 //      Plot_0_Button("Plot_2") 
    634 //      DoWindow/F NSORT_Panel 
    635 //End 
    636 // 
    637 ////see comments on SetEnd_1() 
    638 //// 
    639 //Function SetEnd_3(ctrlName,varNum,varStr,varName) : SetVariableControl 
    640 //      String ctrlName 
    641 //      Variable varNum 
    642 //      String varStr 
    643 //      String varName 
    644 //       
    645 //      Variable/G root:myGlobals:NSORT:gPtsEnd3 = varNum 
    646 //      Plot_0_Button("Plot_3") 
    647 //      DoWindow/F NSORT_Panel 
    648 //End 
    649 // 
    650 ////see comments on SetEnd_1() 
    651 //// 
    652 //Function SetBeg_1(ctrlName,varNum,varStr,varName) : SetVariableControl 
    653 //      String ctrlName 
    654 //      Variable varNum 
    655 //      String varStr 
    656 //      String varName 
    657 //       
    658 //      Variable/G root:myGlobals:NSORT:gPtsBeg1 = varNum 
    659 //      Plot_0_Button("Plot_1") 
    660 //      DoWindow/F NSORT_Panel 
    661 //End 
    662 // 
    663 ////see comments on SetEnd_1() 
    664 //// 
    665 //Function SetBeg_2(ctrlName,varNum,varStr,varName) : SetVariableControl 
    666 //      String ctrlName 
    667 //      Variable varNum 
    668 //      String varStr 
    669 //      String varName 
    670 // 
    671 //      Variable/G root:myGlobals:NSORT:gPtsBeg2 = varNum 
    672 //      Plot_0_Button("Plot_2") 
    673 //      DoWindow/F NSORT_Panel 
    674 //End 
    675 // 
    676 ////see comments on SetEnd_1() 
    677 //// 
    678 //Function SetBeg_3(ctrlName,varNum,varStr,varName) : SetVariableControl 
    679 //      String ctrlName 
    680 //      Variable varNum 
    681 //      String varStr 
    682 //      String varName 
    683 // 
    684 //      Variable/G root:myGlobals:NSORT:gPtsBeg3 = varNum 
    685 //      Plot_0_Button("Plot_3") 
    686 //      DoWindow/F NSORT_Panel 
    687 //End 
    688  
    689 ////obsolete button control 
    690 //Function ManualScaleButton(ctrlName) : ButtonControl 
    691 //      String ctrlName 
    692 // 
    693 //      Execute "ManualScalePrompt()" 
    694 //       
    695 //End 
    696 // 
    697 ////obsolete missing param dialog 
    698 //Proc ManualScalePrompt(s12,s23) 
    699 //      Variable s12 = 1 
    700 //      Variable s23 = 1 
    701 //      Prompt s12,"enter the multiplier for medium q set" 
    702 //      Prompt s23,"enter the multiplier for high q set" 
    703 //       
    704 //      Variable/G root:myGlobals:NSORT:gScale1_2 = s12 
    705 //      Variable/G root:myGlobals:NSORT:gScale2_3 = s23 
    706 //End 
    707608 
    708609//this will--- 
     
    781682        return(0) 
    782683End 
    783  
    784684 
    785685//window recreation macro for NSORT Panel 
     
    869769        CheckBox AutoCheck,pos={14,310},size={100,20},title="Auto Scale",value=1 
    870770        CheckBox AutoCheck,help={"If checked, the scale factor will be automatically determined, if not checked, the current values in the fields will be used"} 
    871 //      CheckBox check_0,pos={282,91},size={80,20},title="Update ?",value=1 
    872 //      CheckBox check_0,help={"If checked, the list of data files will be updated from disk, unchecked (faster) will not refresh the list"} 
    873 //      CheckBox check_1,pos={282,174},size={80,20},title="Update ?",value=1 
    874 //      CheckBox check_1,help={"If checked, the list of data files will be updated from disk, unchecked (faster) will not refresh the list"} 
    875 //      CheckBox check_2,pos={282,257},size={80,20},title="Update ?",value=1 
    876 //      CheckBox check_2,help={"If checked, the list of data files will be updated from disk, unchecked (faster) will not refresh the list"} 
    877771EndMacro 
    878772 
     
    941835 
    942836//when menu is popped, it gets a valid list to display and updates the control 
    943 //**for speed, refreshes list only if checkbox is checked 
    944837// 
    945838// 2002- always refreshes, as new (fast) filter is used 
     
    949842        String popStr 
    950843 
    951         //only update the popup if the "update" checkbox is checked 
    952         //to improve speed 
    953 //      Variable checked = 0 
    954 //      ControlInfo check_0 
    955 //      checked = V_value 
    956          
    957 //      If(checked) 
    958                 String/G root:myGlobals:NSORT:gDataPopList = ReducedDataFileList("") 
    959                 ControlUpdate popup_1 
    960 //      Endif 
    961          
     844        String/G root:myGlobals:NSORT:gDataPopList = ReducedDataFileList("") 
     845        ControlUpdate popup_1 
     846 
     847        return(0) 
    962848End 
    963849 
    964850//when menu is popped, it gets a valid list to display and updates the control 
    965 //**for speed, refreshes list only if checkbox is checked 
    966851// 
    967852Function MedQPopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl 
     
    969854        Variable popNum 
    970855        String popStr 
    971          
    972         //only update the popup if the "update" checkbox is checked 
    973         //to improve speed 
    974 //      Variable checked = 0 
    975 //      ControlInfo check_1 
    976 //      checked = V_value 
    977          
    978 //      If(checked)              
    979                 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  ReducedDataFileList("") 
    980                 ControlUpdate popup_2 
    981                 if(cmpstr(popStr,"none")==0) 
    982                         PopupMenu popup_3,mode=1        //force "none" (item #1) to be the selection 
    983                         CheckBox AutoCheck,value=0      //un-check the auto-scale checkbox 
    984                         DoAlert 0,"You have only one data set. Auto Scaling has been unchecked and Mult Factor 1-2 will be applied to your data. Remember to re-check this as needed"// remind the user of this fact 
    985                         RemoveFromGraph/Z MedQSet_i,TrimMedQSet_i,HighQSet_i,TrimHighQSet_i             //remove the data from the graph 
    986                 Endif    
    987 //endif 
     856                 
     857        String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  ReducedDataFileList("") 
     858        ControlUpdate popup_2 
     859        if(cmpstr(popStr,"none")==0) 
     860                PopupMenu popup_3,mode=1        //force "none" (item #1) to be the selection 
     861                CheckBox AutoCheck,value=0      //un-check the auto-scale checkbox 
     862                DoAlert 0,"You have only one data set. Auto Scaling has been unchecked and Mult Factor 1-2 will be applied to your data. Remember to re-check this as needed"// remind the user of this fact 
     863                RemoveFromGraph/Z MedQSet_i,TrimMedQSet_i,HighQSet_i,TrimHighQSet_i             //remove the data from the graph 
     864        Endif    
     865        return(0) 
    988866End 
    989867 
     
    991869// - will be different, since set 3 can also be "none" if only 2 sets 
    992870//are to be NSORTed 
    993 //**for speed, refreshes list only if checkbox is checked 
    994871// 
    995872Function HighQPopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl 
     
    998875        String popStr 
    999876 
    1000         //only update the popup if the "update" checkbox is checked 
    1001         //to improve speed 
    1002 //      Variable checked = 0 
    1003 //      ControlInfo check_2 
    1004 //      checked = V_value 
    1005  
    1006 //      If(checked) 
    1007                 //add the option "none" to the file list (which should already end with a semicolon) 
    1008                 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  ReducedDataFileList("") 
    1009  
    1010                 ControlUpdate popup_3 
    1011                 if(cmpstr(popStr,"none")==0) 
    1012                         RemoveFromGraph/Z HighQSet_i,TrimHighQSet_i             //remove the data from the graph 
    1013                 Endif    
    1014                 ControlInfo popup_2 
    1015                 if(cmpstr(S_Value,"none")==0) 
    1016                         PopupMenu popup_3,mode=1        //force "none" (item #1) to be the selection if medium is none 
    1017                 endif 
    1018 //      Endif 
    1019          
    1020 End 
    1021  
    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 
     877        //add the option "none" to the file list (which should already end with a semicolon) 
     878        String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" +  ReducedDataFileList("") 
     879 
     880        ControlUpdate popup_3 
     881        if(cmpstr(popStr,"none")==0) 
     882                RemoveFromGraph/Z HighQSet_i,TrimHighQSet_i             //remove the data from the graph 
     883        Endif    
     884        ControlInfo popup_2 
     885        if(cmpstr(S_Value,"none")==0) 
     886                PopupMenu popup_3,mode=1        //force "none" (item #1) to be the selection if medium is none 
     887        endif 
     888        return(0)        
     889End 
     890 
    1076891 
    1077892//be sure to use the "Trim.." datasets that have had the bad points removed 
     
    12711086                Sort q123, q123,i123,sig123 
    12721087                ///////////////// 
    1273                  
    1274                 //old method 
    1275                         //first point of overlap region (from set 3) 
    1276                         //FindLevel/P/Q q123,(highq[0]) 
    1277                         //Variable firstOverlapPt = V_levelX 
    1278                         //last point of overlap region (from set 12) 
    1279                         //FindLevel/P/Q q123,(q12[n12-1]) 
    1280                         //Variable lastOverlapPt = V_levelX 
    1281                 //end old method, not used 
    12821088                 
    12831089                //find the maximum point number of set 2  in the overlap region 
     
    14761282                ///////////////// 
    14771283                 
    1478                 //old method 
    1479                         //first point of overlap region (from set 3) 
    1480                         //FindLevel/P/Q q123,(highq[0]) 
    1481                         //Variable firstOverlapPt = V_levelX 
    1482                         //last point of overlap region (from set 12) 
    1483                         //FindLevel/P/Q q123,(q12[n12-1]) 
    1484                         //Variable lastOverlapPt = V_levelX 
    1485                 //end old method, not used 
    1486                  
    14871284                //find the maximum point number of set 2  in the overlap region 
    14881285                FindLevel/P/Q highq,(q12[n12-1]) 
     
    15531350 
    15541351///////////////////////////////////////////////////////////// 
    1555 //testing, may speed up NSORT 
     1352// testing, may speed up NSORT, NCNR-specific naming scheme of  
     1353// run numbers and a run prefix 
    15561354Proc Set3NSORTFiles(low,med,hi,pref) 
    15571355        Variable low=1,med=2,hi=3 
     
    15791377End 
    15801378 
     1379//make a three character string of the run number 
    15811380Function/S ThreeDigitString(num) 
    15821381        Variable num 
    15831382         
    1584         //make a three character string of the run number 
    15851383        String numStr="" 
    15861384        if(num<10) 
     
    18661664 
    18671665 
    1868  
    1869  
    18701666// Commentized lines here are incomplete - and NON-FUNCTIONING 
    18711667// 
Note: See TracChangeset for help on using the changeset viewer.