Changeset 426 for trunk/liveplot
- Timestamp:
- Dec 4, 2009 5:05:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/liveplot
- Property rcs:date changed from 2001/09/04 22:09:40 to 2001/09/04 22:53:53
- Property rcs:lines changed from +4 -0 to +107 -52
- Property rcs:rev changed from 1.17 to 1.18
r420 r426 45 45 set graph(yunits) 0 46 46 set graph(autoraise) 1 47 set graph(color_diff) blue 48 set graph(color_chi2) magenta 49 set graph(color_bkg) green 50 set graph(color_calc) red 51 set graph(color_obs) black 52 set graph(color_input) magenta 53 set graph(color_fit) blue 47 54 set expgui(debug) 0 48 55 catch {if $env(DEBUG) {set expgui(debug) 1}} 49 56 #set expgui(debug) 1 57 set expgui(font) 14 50 58 set expgui(lblfontsize) 15 51 59 set expgui(fadetime) 10 … … 57 65 set peakinfo(obssym) scross 58 66 set peakinfo(obssize) 1.0 67 set peakinfo(inpsym) triangle 68 set peakinfo(inpsize) 1.0 59 69 # create a set of markers for each phase 60 70 for {set i 1} {$i < 10} {incr i} { … … 299 309 diffvec set [diffvec + $ymin2] 300 310 } 301 plotdata $box311 plotdata 302 312 } 303 313 … … 385 395 } 386 396 387 plotdata $box397 plotdata 388 398 } 389 399 … … 463 473 } 464 474 465 proc plotdata { box} {475 proc plotdata {} { 466 476 global expnam hst peakinfo xunits yunits cycle reflns modtime 467 global lasthst graph expgui 477 global lasthst graph expgui box 468 478 469 479 # is there a new histogram to load? … … 477 487 return 478 488 } 489 $box config -title "$expnam cycle $cycle Hist $hst" 490 $box xaxis config -title $xunits 491 $box yaxis config -title $yunits 492 setlegend $box $graph(legend) 493 # reconfigure the data 494 $box element configure 3 \ 495 -symbol $peakinfo(obssym) -color $graph(color_obs) \ 496 -pixels [expr 0.125 * $peakinfo(obssize)]i 497 $box element config 0 -color $graph(color_chi2) 498 $box element config 1 -color $graph(color_bkg) 499 $box element config 2 -color $graph(color_calc) 500 $box element config 4 -color $graph(color_diff) 501 global program 502 if {$program == "bkgedit"} { 503 $box element config 12 -color $graph(color_input) \ 504 -pixels [expr 0.125 * $peakinfo(inpsize)]i \ 505 -symbol $peakinfo(inpsym) 506 $box element config 11 -color $graph(color_fit) 507 } 479 508 xvec notify now 480 509 obsvec notify now … … 483 512 diffvec notify now 484 513 wifdvec notify now 485 $box config -title "$expnam cycle $cycle Hist $hst"486 $box xaxis config -title $xunits487 $box yaxis config -title $yunits488 setlegend $box $graph(legend)489 # reconfigure the obs data490 $box element configure 3 \491 -symbol $peakinfo(obssym) \492 -pixels [expr 0.125 * $peakinfo(obssize)]i493 514 # now deal with peaks 494 515 for {set i 1} {$i < 10} {incr i} { … … 586 607 -command "setcolor $i"] -side left 587 608 pack [frame $bx.b] -side top 588 #pack [button $bx.b.1 -command {plotdata $box}-text "Update Plot"] \609 #pack [button $bx.b.1 -command plotdata -text "Update Plot"] \ 589 610 # -side left 590 611 pack [button $bx.b.4 -command "destroy $bx" -text Close ] -side right … … 707 728 } 708 729 709 proc setsymopts {} {730 proc getsymopts {"sym obs"} { 710 731 global expgui peakinfo 711 732 set box .out … … 713 734 toplevel $box 714 735 focus $box 736 wm title .out "set $sym symbol" 715 737 pack [frame $box.d] -side left -anchor n 716 738 pack [label $box.d.t -text "Symbol type"] -side top 717 set expgui( obssym) $peakinfo(obssym)718 set expgui( obssize) $peakinfo(obssize)719 foreach symbol {square circle diamond plus cross \739 set expgui(sym) $peakinfo(${sym}sym) 740 set expgui(size) $peakinfo(${sym}size) 741 foreach symbol {square circle diamond triangle plus cross \ 720 742 splus scross} \ 721 symbol_name {square circle diamond plus cross \743 symbol_name {square circle diamond triangle plus cross \ 722 744 thin-plus thin-cross} { 723 745 pack [radiobutton $box.d.$symbol \ 724 -text $symbol_name -variable expgui( obssym) \746 -text $symbol_name -variable expgui(sym) \ 725 747 -value $symbol] -side top -anchor w 726 748 } 727 749 pack [frame $box.e] -side left -anchor n -fill y 728 750 pack [label $box.e.l -text "Symbol Size"] -side top 729 pack [scale $box.e.s -variable expgui( obssize) \751 pack [scale $box.e.s -variable expgui(size) \ 730 752 -from .1 -to 3 -resolution 0.05] -side top 731 753 pack [frame $box.a] -side bottom 732 pack [button $box.a.1 -text "Apply" -command { \ 733 if {$peakinfo(obssym) != $expgui(obssym)} {set peakinfo(obssym) $expgui(obssym)}; \ 734 if {$peakinfo(obssize) != $expgui(obssize)} {set peakinfo(obssize) $expgui(obssize)} \ 735 } ] -side left 754 pack [button $box.a.1 -text "Apply" -command "setsymopts $sym"] -side left 736 755 pack [button $box.a.2 -text "Close" -command "destroy $box"] -side left 756 } 757 proc setsymopts {sym} { 758 global peakinfo expgui 759 if {$peakinfo(${sym}sym) != $expgui(sym)} {set peakinfo(${sym}sym) $expgui(sym)} 760 if {$peakinfo(${sym}size) != $expgui(size)} {set peakinfo(${sym}size) $expgui(size)} 737 761 } 738 762 … … 741 765 global graph expgui peakinfo 742 766 set fp [open [file join ~ .gsas_config] a] 743 puts $fp "set graph(legend) $graph(legend)" 744 puts $fp "set graph(chi2) $graph(chi2)" 745 puts $fp "set graph(printout) $graph(printout)" 746 puts $fp "set graph(outname) $graph(outname)" 747 puts $fp "set graph(outcmd) $graph(outcmd)" 748 puts $fp "set graph(autoraise) $graph(autoraise)" 749 puts $fp "set expgui(lblfontsize) $expgui(lblfontsize)" 750 puts $fp "set expgui(fadetime) $expgui(fadetime)" 751 puts $fp "set expgui(hklbox) $expgui(hklbox)" 752 puts $fp "set peakinfo(obssym) $peakinfo(obssym)" 753 puts $fp "set peakinfo(obssize) $peakinfo(obssize)" 754 puts $fp "set expgui(pixelregion) $expgui(pixelregion)" 755 puts $fp "set expgui(autotick) $expgui(autotick)" 767 foreach v {printout legend outname outcmd autoraise chi2} { 768 puts $fp "set graph($v) $graph($v)" 769 } 770 foreach v {diff chi2 bkg calc obs input fit} { 771 puts $fp "set graph(color_$v) $graph(color_$v)" 772 } 773 foreach v {font lblfontsize fadetime hklbox pixelregion autotick} { 774 puts $fp "set expgui($v) $expgui($v)" 775 } 776 foreach v {obssym obssize inpsym inpsize} { 777 puts $fp "set peakinfo($v) $peakinfo($v)" 778 } 756 779 close $fp 757 780 } … … 834 857 } 835 858 waitmsg {Updating} 836 plotdata $box859 plotdata 837 860 donewaitmsg 838 861 } … … 1336 1359 source [file join $expgui(scriptdir) gsascmds.tcl] 1337 1360 source [file join $expgui(scriptdir) readexp.tcl] 1361 source [file join $expgui(scriptdir) opts.tcl] 1338 1362 1339 1363 # override options with locally defined values … … 1344 1368 source [file join ~ .gsas_config] 1345 1369 } 1370 SetTkDefaultOptions $expgui(font) 1346 1371 1347 1372 if [file executable [file join $expgui(gsasexe) $expgui(tcldump)]] { … … 1360 1385 # create the graph 1361 1386 if [catch { 1362 set box [graph .g ]1387 set box [graph .g -plotbackground white] 1363 1388 } errmsg] { 1364 1389 tk_dialog .err "BLT Error" \ … … 1384 1409 } 1385 1410 1386 $box element create 0 -xdata xvec -ydata wifdvec -color magenta\1411 $box element create 0 -xdata xvec -ydata wifdvec -color $graph(color_chi2) \ 1387 1412 -line 3 -symbol none -label "Chi2" -mapy y2 1388 $box element create 1 -label bckgr - color green -symbol none1389 $box element config 1 -xdata xvec -ydata bckvec 1390 $box element create 3 -color black-linewidth 0 -label Obs \1413 $box element create 1 -label bckgr -symbol none 1414 $box element config 1 -xdata xvec -ydata bckvec -color $graph(color_bkg) 1415 $box element create 3 -color $graph(color_obs) -linewidth 0 -label Obs \ 1391 1416 -symbol $peakinfo(obssym) \ 1392 1417 -pixels [expr 0.125 * $peakinfo(obssize)]i 1393 $box element create 2 -label Calc -color red-symbol none1394 $box element create 4 -label diff -color blue-symbol none1418 $box element create 2 -label Calc -color $graph(color_calc) -symbol none 1419 $box element create 4 -label diff -color $graph(color_diff) -symbol none 1395 1420 1396 1421 if {$program == "liveplot"} { … … 1406 1431 $box element create 11 1407 1432 $box element create 12 1408 $box element configure 12 -color magenta -pixels 12 \ 1409 -line 0 -symbol triangle -label "bkg pts" 1410 $box element configure 11 -color blue \ 1433 $box element configure 12 -color $graph(color_input) \ 1434 -pixels [expr 0.125 * $peakinfo(inpsize)]i \ 1435 -line 0 -symbol $peakinfo(inpsym) -label "bkg pts" 1436 $box element configure 11 -color $graph(color_fit) \ 1411 1437 -symbol none -label "Cheb fit" -dashes 5 -line 2 1412 1438 $box element show "3 2 11 12" … … 1442 1468 .a.file.menu.tick add checkbutton -label "Phase $num" \ 1443 1469 -variable peakinfo(flag$num) \ 1444 -command {plotdata $box}1470 -command plotdata 1445 1471 } 1446 1472 .a.file.menu add cascade -label "Histogram" -menu .a.file.menu.hist … … 1467 1493 menu .a.options.menu.tick 1468 1494 .a.options.menu.tick add radiobutton -label "Manual Placement" \ 1469 -value 0 -variable expgui(autotick) -command "plotdata $box"1495 -value 0 -variable expgui(autotick) -command plotdata 1470 1496 .a.options.menu.tick add radiobutton -label "Auto locate" \ 1471 -value 1 -variable expgui(autotick) -command "plotdata $box"1497 -value 1 -variable expgui(autotick) -command plotdata 1472 1498 .a.options.menu.tick add separator 1473 1499 foreach num {1 2 3 4 5 6 7 8 9} { … … 1475 1501 -command "minioptionsbox $num" 1476 1502 } 1477 .a.options.menu add command -label "Obs symbol" -command setsymopts 1503 if {$program == "liveplot"} { 1504 .a.options.menu add command -label "Obs symbol" -command getsymopts 1505 } else { 1506 .a.options.menu add cascade -label "Symbol Type" -menu .a.options.menu.sym 1507 menu .a.options.menu.sym 1508 foreach var {obs inp} lbl {Observed "Input bkg"} { 1509 .a.options.menu.sym add command -label $lbl -command "getsymopts $var" 1510 } 1511 } 1512 .a.options.menu add cascade -label "Symbol color" -menu .a.options.menu.color 1513 menu .a.options.menu.color 1514 set l1 {obs calc diff bkg chi2} 1515 set l2 {Observed Calculated Obs-Calc Background Cumulative-Chi2} 1516 if {$program != "liveplot"} { 1517 lappend l1 input fit 1518 lappend l2 "Input points" "Cheb. fit" 1519 } 1520 1521 foreach var $l1 lbl $l2 { 1522 .a.options.menu.color add command -label $lbl \ 1523 -command "set graph(color_$var) \[tk_chooseColor -initialcolor \$graph(color_$var) -title \"Choose \$lbl color\"]; plotdata" 1524 } 1478 1525 if {$expgui(tcldump) != "" && $program == "liveplot"} { 1479 1526 .a.options.menu add cascade -label "X units" -menu .a.options.menu.xunits … … 1508 1555 -command {setlegend $box $graph(legend)} 1509 1556 .a.options.menu add command -label "Set PS output" -command setpostscriptout 1557 .a.options.menu add cascade -menu .a.options.menu.font \ 1558 -label "Screen font" 1559 menu .a.options.menu.font 1560 foreach f {10 11 12 13 14 16 18 20 22} { 1561 .a.options.menu.font add radiobutton \ 1562 -command {SetTkDefaultOptions $expgui(font); ResizeFont .} \ 1563 -label $f -value $f -variable expgui(font) -font "Helvetica -$f" 1564 } 1510 1565 if {$program == "liveplot"} { 1511 1566 .a.options.menu add checkbutton -label "Raise on update" \
Note: See TracChangeset
for help on using the changeset viewer.