Changeset 134 for sans/Analysis/branches/ajj_23APR07
- Timestamp:
- Jul 26, 2007 2:56:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Packages/Invariant/Invariant.ipf
r50 r134 7 7 // need to: 8 8 // - verify accuracy (see John) 9 // - help file10 9 11 10 // this is the main entry point for the panel … … 13 12 DoWindow/F Invariant_Panel 14 13 if(V_flag==0) 15 //create global variables in root: invariant14 //create global variables in root:myGlobals:invariant 16 15 Init_Invariant() 17 16 Invariant_Panel() … … 23 22 //create the globals 24 23 Proc Init_Invariant() 25 NewDataFolder/O/S root: invariant24 NewDataFolder/O/S root:myGlobals:invariant 26 25 Variable/G gNumLow=10 27 26 Variable/G gNumHigh=10 … … 34 33 Variable/G gIsSlitSmeared=0 35 34 Variable/G gDqv = 0.117 //default value for USANS slit height (re-read from file) 36 37 NewDataFolder/O root:myGlobals //just in case... 38 35 39 36 SetDataFolder root: 40 37 End … … 74 71 75 72 Variable num,invar 76 NVAR dQv = root: invariant:gDqv73 NVAR dQv = root:myGlobals:invariant:gDqv 77 74 78 75 Duplicate/O qw integrand … … 158 155 159 156 //access the global strings representing the last data file read in 160 SVAR QWave = root: invariant:QWave161 SVAR IWave = root: invariant:IWave162 SVAR SWave = root: invariant:SWave157 SVAR QWave = root:myGlobals:invariant:QWave 158 SVAR IWave = root:myGlobals:invariant:IWave 159 SVAR SWave = root:myGlobals:invariant:SWave 163 160 164 161 Wave qw=$QWave … … 211 208 212 209 //reset the invariant values to zero 213 NVAR meas = root: invariant:gInvMeas214 NVAR lo = root: invariant:gInvLowQ215 NVAR hi = root: invariant:gInvHighQ216 NVAR total = root: invariant:gInvTotal210 NVAR meas = root:myGlobals:invariant:gInvMeas 211 NVAR lo = root:myGlobals:invariant:gInvLowQ 212 NVAR hi = root:myGlobals:invariant:gInvHighQ 213 NVAR total = root:myGlobals:invariant:gInvTotal 217 214 meas=0 218 215 lo=0 … … 259 256 PopupMenu ywave,pos={10,60},size={154,19},title="Data File" 260 257 PopupMenu ywave,help={"Select the experimental intensity values"} 261 PopupMenu ywave,mode=1,value=root: invariant:gDataPopList,proc=Inv_FilePopMenuProc258 PopupMenu ywave,mode=1,value=root:myGlobals:invariant:gDataPopList,proc=Inv_FilePopMenuProc 262 259 263 260 Button loadButton,pos={10,90},size={130,20},proc=Inv_Load_Proc,title="Load and Plot File" … … 268 265 Button DoneButton,help={"This button will close the panel and the associated graph"} 269 266 270 // PopupMenu wavePop_0,pos={15,9},size={139,20},title="q-values"271 // PopupMenu wavePop_0,mode=1,value= #"WaveList(\"*_q\",\";\",\"\")"272 // PopupMenu wavePop_1,pos={15,38},size={140,20},title="Intensity"273 // PopupMenu wavePop_1,mode=1,value= #"WaveList(\"*_i\",\";\",\"\")"274 // PopupMenu wavePop_2,pos={15,65},size={124,20},title="error"275 // PopupMenu wavePop_2,mode=1,value= #"WaveList(\"*_s\",\";\",\"\")"276 267 SetVariable setvar_0,pos={27,249},size={80,15},title="# points" 277 SetVariable setvar_0,limits={5,50,0},value= root: invariant:gNumLow268 SetVariable setvar_0,limits={5,50,0},value= root:myGlobals:invariant:gNumLow 278 269 SetVariable setvar_1,pos={166,249},size={80,15},title="# points" 279 SetVariable setvar_1,limits={5,200,0},value= root: invariant:gNumHigh270 SetVariable setvar_1,limits={5,200,0},value= root:myGlobals:invariant:gNumHigh 280 271 CheckBox check_0,pos={23,202},size={50,14},proc=LowCheckProc,title="Guinier" 281 272 CheckBox check_0,value= 1 … … 292 283 ValDisplay valdisp0,pos={51,354},size={180,14},title="In measured Q-range " 293 284 ValDisplay valdisp0,limits={0,0,0},barmisc={0,1000} 294 ValDisplay valdisp0,value= #"root: invariant:gInvMeas"285 ValDisplay valdisp0,value= #"root:myGlobals:invariant:gInvMeas" 295 286 ValDisplay valdisp0_1,pos={51,371},size={180,14},title="In low Q extrapolation " 296 287 ValDisplay valdisp0_1,limits={0,0,0},barmisc={0,1000} 297 ValDisplay valdisp0_1,value= #"root: invariant:gInvLowQ"288 ValDisplay valdisp0_1,value= #"root:myGlobals:invariant:gInvLowQ" 298 289 ValDisplay valdisp0_2,pos={51,388},size={180,14},title="In high Q extrapolation " 299 290 ValDisplay valdisp0_2,limits={0,0,0},barmisc={0,1000} 300 ValDisplay valdisp0_2,value= #"root: invariant:gInvHighQ"291 ValDisplay valdisp0_2,value= #"root:myGlobals:invariant:gInvHighQ" 301 292 ValDisplay valdisp0_3,pos={51,411},size={180,14},title="TOTAL " 302 293 ValDisplay valdisp0_3,limits={0,0,0},barmisc={0,1000} 303 ValDisplay valdisp0_3,value= #"root: invariant:gInvTotal"294 ValDisplay valdisp0_3,value= #"root:myGlobals:invariant:gInvTotal" 304 295 305 296 CheckBox check0,pos={10,116},size={101,14},proc=SlitSmearedCheckProc,title="Slit-Smeared Data" 306 CheckBox check0,value= root: invariant:gIsSlitSmeared297 CheckBox check0,value= root:myGlobals:invariant:gIsSlitSmeared 307 298 SetVariable setvar0,pos={136,116},size={130,15},title="Slit Height (1/A)" 308 SetVariable setvar0,limits={-inf,inf,0},value= root: invariant:gDqv299 SetVariable setvar0,limits={-inf,inf,0},value= root:myGlobals:invariant:gDqv 309 300 310 301 //set up a dependency to calculate the total invariant 311 root: invariant:gInvTotal := root:invariant:gInvLowQ + root:invariant:gInvMeas + root:invariant:gInvHighQ302 root:myGlobals:invariant:gInvTotal := root:myGlobals:invariant:gInvLowQ + root:myGlobals:invariant:gInvMeas + root:myGlobals:invariant:gInvHighQ 312 303 EndMacro 313 304 … … 325 316 Variable inv,num 326 317 327 SVAR QWave = root: invariant:QWave318 SVAR QWave = root:myGlobals:invariant:QWave 328 319 Wave qw=$QWave 329 SVAR IWave = root: invariant:IWave320 SVAR IWave = root:myGlobals:invariant:IWave 330 321 Wave iw=$IWave 331 322 332 NVAR isSlitSmeared=root: invariant:gIsSlitSmeared323 NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 333 324 if(isSlitSmeared) 334 325 inv = Invariant_SlitSmeared(qw,iw) … … 341 332 342 333 // update the global display on the panel (there is a dependency for the total) 343 NVAR val = root: invariant:gInvMeas334 NVAR val = root:myGlobals:invariant:gInvMeas 344 335 val = inv 345 336 … … 362 353 // print "yesGuinier = ",yesGuinier 363 354 //number of points to use for fit 364 NVAR nbeg=root: invariant:gNumLow355 NVAR nbeg=root:myGlobals:invariant:gNumLow 365 356 //define the waves 366 357 Wave extr_lqi=extr_lqi 367 358 Wave extr_lqq=extr_lqq 368 359 369 SVAR QWave = root: invariant:QWave360 SVAR QWave = root:myGlobals:invariant:QWave 370 361 Wave qw=$QWave 371 SVAR IWave = root: invariant:IWave362 SVAR IWave = root:myGlobals:invariant:IWave 372 363 Wave iw=$IWave 373 SVAR SWave = root: invariant:SWave364 SVAR SWave = root:myGlobals:invariant:SWave 374 365 Wave sw=$SWave 375 366 … … 398 389 399 390 //calculate the invariant 400 NVAR isSlitSmeared=root: invariant:gIsSlitSmeared391 NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 401 392 if(isSlitSmeared) 402 393 inv = Invariant_SlitSmeared(extr_lqq,extr_lqi) … … 409 400 410 401 // update the global display on the panel (there is a dependency for the total) 411 NVAR val = root: invariant:gInvLowQ402 NVAR val = root:myGlobals:invariant:gInvLowQ 412 403 val = inv 413 404 … … 428 419 Wave extr_hqi=extr_hqi 429 420 Wave extr_hqq=extr_hqq 430 SVAR QWave = root: invariant:QWave421 SVAR QWave = root:myGlobals:invariant:QWave 431 422 Wave qw=$QWave 432 SVAR IWave = root: invariant:IWave423 SVAR IWave = root:myGlobals:invariant:IWave 433 424 Wave iw=$IWave 434 SVAR SWave = root: invariant:SWave425 SVAR SWave = root:myGlobals:invariant:SWave 435 426 Wave sw=$SWave 436 427 437 428 Variable/G V_FitMaxIters=300 438 429 Variable num=numpnts(iw),nume,inv 439 NVAR nend=root: invariant:gNumHigh //number of points for the fit430 NVAR nend=root:myGlobals:invariant:gNumHigh //number of points for the fit 440 431 441 432 Make/O/D P_coef={0,1,-4} //input … … 448 439 449 440 //calculate the invariant 450 NVAR isSlitSmeared=root: invariant:gIsSlitSmeared441 NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 451 442 if(isSlitSmeared) 452 443 inv = Invariant_SlitSmeared(extr_hqq,extr_hqi) … … 459 450 460 451 // update the global display on the panel (there is a dependency for the total) 461 NVAR val = root: invariant:gInvHighQ452 NVAR val = root:myGlobals:invariant:gInvHighQ 462 453 val = inv 463 454 … … 472 463 DoWindow/K $"Invariant_Graph" 473 464 endif 474 if (DatafolderExists("root:invariant")) 475 KillDatafolder root:invariant 476 endif 465 if (DatafolderExists("root:myGlobals:invariant")) 466 KillDatafolder root:myGlobals:invariant 467 endif 468 SetDataFolder root: 469 Killwaves/Z integrand,G_coef,P_coef,extr_hqq,extr_hqi,extr_lqq,extr_lqi 477 470 Execute/P "DELETEINCLUDE \"Invariant\"" 478 471 Execute/P "COMPILEPROCEDURES " … … 510 503 tempStr = "Pick the data path" 511 504 Endif 512 String/G root: invariant:gDataPopList =tempStr505 String/G root:myGlobals:invariant:gDataPopList =tempStr 513 506 ControlUpdate/W=Invariant_Panel ywave 514 507 … … 581 574 582 575 //load in the data (into the root directory) 583 A_LoadOneDDataWithName(tempName )576 A_LoadOneDDataWithName(tempName,0) 584 577 //Print S_fileName 585 578 //Print tempName 586 579 587 String cleanLastFileName = "root:"+CleanupName(root:myGlobals:gLastFileName,0) 580 String cleanLastFileName = CleanupName(root:myGlobals:gLastFileName,0) 581 String dataStr = "root:"+cleanLastFileName+":" 588 582 589 583 // keep global copies of the names rather than reading from the popup 590 tempName= cleanLastFileName+"_q"591 String/G root: invariant:QWave=tempName592 tempName= cleanLastFileName+"_i"593 String/G root: invariant:IWave=tempName594 tempName= cleanLastFileName+"_s"595 String/G root: invariant:SWave=tempName584 tempName=dataStr + cleanLastFileName+"_q" 585 String/G root:myGlobals:invariant:QWave=tempName 586 tempName=dataStr + cleanLastFileName+"_i" 587 String/G root:myGlobals:invariant:IWave=tempName 588 tempName=dataStr + cleanLastFileName+"_s" 589 String/G root:myGlobals:invariant:SWave=tempName 596 590 597 591 //Plot, and adjust the scaling to match the axis scaling set by the popups … … 618 612 Variable checked 619 613 620 NVAR isSlitSmeared=root: invariant:gIsSlitSmeared614 NVAR isSlitSmeared=root:myGlobals:invariant:gIsSlitSmeared 621 615 SVAR fileStr=root:myGlobals:gLastFileName 622 616 … … 626 620 if(checked) //get the smearing info 627 621 String cleanLastFileName = "root:"+CleanupName(fileStr,0) 628 NVAR dQv=root: invariant:gDqv622 NVAR dQv=root:myGlobals:invariant:gDqv 629 623 String tempName = cleanLastFileName+"sq" 630 624 Wave/Z w=$tempName
Note: See TracChangeset
for help on using the changeset viewer.