Changeset 646


Ignore:
Timestamp:
Mar 22, 2010 5:08:38 PM (13 years ago)
Author:
srkline
Message:

Moving SANS beta items to the proper panels.

  • Add all to Layout was moved to the Tile Raw 2D panel as a new button.
  • "Files at SDD" and "set MRED list" were added to the MRED panel, replacing buttons that generated a file catalog. it's doubtful that anyone used those buttons, and they aren't really needed now, anyhow. I changed the behavior slightly to show the table of label, SDD, and run number so one can delete points before (or after) accepting the list.
  • the corresponding items have been commented out from the beta menu (in includes_v520)
Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520.ipf

    r641 r646  
    103103////    "CreateRunNumList" 
    104104////    "TransList" 
    105         "ScatteringAtSDDList" 
     105//      "ScatteringAtSDDList"                   // MRED utilities have been added directly to the panel 
    106106////    "RemoveRunFromList" 
    107         "FillMREDList" 
     107//      "FillMREDList" 
    108108        "-" 
    109109////    "Set3NSORTFiles" 
     
    123123        "PatchFileNameInHeader" 
    124124        "ReadFileNameInHeader" 
    125         "-" 
    126         "AddALLToLayout" 
     125//      "-" 
     126//      "AddALLToLayout"                        //added to tile raw 2d panel 
    127127         
    128128End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultipleReduce.ipf

    r570 r646  
    8383        Button ReduceAllButton,pos={3,128},size={180,20},proc=ReduceAllPopupFiles,title="Reduce All Files in Popup" 
    8484        Button ReduceAllButton,help={"This will reduce ALL of the files in the popup list, not just the top file."} 
    85         Button DoneButton,pos={292,128},size={110,20},proc=MRDoneButtonProc,title="Done Reducing" 
     85        Button DoneButton,pos={280,128},size={110,20},proc=MRDoneButtonProc,title="Done Reducing" 
    8686        Button DoneButton,help={"When done reducing files, this will close this control panel."} 
    87         Button cat_short,pos={310,72},size={90,20},proc=DoCatShort,title="File Catalog" 
    88         Button cat_short,help={"Use this button to generate a table with file header information. Very useful for identifying files."} 
    89         Button show_cat_short,pos={280,98},size={120,20},proc=ShowCatShort_MRED,title="Show File Catalog" 
    90         Button show_cat_short,help={"Use this button to bring the File Catalog window to the front."} 
     87//      Button cat_short,pos={310,72},size={90,20},proc=DoCatShort,title="File Catalog" 
     88//      Button cat_short,help={"Use this button to generate a table with file header information. Very useful for identifying files."} 
     89//      Button show_cat_short,pos={280,98},size={120,20},proc=ShowCatShort_MRED,title="Show File Catalog" 
     90//      Button show_cat_short,help={"Use this button to bring the File Catalog window to the front."} 
     91        Button sddList,pos={280,72},size={120,20},proc=ScatteringAtSDDTableButton,title="Files at SDD List" 
     92        Button sddList,help={"Use this button to generate a table of scattering files at a given ample to detector distance."} 
     93        Button acceptList,pos={280,98},size={120,20},proc=AcceptMREDList,title="Accept List" 
     94        Button acceptList,help={"Accept the list of files to reduce."} 
    9195        PopupMenu MRProto_pop,pos={3,98},size={119,19},proc=MRProtoPopMenuProc,title="Protocol " 
    9296        PopupMenu MRProto_pop,help={"All of the data files in the popup will be reduced using this protocol"} 
     
    305309End 
    306310 
    307 //button procedure to close the panel 
     311//button procedure to close the panel, and the SDD table if if was generated 
    308312// 
    309313Function MRDoneButtonProc(ctrlName) : ButtonControl 
     
    315319        Close/A 
    316320        DoWindow/K Multiple_Reduce_Panel 
     321         
     322        DoWindow/K SDDTable      
    317323        KillDataFolder root:myGlobals:MRED 
    318324End 
     
    516522        return outputList 
    517523End 
     524 
     525Function ScatteringAtSDDTableButton(ctrlName) 
     526        String ctrlName 
     527         
     528        Execute "CreateScatteringAtSDDTable()" 
     529        return(0) 
     530End 
     531 
     532Function AcceptMREDList(ctrlName) 
     533        String ctrlName 
     534         
     535        SVAR/Z list = root:myGlobals:MRED:gFileNumList 
     536        if(SVAR_Exists(list)==0)                //check for myself 
     537                DoAlert 0,"The Multiple Reduce Panel must be open for you to use this function" 
     538                Return(1) 
     539        endif 
     540         
     541        // convert the wave to a comma-delimited List 
     542        wave/Z numW = $"root:myGlobals:MRED:RunNumber" 
     543        if(waveExists(numW)==0 || numpnts(numW)==0) 
     544                DoAlert 0, "Generate a list of files at a specific detector distance using the Files at SDD List button" 
     545                return(0) 
     546        Endif 
     547         
     548        list = NumWave2CommaList(numW) 
     549         
     550        //force an update If the SVAR exists, then the panel does too - MRED cleans up after itself when done 
     551        DoWindow/F Multiple_Reduce_Panel                        //bring to front 
     552        MRedPopMenuProc("MRFilesPopup",0,"")            //parse the list, pop the menu 
     553         
     554         
     555        return(0) 
     556End 
     557 
     558// - to create a table of scattering runs at an input SDD 
     559Proc CreateScatteringAtSDDTable(SDD_to_Filter) 
     560        Variable SDD_to_Filter 
     561         
     562        NewDataFolder/O root:myGlobals:MRED 
     563        DoWindow/F SDDTable 
     564         
     565        Make/O/T/N=0 $"root:myGlobals:MRED:Filenames" 
     566        Make/O/T/N=0 $"root:myGlobals:MRED:Suffix" 
     567        Make/O/T/N=0 $"root:myGlobals:MRED:Labels" 
     568        Make/O/D/N=0 $"root:myGlobals:MRED:SDD" 
     569        Make/O/D/N=0 $"root:myGlobals:MRED:RunNumber" 
     570        Make/O/D/N=0 $"root:myGlobals:MRED:IsTrans" 
     571 
     572        If(V_Flag==0) 
     573                SetDataFolder root:myGlobals:MRED 
     574                Edit Labels, SDD, runNumber as "Scattering at SDD" 
     575                DoWindow/C $"SDDTable" 
     576                 
     577                ModifyTable width(SDD)=40 
     578                ModifyTable width(Labels)=180 
     579                 
     580                ModifyTable width(Point)=0              //JUN04, remove point numbers - confuses users since point != run 
     581                SetDataFolder root: 
     582        Endif 
     583 
     584        //get a list of all files in the folder, some will be junk version numbers that don't exist      
     585        String list,partialName,tempName,temp="" 
     586        list = IndexedFile(catPathName,-1,"????")       //get all files in folder 
     587        Variable numitems,ii,ok 
     588         
     589        //remove version numbers from semicolon-delimited list 
     590        list =  RemoveVersNumsFromList(list) 
     591        numitems = ItemsInList(list,";") 
     592         
     593        //loop through all of the files in the list, reading CAT/SHORT information if the file is RAW SANS 
     594        //***version numbers have been removed*** 
     595        String str,fullName 
     596        Variable lastPoint 
     597        ii=0 
     598         
     599        Make/T/O/N=0 notRAWlist 
     600        do 
     601                //get current item in the list 
     602                partialName = StringFromList(ii, list, ";") 
     603                //get a valid file based on this partialName and catPathName 
     604                tempName = FindValidFilename(partialName) 
     605                If(cmpstr(tempName,"")==0)              //a null string was returned 
     606                        //write to notebook that file was not found 
     607                        //if string is not a number, report the error 
     608                        if(str2num(partialName) == NaN) 
     609                                str = "this file was not found: "+partialName+"\r\r" 
     610                                //Notebook CatWin,font="Times",fsize=12,text=str 
     611                        Endif 
     612                else 
     613                        //prepend path to tempName for read routine  
     614                        PathInfo catPathName 
     615                        FullName = S_path + tempName 
     616                        //make sure the file is really a RAW data file 
     617                        ok = CheckIfRawData(fullName) 
     618                        if (!ok) 
     619                                //write to notebook that file was not a RAW SANS file 
     620                                lastPoint = numpnts(notRAWlist) 
     621                                InsertPoints lastPoint,1,notRAWlist 
     622                                notRAWlist[lastPoint]=tempname 
     623                        else 
     624                                //go write the header information to the Notebook 
     625                                GetHeaderInfoToSDDWave(fullName,tempName) 
     626                        Endif 
     627                Endif 
     628                ii+=1 
     629        while(ii<numitems) 
     630//Now sort them all based on the suffix data (orders them as collected) 
     631//      SortCombineWaves() 
     632// sort by label 
     633//      SortCombineByLabel() 
     634// remove the transmission waves 
     635// 
     636        RemoveTransFilesFromSDDList() 
     637 
     638// Remove anything not at the desired SDD, then sort by run number 
     639        RemoveWrongSDDFromSDDList(SDD_to_Filter) 
     640         
     641// remove anything named blocked, empty cell, etc. 
     642        RemoveLabeledFromSDDList("EMPTY")               //not case-sensitive 
     643        RemoveLabeledFromSDDList("MT CELL")             //not case-sensitive 
     644        RemoveLabeledFromSDDList("BLOCKED BEAM")                //not case-sensitive 
     645        RemoveLabeledFromSDDList("BEAM BLOCKED")                //not case-sensitive 
     646 
     647End 
     648 
     649// need fuzzy comparison, since SDD = 1.33 may actually be represented in FP as 1.33000004      !!! 
     650// 
     651Function RemoveLabeledFromSDDList(findThisStr) 
     652        String findThisStr 
     653        Wave/T filenames = $"root:myGlobals:MRED:Filenames" 
     654        Wave/T suffix = $"root:myGlobals:MRED:Suffix" 
     655        Wave/T labels = $"root:myGlobals:MRED:Labels" 
     656        Wave sdd = $"root:myGlobals:MRED:SDD" 
     657        Wave runnum = $"root:myGlobals:MRED:RunNumber" 
     658        Wave isTrans = $"root:myGlobals:MRED:IsTrans" 
     659         
     660        Variable num=numpnts(Labels),ii,loc 
     661        ii=num-1 
     662        do 
     663                loc = strsearch(labels[ii], findThisStr, 0 ,2)          //2==case insensitive, but Igor 5 specific 
     664                if(loc != -1) 
     665                        Print "Remove w[ii] = ",num,"  ",labels[ii] 
     666                        DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans 
     667                endif 
     668                ii-=1 
     669        while(ii>=0) 
     670        return(0) 
     671End              
     672 
     673// need fuzzy comparison, since SDD = 1.33 may actually be represented in FP as 1.33000004      !!! 
     674// 
     675Function RemoveWrongSDDFromSDDList(tSDD) 
     676        Variable tSDD 
     677         
     678        Wave/T filenames = $"root:myGlobals:MRED:Filenames" 
     679        Wave/T suffix = $"root:myGlobals:MRED:Suffix" 
     680        Wave/T labels = $"root:myGlobals:MRED:Labels" 
     681        Wave sdd = $"root:myGlobals:MRED:SDD" 
     682        Wave runnum = $"root:myGlobals:MRED:RunNumber" 
     683        Wave isTrans = $"root:myGlobals:MRED:IsTrans" 
     684         
     685        Variable num=numpnts(sdd),ii,tol = 0.001 
     686        ii=num-1 
     687        do 
     688                if(abs(sdd[ii] - tSDD) > tol)           //if numerically more than 0.001 m different, they're not the same 
     689                        DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans 
     690                endif 
     691                ii-=1 
     692        while(ii>=0) 
     693         
     694        // now sort 
     695        Sort RunNum,    filenames,suffix,labels,sdd,runnum,isTrans 
     696        return(0) 
     697End 
     698 
     699 
     700Function RemoveTransFilesFromSDDList() 
     701        Wave/T filenames = $"root:myGlobals:MRED:Filenames" 
     702        Wave/T suffix = $"root:myGlobals:MRED:Suffix" 
     703        Wave/T labels = $"root:myGlobals:MRED:Labels" 
     704        Wave sdd = $"root:myGlobals:MRED:SDD" 
     705        Wave runnum = $"root:myGlobals:MRED:RunNumber" 
     706        Wave isTrans = $"root:myGlobals:MRED:IsTrans" 
     707         
     708        Variable num=numpnts(isTrans),ii 
     709        ii=num-1 
     710        do 
     711                if(isTrans[ii] != 0) 
     712                        DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans 
     713                endif 
     714                ii-=1 
     715        while(ii>=0) 
     716        return(0) 
     717End 
     718 
     719//reads header information and puts it in the appropriate waves for display in the table. 
     720//fname is the full path for opening (and reading) information from the file 
     721//which alreay was found to exist. sname is the file;vers to be written out, 
     722//avoiding the need to re-extract it from fname. 
     723Function GetHeaderInfoToSDDWave(fname,sname) 
     724        String fname,sname 
     725         
     726        String textstr,temp,lbl,date_time,suffix 
     727        Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick,xcenter,ycenter,numatten 
     728        Variable lastPoint, beamstop 
     729 
     730        Wave/T GFilenames = $"root:myGlobals:MRED:Filenames" 
     731        Wave/T GSuffix = $"root:myGlobals:MRED:Suffix" 
     732        Wave/T GLabels = $"root:myGlobals:MRED:Labels" 
     733        Wave GSDD = $"root:myGlobals:MRED:SDD" 
     734        Wave GRunNumber = $"root:myGlobals:MRED:RunNumber" 
     735        Wave GIsTrans = $"root:myGlobals:MRED:IsTrans" 
     736         
     737        lastPoint = numpnts(GLambda) 
     738                 
     739        InsertPoints lastPoint,1,GFilenames 
     740        GFilenames[lastPoint]=sname 
     741         
     742        //read the file suffix 
     743        InsertPoints lastPoint,1,GSuffix 
     744        GSuffix[lastPoint]=getSuffix(fname) 
     745 
     746        // read the sample.label text field 
     747        InsertPoints lastPoint,1,GLabels 
     748        GLabels[lastPoint]=getSampleLabel(fname) 
     749         
     750        //read in the SDD 
     751        InsertPoints lastPoint,1,GSDD 
     752        GSDD[lastPoint]= getSDD(fname) 
     753 
     754        //the run number (not displayed in the table, but carried along) 
     755        InsertPoints lastPoint,1,GRunNumber 
     756        GRunNumber[lastPoint] = GetRunNumFromFile(sname) 
     757 
     758        // 0 if the file is a scattering  file, 1 (truth) if the file is a transmission file 
     759        InsertPoints lastPoint,1,GIsTrans 
     760        GIsTrans[lastPoint]  = isTransFile(fname)               //returns one if beamstop is "out" 
     761         
     762        KillWaves/Z w 
     763        return(0) 
     764End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SANS_Utilities.ipf

    r570 r646  
    290290        DoUpdate 
    291291End 
     292 
    292293 
    293294//num passed in is the run number, as in the list 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Tile_2D.ipf

    r570 r646  
    4747Proc Tile_2D() 
    4848        PauseUpdate; Silent 1           // building window... 
    49         NewPanel /K=2 /W=(550,342,934,527) 
     49        NewPanel /W=(849,337,1242,526) /K=2 
    5050        DoWindow/C Tile_2D 
    5151         
     
    5353        ListBox fileList,listWave=root:myGlobals:Tile_2D:fileWave 
    5454        ListBox fileList,selWave=root:myGlobals:Tile_2D:selWave,mode= 4 
    55         Button button0,pos={233,131},size={110,20},proc=AddToLayoutButtonProc,title="Add To Layout" 
     55        Button button0,pos={217,109},size={170,20},proc=AddToLayoutButtonProc,title="Add Selected To Layout" 
    5656        Button button0,help={"Adds images of the selected files to the layout selected in the popup menu"} 
    57         Button button1,pos={266,157},size={50,20},proc=TileDoneButtonProc,title="Done" 
     57        Button button1,pos={316,160},size={50,20},proc=TileDoneButtonProc,title="Done" 
    5858        Button button1,help={"Closes the panel, kills the layouts, and kills images from your memory"} 
    5959        Button button3,pos={227,6},size={60,20},proc=GetListButtonProc,title="Get List" 
     
    6161        Button button4,pos={340,6},size={25,20},proc=ShowTileHelp,title="?" 
    6262        Button button4,help={"Show help file for tiling raw data files in a layout"} 
     63        Button button5,pos={217,133},size={170,20},proc=AddAllToLayout,title="Add All To Layout" 
     64        Button button5,help={"Adds images of all raw files, 40 per layout"} 
    6365        CheckBox check0,pos={216,64},size={71,14},title="Log scaling" 
    6466        CheckBox check0,help={"If checked, the image color will be log scale"},value= 1 
     
    204206// This test version will add 40 images to each layout, and tile them 
    205207// 
    206 // curently a Beta-only function 
    207 // 
    208 Function AddALLToLayout()// : ButtonControl 
     208Function AddALLToLayout(ctrlName) : ButtonControl 
    209209        String ctrlName 
    210210 
Note: See TracChangeset for help on using the changeset viewer.