Changeset 404 for sans/Dev/trunk/NCNR_User_Procedures/USANS/COR_Graph.ipf
 Timestamp:
 Sep 12, 2008 9:25:36 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/Dev/trunk/NCNR_User_Procedures/USANS/COR_Graph.ipf
r328 r404 23 23 // 24 24 Function DoCORGraph() 25 26 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 25 27 26 28 DoWindow/F COR_Graph … … 32 34 SetVariable gTransWide,pos={210,12},size={135,15},title="Trans  Wide",format="%5.4f" 33 35 SetVariable gTransWide,help={"Average counts on transmssion detector at wide angles"} 34 SetVariable gTransWide,limits={0,1,0.001},value= root:Globals:MainPanel:gTransWide36 SetVariable gTransWide,limits={0,1,0.001},value= $(USANSFolder+":Globals:MainPanel:gTransWide") 35 37 SetVariable gTransRock,pos={210,27},size={135,15},title="Trans  Rock",format="%5.4f" 36 38 SetVariable gTransRock,help={"Transmission counts at the zeroangle peak"} 37 SetVariable gTransRock,limits={0,1,0.001},value= root:Globals:MainPanel:gTransRock39 SetVariable gTransRock,limits={0,1,0.001},value= $(USANSFolder+":Globals:MainPanel:gTransRock") 38 40 SetVariable gEmpCts,pos={210,42},size={135,15},title="EMP Level",format="%7.4f" 39 SetVariable gEmpCts,limits={Inf,Inf,0.1},value= root:Globals:MainPanel:gEmpCts41 SetVariable gEmpCts,limits={Inf,Inf,0.1},value= $(USANSFolder+":Globals:MainPanel:gEmpCts") 40 42 SetVariable gEmpCts,help={"High q limit of empty cell scattering normalized to 1.0e6 monitor counts"} 41 43 SetVariable gBkgCts,pos={210,57},size={135,15},title="BKG Level",format="%7.4f" 42 SetVariable gBkgCts,limits={Inf,Inf,0.1},value= root:Globals:MainPanel:gBkgCts44 SetVariable gBkgCts,limits={Inf,Inf,0.1},value= $(USANSFolder+":Globals:MainPanel:gBkgCts") 43 45 SetVariable gBkgCts,help={"Background scattering level normalized to 1.0e6 monitor counts"} 44 46 SetVariable gThick,pos={210,72},size={135,15},title="SAM Thick(cm)",format="%5.4f" 45 47 SetVariable gThick,help={"Thickness of the sample in centimeters"} 46 SetVariable gThick,limits={0,5,0.01},value= root:Globals:MainPanel:gThick48 SetVariable gThick,limits={0,5,0.01},value= $(USANSFolder+":Globals:MainPanel:gThick") 47 49 Button UpdateButton,pos={115,19},size={88,20},proc=UpdateButtonProc,title="Update Trans" 48 50 Button UpdateButton,help={"Updates both the wide and rocking transmission values based on the raw data files"} … … 94 96 // 95 97 Function GraphSAM() 98 99 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 100 96 101 //is it already on the graph? 97 SetDataFolder root:Graph102 SetDataFolder $(USANSFolder+":Graph") 98 103 String list="" 99 104 list = Wavelist("DetCts_SAM*",";","WIN:COR_Graph") 100 SetDataFolder root:101 105 if(strlen(list)!=0) 102 106 //Print "SAM already on graph" … … 104 108 Endif 105 109 //append the data if it exists 106 If(waveExists($" root:Graph:DetCts_SAM")==1)110 If(waveExists($"DetCts_SAM")==1) 107 111 DoWindow/F COR_Graph 108 AppendToGraph :Graph:DetCts_SAM vs :Graph:Qvals_SAM112 AppendToGraph DetCts_SAM vs Qvals_SAM 109 113 ModifyGraph rgb(DetCts_SAM)=(1,12815,52428) 110 114 ModifyGraph mode(DetCts_SAM)=3,marker(DetCts_SAM)=19,msize(DetCts_SAM)=2 111 115 ModifyGraph tickUnit=1 112 ErrorBars DetCts_SAM Y,wave=( :Graph:ErrDetCts_SAM,:Graph:ErrDetCts_SAM)116 ErrorBars DetCts_SAM Y,wave=(ErrDetCts_SAM,ErrDetCts_SAM) 113 117 endif 118 SetDataFolder root: 114 119 End 115 120 … … 117 122 // 118 123 Function GraphEMP() 119 SetDataFolder root:Graph 124 125 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 126 127 SetDataFolder $(USANSFolder+":Graph") 120 128 String list="" 121 129 list = Wavelist("DetCts_EMP*",";","WIN:COR_Graph") 122 SetDataFolder root:123 130 if(strlen(list)!=0) 124 131 // Print "EMP already on graph" … … 126 133 Endif 127 134 //append the data if it exists 128 If(waveExists($" root:Graph:DetCts_EMP")==1)135 If(waveExists($"DetCts_EMP")==1) 129 136 DoWindow/F COR_Graph 130 AppendToGraph :Graph:DetCts_EMP vs :Graph:Qvals_EMP137 AppendToGraph DetCts_EMP vs Qvals_EMP 131 138 ModifyGraph msize(DetCts_EMP)=2,rgb(DetCts_EMP)=(1,39321,19939) 132 139 ModifyGraph mode(DetCts_EMP)=3,marker(DetCts_EMP)=19 133 140 ModifyGraph tickUnit=1 134 ErrorBars DetCts_EMP Y,wave=( :Graph:ErrDetCts_EMP,:Graph:ErrDetCts_EMP)141 ErrorBars DetCts_EMP Y,wave=(ErrDetCts_EMP,ErrDetCts_EMP) 135 142 endif 143 SetDataFolder root: 136 144 return(0) 137 145 End … … 140 148 // 141 149 Function GraphCOR() 142 SetDataFolder root:Graph 150 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 151 152 SetDataFolder $(USANSFolder+":Graph") 153 143 154 String list="" 144 155 list = Wavelist("DetCts_COR*",";","WIN:COR_Graph") 145 SetDataFolder root:146 156 if(strlen(list)!=0) 147 157 // Print "COR already on graph" … … 149 159 Endif 150 160 //append the data if it exists 151 If(waveExists($" root:Graph:DetCts_COR")==1)161 If(waveExists($"DetCts_COR")==1) 152 162 DoWindow/F COR_Graph 153 AppendToGraph :Graph:DetCts_COR vs :Graph:Qvals_COR163 AppendToGraph DetCts_COR vs Qvals_COR 154 164 ModifyGraph msize(DetCts_COR)=2,rgb(DetCts_COR)=(52428,34958,1) 155 165 ModifyGraph mode(DetCts_COR)=3,marker(DetCts_COR)=19 156 166 ModifyGraph tickUnit=1 157 ErrorBars DetCts_COR Y,wave=( :Graph:ErrDetCts_COR,:Graph:ErrDetCts_COR)167 ErrorBars DetCts_COR Y,wave=(ErrDetCts_COR,ErrDetCts_COR) 158 168 endif 169 170 SetDataFolder root: 159 171 return(0) 160 172 End … … 162 174 // add horizoontal lines for the background and empty cell levels 163 175 Function GraphEMPBKGLevels() 176 177 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 178 164 179 //if the data is on the graph, remove them and replot, to properly reset the scale 165 180 DoUpdate … … 172 187 Endif 173 188 DoUpdate 174 AppendToGraph :EMP:EMPLevel,:BKG:BKGLevel189 AppendToGraph $(USANSFolder+":EMP:EMPLevel"),$(USANSFolder+":BKG:BKGLevel") 175 190 ModifyGraph rgb(empLevel)=(0,0,0),lsize(bkgLevel)=2,rgb(bkgLevel)=(52428,1,1) 176 191 ModifyGraph lsize(empLevel)=2,offset={0,0} 177 192 ModifyGraph tickUnit=1 178 193 GetAxis/W=COR_Graph/Q bottom 179 SetScale/I x V_min,V_max,"", :EMP:EMPLevel,:BKG:BKGLevel194 SetScale/I x V_min,V_max,"",$(USANSFolder+":EMP:EMPLevel"),$(USANSFolder+":BKG:BKGLevel") 180 195 return(0) 181 196 End … … 188 203 Function SaveButtonProc(ctrlName) : ButtonControl 189 204 String ctrlName 205 206 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 190 207 191 208 PathInfo/S savePathName … … 199 216 200 217 //check for data save type (controlled by radio buttons) 201 NVAR gRadioVal= root:Globals:MainPanel:gTypeCheck//1=COR,2=SAM,3=EMP218 NVAR gRadioVal=$(USANSFolder+":Globals:MainPanel:gTypeCheck") //1=COR,2=SAM,3=EMP 202 219 switch(gRadioVal) 203 220 case 1: //COR … … 220 237 //if so, read off the point range (cursors should be on the same wave as the save type) 221 238 if(useCrsrs) 222 Wave xwave=$( "root:Graph:Qvals_"+type)239 Wave xwave=$(USANSFolder+":Graph:Qvals_"+type) 223 240 ptA=x2pnt(xwave,xcsr(A)) 224 241 ptB=x2pnt(xwave,xcsr(B)) … … 244 261 Variable checked 245 262 246 NVAR gRadioVal=root:Globals:MainPanel:gTypeCheck //1=COR,2=SAM,3=EMP 263 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 264 265 NVAR gRadioVal=$(USANSFolder+":Globals:MainPanel:gTypeCheck") //1=COR,2=SAM,3=EMP 247 266 String type="" 248 267 switch(gRadioVal) … … 267 286 Variable ok=WhichListItem(yname, str,";",0) 268 287 if(ok != 1) 269 Wave ywave=$( "root:Graph:DetCts_"+type)288 Wave ywave=$(USANSFolder+":Graph:DetCts_"+type) 270 289 Showinfo/W=COR_Graph 271 290 Cursor/A=1/P/S=1 A,$yname,0 … … 293 312 String ctrlName 294 313 Variable checked 295 296 NVAR gRadioVal=root:Globals:MainPanel:gTypeCheck 314 315 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 316 317 NVAR gRadioVal=$(USANSFolder+":Globals:MainPanel:gTypeCheck") 297 318 298 319 strswitch(ctrlName) … … 323 344 Function UpdateButtonProc(ctrlName) : ButtonControl 324 345 String ctrlName 325 326 Wave samCts=$"root:SAM:DetCts" 327 Wave empCts=$"root:EMP:DetCts" 346 347 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 348 349 Wave samCts=$(USANSFolder+":SAM:DetCts") 350 Wave empCts=$(USANSFolder+":EMP:DetCts") 328 351 if((WaveExists(samCts)==0)  (WaveExists(empCts)==0)) 329 Variable/G root:Globals:MainPanel:gTransWide=NaN //error330 Variable/G root:Globals:MainPanel:gTransRock=NaN352 Variable/G $(USANSFolder+":Globals:MainPanel:gTransWide")=NaN //error 353 Variable/G $(USANSFolder+":Globals:MainPanel:gTransRock")=NaN 331 354 return(1) 332 355 Endif … … 338 361 samRock = NumberByKey("PEAKVAL",samNote,":",";") 339 362 empRock = NumberByKey("PEAKVAL",empNote,":",";") 340 Variable/G root:Globals:MainPanel:gTransWide=samWide/empWide341 Variable/G root:Globals:MainPanel:gTransRock=samRock/empRock363 Variable/G $(USANSFolder+":Globals:MainPanel:gTransWide")=samWide/empWide 364 Variable/G $(USANSFolder+":Globals:MainPanel:gTransRock")=samRock/empRock 342 365 343 366 return(0) … … 385 408 Function QpkFromNote(type) 386 409 String type 387 388 Wave/Z detCts=$("root:Graph:DetCts_"+type) 410 411 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 412 413 Wave/Z detCts=$(USANSFolder+":Graph:DetCts_"+type) 389 414 if(!WaveExists(detCts)) 390 415 return(NaN) … … 406 431 String type 407 432 Variable zeroAngle 433 434 SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 408 435 409 436 //SETS the wave note with the PEAKANG value … … 418 445 //use the listBox wave directly 419 446 420 Wave/T listW=$( "root:Globals:MainPanel:"+type+"Wave")447 Wave/T listW=$(USANSFolder+":Globals:MainPanel:"+type+"Wave") 421 448 Variable ii,num=numpnts(listW) 422 449 String fname="",fpath="" … … 447 474 448 475 //find the peak value at the supplied angle, rather than automatic... 449 Wave tmpangle = $( "root:"+type+":Angle")450 Wave tmpdetCts = $( "root:"+type+":DetCts")476 Wave tmpangle = $(USANSFolder+":"+type+":Angle") 477 Wave tmpdetCts = $(USANSFolder+":"+type+":DetCts") 451 478 Variable pkHt=0 452 479 pkHt = interp(zeroAngle,tmpangle,tmpdetcts) … … 463 490 // 464 491 //copy the data to plot to the root:Graph directory, and give clear names 465 if(WaveExists($( "root:"+type+":Qvals")))466 Duplicate/O $( "root:"+type+":Qvals"),$("root:Graph:Qvals_"+type)467 Endif 468 Duplicate/O $( "root:"+type+":Angle"),$("root:Graph:Angle_"+type)469 Duplicate/O $( "root:"+type+":DetCts"),$("root:Graph:DetCts_"+type)470 Duplicate/O $( "root:"+type+":ErrDetCts"),$("root:Graph:ErrDetCts_"+type)492 if(WaveExists($(USANSFolder+":"+type+":Qvals"))) 493 Duplicate/O $(USANSFolder+":"+type+":Qvals"),$(USANSFolder+":Graph:Qvals_"+type) 494 Endif 495 Duplicate/O $(USANSFolder+":"+type+":Angle"),$(USANSFolder+":Graph:Angle_"+type) 496 Duplicate/O $(USANSFolder+":"+type+":DetCts"),$(USANSFolder+":Graph:DetCts_"+type) 497 Duplicate/O $(USANSFolder+":"+type+":ErrDetCts"),$(USANSFolder+":Graph:ErrDetCts_"+type) 471 498 472 499 //now plot the data (or just bring the graph to the front)
Note: See TracChangeset
for help on using the changeset viewer.