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/PatchFiles.ipf

    r75 r76  
    121121                Abort "folder path does not exist - use Pick Path button" 
    122122        Endif 
    123         String list 
    124         list = IndexedFile(catPathName,-1,"????")       //get all files in folder 
     123         
     124        String newList = "" 
     125 
     126        newList = GetRawDataFileList() 
     127 
    125128        //trim list to include only selected files 
    126129        SVAR match = root:myGlobals:Patch:gPatchMatchStr 
    127         list = MyMatchList(match,list,";") 
    128         //further trim list to include only RAW SANS files 
    129         //this will exclude version numbers, .AVE, .ABS files, etc. from the popup (which can't be patched) 
    130         Variable num = ItemsInList(list,";") 
    131         Variable ii,isRAW 
    132         String item="",newList = "",fullName = "",partialName="" 
    133          
    134         //get rid of version numbers first (up to 11) 
    135         ii=1 
    136         do 
    137                 item = num2str(ii) 
    138                 list = RemoveFromList(item, list ,";" ) 
    139                 ii+=1 
    140         while(ii<12) 
    141          
    142         //then filter out only the raw data files 
    143         num = ItemsInList(list,";")        //get the new number of items in the list 
    144         ii=0 
    145         do 
    146                 //build valid filename 
    147                 item = StringFromList(ii, list  ,";" ) 
    148                 if(strlen(item) != 0) 
    149                    partialName = FindValidFileName(item) 
    150                    if(strlen(partialName) != 0)      //non-null return from FindValidFileName() 
    151                       fullName = path + partialName 
    152                       //check if RAW, if so, add original item to newList 
    153                       isRAW = CheckIfRawData(fullName) 
    154                       if(isRaw) 
    155                          newList += item + ";" 
    156                       Endif 
    157                    Endif 
    158                 Endif 
    159                 ii+=1 
    160         while(ii<num)      //process all items in list 
    161  
     130        newlist = MyMatchList(match,newlist,";") 
     131         
    162132        newList = SortList(newList,";",0) 
    163133        Return(newList) 
     
    664634        //just reset the global variables that are on the patch panel 
    665635         
    666 //      Variable refNum,integer,realval 
    667 //      String textstr="" 
    668 //      Variable countTime 
    669 //       
    670 //      //full filename with path is passed in 
    671 //      //actually open the file 
    672 //      Open/R refNum as fname 
    673 //       
    674 //      // read the sample.label text field 
    675 //      FSetPos refNum,98          //will start reading at byte 99 
    676 //      FReadLine/N=60 refNum,textstr 
    677 //      FSetPos refNum,31 
    678 //      FBinRead/B=3/F=3 refnum,countTime 
    679 //       
    680 //      Close refNum 
    681 //       
    682 //      //Print "countTime = ",countTime 
    683 //       
    684 //      //now get all of the reals 
    685 //      // 
    686 //      //Do all the GBLoadWaves at the end 
    687 //      // 
    688 //      //FBinRead Cannot handle 32 bit VAX floating point 
    689 //      //GBLoadWave, however, can properly read it 
    690 //      String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 
    691 //      String strToExecute 
    692 //      //append "/S=offset/U=numofreals" to control the read 
    693 //      // then append fname to give the full file path 
    694 //      // then execute 
    695 //       
    696 //      // NEW reads 
    697 //      Variable moncnt,savmon,detcnt,atten,trans,thick,temp,field 
    698 //      Variable dis,ang,bstop,ap1,ap2,ap12dis,lmda,dlmda,beamx,beamy,trnscnt 
    699 //       
    700 //      strToExecute = GBLoadStr + "/S=39/U=4" + "\"" + fname + "\"" 
    701 //      Execute strToExecute 
    702 //      Wave w=$"tempGBWave0" 
    703 //      moncnt = w[0] 
    704 //      savmon = w[1] 
    705 //      detcnt = w[2] 
    706 //      atten = w[3] 
    707 //      //printf "moncnt = %g,savmon = %g,detcnt = %g,atten = %g\r",moncnt,savmon,detcnt,atten 
    708 //       
    709 //      strToExecute = GBLoadStr + "/S=158/U=2" + "\"" + fname + "\"" 
    710 //      Execute strToExecute 
    711 //      trans = w[0] 
    712 //      thick = w[1] 
    713 //      //printf "trans = %g, thick = %g\r",trans,thick 
    714 //       
    715 //      strToExecute = GBLoadStr + "/S=186/U=2" + "\"" + fname + "\"" 
    716 //      Execute strToExecute 
    717 //      temp = w[0] 
    718 //      field = w[1] 
    719 //      //printf "temp = %g, field = %g\r",temp,field 
    720 //       
    721 //      strToExecute = GBLoadStr + "/S=252/U=12" + "\"" + fname + "\"" 
    722 //      Execute strToExecute 
    723 //      beamx = w[0] 
    724 //      beamy = w[1] 
    725 //      dis = w[2] 
    726 //      ang = w[3] 
    727 //      // w[4] det size 
    728 //      bstop = w[5] 
    729 //      // w[6] blank 
    730 //      ap1 = w[7] 
    731 //      ap2 = w[8] 
    732 //      ap12dis = w[9] 
    733 //      lmda = w[10] 
    734 //      dlmda = w[11] 
    735 //      //printf "beamx = %g, beamy = %g\r",beamx,beamy 
    736 //      //printf "dis = %g,ang = %g, bstop = %g,ap1= %g,ap2 = %g\r",dis,ang,bstop,ap1,ap2 
    737 //      //printf "ap12dis = %g, lmda = %g, dlmda = %g\r",ap12dis,lmda,dlmda 
    738 //       
    739 //      strToExecute = GBLoadStr + "/S=388/U=1" + "\"" + fname + "\"" 
    740 //      Execute strToExecute 
    741 //      trnscnt = w[0] 
    742 //      //printf "trnscnt = %g\r",trnscnt 
    743 //       
    744 //      //assign to the globals for display in the panel 
    745 //      String/G root:myGlobals:Patch:gPS1= textstr 
    746 //      Variable/G root:myGlobals:Patch:gPV1 = trans 
    747 //      Variable/G root:myGlobals:Patch:gPV2 = thick 
    748 //      Variable/G root:myGlobals:Patch:gPV3 = beamx 
    749 //      Variable/G root:myGlobals:Patch:gPV4 = beamy 
    750 //      Variable/G root:myGlobals:Patch:gPV5 = atten 
    751 //      Variable/G root:myGlobals:Patch:gPV6 = countTime 
    752 //      Variable/G root:myGlobals:Patch:gPV7 = moncnt 
    753 //      Variable/G root:myGlobals:Patch:gPV8 = detcnt 
    754 //      Variable/G root:myGlobals:Patch:gPV9 = trnscnt 
    755 //      Variable/G root:myGlobals:Patch:gPV10 = lmda 
    756 //      Variable/G root:myGlobals:Patch:gPV11 = dlmda 
    757 //      Variable/G root:myGlobals:Patch:gPV12 = temp 
    758 //      Variable/G root:myGlobals:Patch:gPV13 = field 
    759 //      Variable/G root:myGlobals:Patch:gPV14 = ap1 
    760 //      Variable/G root:myGlobals:Patch:gPV15 = ap2 
    761 //      Variable/G root:myGlobals:Patch:gPV16 = ap12dis 
    762 //      Variable/G root:myGlobals:Patch:gPV17 = ang 
    763 //      Variable/G root:myGlobals:Patch:gPV18 = bstop 
    764 //      Variable/G root:myGlobals:Patch:gPV19 = dis 
    765 //       
    766 //      //clean up - get rid of w = $"tempGBWave0" 
    767 //      KillWaves/Z w 
    768          
    769636        // each "get" is an individual call to GBLoadWave... 
    770637        // test for acceptable speed over a network... 
     
    879746 
    880747//simple action for button to close the panel 
    881 //closes all file that may accidently be open at this point 
    882 //(but none are open) 
    883 // 
    884748Function DoneButtonProc(ctrlName) : ButtonControl 
    885749        String ctrlName 
    886  
    887         // this button will make sure all files are closed  
    888         //and close the panel 
    889          
    890         Close/A 
     750         
    891751        DoWindow/K Patch_Panel 
    892752         
     
    903763         
    904764        //reset the global variable to the entered text so that it can be relayed to the  
    905         //write() routine. Only the TEXT SetVariable control needs to be handles this way 
     765        //write() routine. Only the TEXT SetVariable control needs to be handled this way 
    906766         
    907767        String/G root:myGlobals:Patch:gPS1 = varStr 
    908768 
    909769End 
    910  
    911  
    912 //button action function to set the XY box for the empty beam file (or reset it) 
    913 //this function is called by the button on the Patch Panel to set the XY box 
    914 //panel, but is nearly identical. This function resets the string used in the Patch 
    915 //panel to list the current empty beam file 
    916 // 
    917 //depends on the user slecting and setting the box with the marquee (see marquee.ipf) 
    918 //then reads the set coordinates from the global keyword string 
    919 //  
    920 //**********UNUSED****************** 
    921 //Function SetXYBoxButton(ctrlName) : ButtonControl 
    922 //      String ctrlName 
    923 // 
    924 //      String msgStr = "Select the Empty Beam FIle" 
    925 //      String filename,shortName 
    926 //       
    927 //      //get the filename, then read it in 
    928 //      filename = PromptForPath(msgStr) 
    929 //      //check for cancel from dialog 
    930 //      if(strlen(filename)==0) 
    931 //              //user cancelled, abort 
    932 //              SetDataFolder root: 
    933 //              Abort "No file selected, action aborted" 
    934 //      Endif 
    935 //      shortName = GetFileNameFromPathKeepSemi(filename) 
    936 //      String/G root:myGlobals:Patch:gPS2 = filename      //(reset the string for the patch panel) 
    937 //       
    938 //      ReadHeaderAndData(filename) 
    939 //      //data is displayed here (go htrough the normal display steps, so all is created properly 
    940 //      String/G root:myGlobals:gDataDisplayType="RAW" 
    941 //      fRawWindowHook() 
    942 //       
    943 //      // check the empty beam file for previously selected coordinates 
    944 //      //if they exist, set the xy string , save the normalized counts somewhere 
    945 //      //the value was written to an unused r*4 header analysis.factor (@b494) 
    946 //      Variable refnum,x1,x2,y1,y2,err 
    947 //      Open/R refnum as filename 
    948 //      FSetPos refnum,478 
    949 //      FBinRead/F=3/B=3 refnum, x1 
    950 //      FBinRead/F=3/B=3 refnum, x2 
    951 //      FBinRead/F=3/B=3 refnum, y1 
    952 //      FBinRead/F=3/B=3 refnum, y2 
    953 //      Close refnum 
    954 //      //read the real count value 
    955 //      String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 
    956 //      String strToExecute 
    957 //      strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + filename + "\"" 
    958 //      Execute strToExecute 
    959 //      Wave w=$"tempGBWave0" 
    960 //      Variable/G root:myGlobals:Patch:gTransCts = w[0] 
    961 //      // 
    962 //      if( ((x1-x2)==0) || ((y1-y2)==0) )         //zero width marquee in either direction 
    963 //              //no region selected 
    964 //               
    965 //              //add the empty beam file to work.SAM 
    966 //              err = Raw_to_work("SAM") 
    967 //       
    968 //              //the calling macro must change the display type 
    969 //              String/G root:myGlobals:gDataDisplayType="SAM"      //displayed data type is sam 
    970 //       
    971 //              //data is displayed here 
    972 //              fRawWindowHook() 
    973 //       
    974 //              //prompt user to select box w/marquee 
    975 //              DoAlert 0,"Select the region to sum with the Marquee" 
    976 //       
    977 //              //from here the Marquee menu selection must handle the task of setting the box 
    978 //              //and updating the information in the file header 
    979 //      else 
    980 //              // region already selected, just put up the values from the file header 
    981 //              //allow user the option of overriding the current box region 
    982 //              msgStr = "X1="+num2str(x1)+";" 
    983 //              msgStr += "X2="+num2str(x2)+";" 
    984 //              msgStr += "Y1="+num2str(y1)+";" 
    985 //              msgStr += "Y2="+num2str(y2)+";" 
    986 //              String textStr 
    987 //              textStr = "Override current box  "+msgStr+" ?" 
    988 //              DoAlert 1,textStr 
    989 //              If((V_flag)==1) 
    990 //                 //get new box coordinates, same procedure as above 
    991 //                 //add the empty beam file to work.SAM 
    992 //                 err = Raw_to_work("SAM") 
    993 //       
    994 //                 //the calling macro must change the display type 
    995 //                 String/G root:myGlobals:gDataDisplayType="SAM"      //displayed data type is sam 
    996 //       
    997 //                 //data is displayed here 
    998 //                 fRawWindowHook() 
    999 //       
    1000 //                 //prompt user to select box w/marquee 
    1001 //                 DoAlert 0,"Select the region to sum with the Marquee" 
    1002 //       
    1003 //                 //from here the Marquee menu selection must handle the task of setting the box 
    1004 //                 //and updating the information in the file header 
    1005 //              else 
    1006 //                 String/G root:myGlobals:Patch:gPS3 = msgStr 
    1007 //              Endif 
    1008 //      Endif 
    1009 //       
    1010 //      KillWaves/Z w 
    1011 //      Return (0) 
    1012 //End 
    1013  
Note: See TracChangeset for help on using the changeset viewer.