Ignore:
Timestamp:
Nov 28, 2017 9:39:57 AM (5 years ago)
Author:
srkline
Message:

Important change -- re-worked the calculation of how the detector panel "gap" is treated. It is now split equally between the panels rather than assigned to one panel. Makes no difference in the q calculation, simply a philosophical change that should make the measured beam centers make a little more sense, as they will be symmetric.

Changed the appearance and function of the panel to select the "trim" values for the combined 1D data sets. Data no longer needs to be saved as ITX and re-read into the panel. Simply uses the data binning popup and the current data.

File:
1 edited

Legend:

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

    r1050 r1074  
    5252                ModifyGraph cbRGB=(44000,44000,44000) 
    5353                 
    54                 Button button2,pos={15,5},size={70,20},proc=V_Load_ITX_button,title="Load Data" 
    55                 Button button2,help={"Load an ITX file"} 
     54//              Button button2,pos={15,5},size={70,20},proc=V_Load_ITX_button,title="Load Data" 
     55//              Button button2,help={"Load an ITX file"} 
    5656                 
    57                 PopupMenu popup1,pos={125,5},size={90,20},title="Data Folder" 
    58                 PopupMenu popup1,help={"data folder"} 
    59                 PopupMenu popup1,value= GetAList(4),proc=V_DataFolderPlotPop 
     57//              PopupMenu popup1,pos={125,5},size={90,20},title="Data Folder" 
     58//              PopupMenu popup1,help={"data folder"} 
     59//              PopupMenu popup1,value= GetAList(4),proc=V_DataFolderPlotPop 
    6060                 
    61                 PopupMenu popup0,pos={320,5},size={70,20},title="Bin Type" 
     61                PopupMenu popup0,pos={15,5},size={70,20},title="Bin Type" 
    6262                PopupMenu popup0,help={"binning type"} 
    63                 PopupMenu popup0,value= ksBinTypeStr 
     63                PopupMenu popup0,value= ksBinTypeStr,proc=V_DataBinTypePlotPop 
    6464 
    6565                Button button3,pos={544.00,5},size={30.00,20.00},title="?" 
     
    7575                Button button1,help={"Convert the waves to global strings"} 
    7676                 
    77                 Button button4,pos={388,36},size={90.00,20.00},title="Trim & Save" 
    78                 Button button4,help={"combine and save 1D data"},proc=V_SaveTrimmed_Button 
     77//              Button button4,pos={388,36},size={90.00,20.00},title="Trim & Save" 
     78//              Button button4,help={"combine and save 1D data"},proc=V_SaveTrimmed_Button 
    7979                 
    8080                Button button0,pos={524,36},size={70,20},proc=V_DoneCombine1D_ButtonProc,title="Done" 
     
    147147         
    148148//      SetDataFolder root:ToTrim 
    149         ControlInfo/W=V_1D_Combine popup1 
    150         String dataFldrStr = S_Value 
     149//      ControlInfo/W=V_1D_Combine popup1 
     150//      String dataFldrStr = S_Value 
     151         
     152        SVAR curDispType = root:Packages:NIST:VSANS:Globals:gCurDispType 
     153        String dataFldrStr = "root:Packages:NIST:VSANS:"+curDispType 
    151154         
    152155        Variable num,ii,p1,p2 
     
    157160                detStr = panelStr[ii] 
    158161                Wave/Z iw = $("root:ToTrim:iBin_qxqy_"+detStr+"_trim") 
    159                 Wave/Z iw_orig = $("root:"+dataFldrStr+":iBin_qxqy_"+detStr) 
     162                Wave/Z iw_orig = $(dataFldrStr+":iBin_qxqy_"+detStr) 
    160163//              Wave/Z iw = $("iBin_qxqy_"+detStr) 
    161164//              Wave/Z ew = $("eBin_qxqy_"+detStr) 
     
    190193//  then the waves are always missing - and the function returns an error - every time 
    191194// 
     195// now works with the "current" data that is displayed, rather than relying on  
     196// a lot of user input regarding the details of the saved data 
     197// 
     198Function V_DataBinTypePlotPop(ctrlName,popNum,popStr) : PopupMenuControl 
     199        String ctrlName 
     200        Variable popNum // which item is currently selected (1-based) 
     201        String popStr           // contents of current popup item as string 
     202 
     203 
     204        String str,winStr="V_1D_Combine" 
     205        Variable binType,num,ii,err 
     206 
     207        binType = V_BinTypeStr2Num(popStr) 
     208         
     209         
     210        //  x- need to update this to make sure that the data waves are present before plotting. This 
     211        //    currently looks in the ToTrim folder, but the binning could be wrong in the data folder 
     212        //    and will be an error... 
     213         
     214        //dataType now needs to be the full path to the folder 
     215        // Plot the "real" data. data copy to trim will be plotted later 
     216        // 
     217        SVAR dispType = root:Packages:NIST:VSANS:Globals:gCurDispType 
     218 
     219 
     220// dispatch based on the string, not on the number of selection in the pop string 
     221        V_QBinAllPanels_Circular(dispType,binType) 
     222 
     223        String workTypeStr 
     224        workTypeStr = "root:Packages:NIST:VSANS:"+dispType 
     225         
     226 
     227//      dataType = "root:"+popStr 
     228//       
     229//      //remove EVERYTHING from the graph, no matter what 
     230        String type,list,item 
     231//      list = TraceNameList(winStr,";",1) 
     232//      for(ii=0;ii<ItemsInList(list);ii+=1) 
     233//              item = StringFromList(ii, list, ";") 
     234////            CheckDisplayed/W=$winStr $(item) 
     235////            if(V_flag==1) 
     236//                      RemoveFromGraph/Z/W=$winStr $(item) 
     237////            endif 
     238//      endfor   
     239//       
     240         
     241        sprintf str,"(\"%s\",%d,\"%s\")",workTypeStr,binType,winStr 
     242 
     243        Execute ("V_Back_IQ_Graph"+str) 
     244        Execute ("V_Middle_IQ_Graph"+str) 
     245        Execute ("V_Front_IQ_Graph"+str) 
     246 
     247        ModifyGraph marker=8,opaque=1,msize=3           //make the traces open white circles 
     248 
     249 
     250        NewDataFolder/O root:ToTrim 
     251         
     252        //remove all of the "toTrim" data from the graph, if it's there 
     253        SetDataFolder root:ToTrim 
     254        for(ii=0;ii<ItemsInList(ksPanelBinTypeList);ii+=1) 
     255                type = StringFromList(ii, ksPanelBinTypeList, ";") 
     256                CheckDisplayed/W=$winStr $("iBin_qxqy_"+type+"_trim") 
     257                if(V_flag==1) 
     258                        RemoveFromGraph/W=$winStr $("iBin_qxqy_"+type+"_trim") 
     259                endif 
     260        endfor   
     261        SetDataFolder root: 
     262 
     263 
     264        //then kill the data folder, so it can be duplicated 
     265         
     266// 
     267//      // duplicate all of the data into the new folder 
     268        SetDataFolder $workTypeStr 
     269        list = WaveList("*",";","")             //must be in the correct data folder 
     270        SetDataFolder root: 
     271//      Print list       
     272        num = ItemsInList(list) 
     273        for(ii=0;ii<num;ii+=1) 
     274                str = StringFromList(ii,list) 
     275                Duplicate/O $(workTypeStr+":"+str), $("root:ToTrim:"+str+"_trim") 
     276        endfor 
     277         
     278//      // be sure that the data is present in the ToTrim folder before trying to plot 
     279//      err = V_TrimWavesExist(binType) 
     280//      if(err) 
     281//              DoAlert 0,"wrong bin type selected" 
     282//              return(0) 
     283//      endif 
     284         
     285         
     286        // plot the linked data 
     287        sprintf str,"(\"%s\",%d,\"%s\")","root:ToTrim",binType,winStr 
     288 
     289        Execute ("V_Back_IQ_Graph_trim"+str) 
     290        Execute ("V_Middle_IQ_Graph_trim"+str) 
     291        Execute ("V_Front_IQ_Graph_trim"+str) 
     292        // and link the data to the table with a dependency? 
     293//      done in the panel macro? 
     294         
     295        // last, force the dependency to update so that the trimmed points are shown 
     296        Wave w = root:Packages:NIST:VSANS:Globals:Protocols:Beg_pts 
     297        w[0] += 1 
     298        w[0] -= 1 
     299         
     300         
     301        return(0)        
     302End 
     303 
     304 
     305 
     306//  
     307// x- verify that the proper waves exist for the binning type 
     308// 
     309// x- the logic here is wrong. if the ToTrim folder is empty (As on startup) 
     310//  then the waves are always missing - and the function returns an error - every time 
     311// 
     312// currently unused, in favor of using the current data rather than saved itx data 
    192313// 
    193314Function V_DataFolderPlotPop(ctrlName,popNum,popStr) : PopupMenuControl 
     
    294415        return(0)        
    295416End 
     417 
     418 
    296419 
    297420// kill the dependency, 
Note: See TracChangeset for help on using the changeset viewer.