Changeset 391
- Timestamp:
- Dec 4, 2009 5:05:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/liveplot
- Property rcs:date changed from 2000/12/22 19:44:07 to 2001/05/11 18:32:34
- Property rcs:lines changed from +30 -12 to +58 -24
- Property rcs:rev changed from 1.14 to 1.15
r362 r391 38 38 set xunits {} 39 39 set yunits {} 40 set graph(chi2) 0 40 41 set graph(xunits) 0 41 42 set graph(yunits) 0 … … 157 158 set expgui(gsasdir) [file dirname $expgui(scriptdir)] 158 159 set expgui(gsasexe) [file join $expgui(gsasdir) exe] 160 set expgui(docdir) [file join $expgui(scriptdir) doc] 159 161 160 162 # called by a trace on expgui(lblfontsize) … … 198 200 update 199 201 } 202 $box element show [lsort -decreasing [$box element show]] 200 203 } 201 204 … … 315 318 set CALC {} 316 319 set BKG {} 320 set WGT {} 317 321 global refhkllist refphaselist refpos 318 322 set refpos {} … … 340 344 refposvec set $refpos 341 345 diffvec set [obsvec - calcvec] 346 if {$graph(chi2)} { 347 wifdvec set $WGT 348 wifdvec set [wifdvec * diffvec] 349 wifdvec set [wifdvec * diffvec] 350 # now do a running sum 351 set sum 0 352 set sumlist {} 353 foreach n [wifdvec range 0 end] { 354 set sum [expr $sum + $n] 355 lappend sumlist $sum 356 } 357 wifdvec set $sumlist 358 wifdvec set [wifdvec / [wifdvec length]] 359 } 342 360 if $graph(backsub) { 343 361 obsvec set [obsvec - bckvec] … … 457 475 bckvec notify now 458 476 diffvec notify now 477 wifdvec notify now 459 478 $box config -title "$expnam cycle $cycle Hist $hst" 460 479 $box xaxis config -title $xunits … … 462 481 setlegend $box $graph(legend) 463 482 # reconfigure the obs data 464 $box element configure obs\483 $box element configure 3 \ 465 484 -symbol $peakinfo(obssym) \ 466 485 -pixels [expr 0.125 * $peakinfo(obssize)]i … … 492 511 } 493 512 } 494 # $box element config phase$i -mapped 1495 513 catch {$box element create phase$i} 496 514 catch { … … 717 735 set fp [open [file join ~ .gsas_config] a] 718 736 puts $fp "set graph(legend) $graph(legend)" 737 puts $fp "set graph(chi2) $graph(chi2)" 719 738 puts $fp "set graph(printout) $graph(printout)" 720 739 puts $fp "set graph(outname) $graph(outname)" … … 811 830 donewaitmsg 812 831 } 832 proc ShowCumulativeChi2 {} { 833 global graph box 834 if $graph(chi2) { 835 eval $box y2axis config $graph(ElementShowOption) 836 eval $box element config 0 $graph(ElementShowOption) -label "Chi2" 837 set cycle [getcycle] 838 readdata .g 839 } else { 840 eval $box element config 0 $graph(ElementHideOption) 841 eval $box y2axis config $graph(ElementHideOption) 842 $box element config 0 -label "" 843 } 844 } 845 846 source [file join $expgui(scriptdir) gsascmds.tcl] 813 847 814 848 # override options with locally defined values … … 829 863 830 864 # vectors 831 vector xvec 832 xvec notify never 833 vector obsvec 834 obsvec notify never 835 vector calcvec 836 calcvec notify never 837 vector bckvec 838 bckvec notify never 839 vector diffvec 840 diffvec notify never 841 vector refposvec 842 refposvec notify never 865 foreach vec {xvec obsvec calcvec bckvec diffvec refposvec wifdvec} { 866 vector $vec 867 $vec notify never 868 } 843 869 # create the graph 844 870 if [catch { … … 861 887 error 0 "Limp ahead" 862 888 } 863 $box element create obs -color black -linewidth 0 \ 889 $box element create 0 -xdata xvec -ydata wifdvec -color magenta \ 890 -line 3 -symbol none -label "Chi2" -mapy y2 891 $box element create 3 -color black -linewidth 0 -label Obs \ 864 892 -symbol $peakinfo(obssym) \ 865 893 -pixels [expr 0.125 * $peakinfo(obssize)]i 866 $box element create calc -color red -symbol none867 $box element create diff -color blue -symbol none868 $box element config obs-xdata xvec -ydata obsvec869 $box element config calc-xdata xvec -ydata calcvec870 $box element config diff-xdata xvec -ydata diffvec894 $box element create 2 -label Calc -color red -symbol none 895 $box element create 4 -label diff -color blue -symbol none 896 $box element config 3 -xdata xvec -ydata obsvec 897 $box element config 2 -xdata xvec -ydata calcvec 898 $box element config 4 -xdata xvec -ydata diffvec 871 899 if {$expgui(tcldump) != ""} { 872 $box element create bckg-color green -symbol none873 $box element config bckg-xdata xvec -ydata bckvec900 $box element create 1 -label bckgr -color green -symbol none 901 $box element config 1 -xdata xvec -ydata bckvec 874 902 bind . <Shift-Button-1> "lblhkl $box %x" 875 903 bind . <Key-h> "lblhkl $box %x" … … 880 908 $box yaxis config -title {} 881 909 setlegend $box $graph(legend) 910 ShowCumulativeChi2 882 911 883 912 updateifnew … … 956 985 .a.options.menu add checkbutton -label "Raise on update" \ 957 986 -variable graph(autoraise) 987 .a.options.menu add checkbutton -label "Cumulative Chi2" \ 988 -variable graph(chi2) -command ShowCumulativeChi2 958 989 .a.options.menu add command -label "Save Options" -underline 1 \ 959 990 -command "SaveOptions" 991 $box y2axis config -min 0 -title {Cumulative Chi Squared} 992 ShowCumulativeChi2 960 993 961 994 pack [menubutton .a.help -text Help -underline 0 -menu .a.help.menu] -side right 962 995 menu .a.help.menu -tearoff 0 996 .a.help.menu add command -command "MakeWWWHelp liveplot.html" -label "Web page" 963 997 .a.help.menu add command -command aboutliveplot -label About 964 998
Note: See TracChangeset
for help on using the changeset viewer.