Changeset 400 for trunk/liveplot
- Timestamp:
- Dec 4, 2009 5:05:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/liveplot
- Property rcs:date changed from 2001/05/11 18:32:34 to 2001/06/29 18:10:45
- Property rcs:lines changed from +58 -24 to +602 -18
- Property rcs:rev changed from 1.15 to 1.16
r391 r400 12 12 destroy . 13 13 } 14 set program [file tail $argv0] 15 #set program bkgedit 16 14 17 if {[lindex $argv 1] == ""} { 15 18 set hst 1 … … 50 53 set expgui(autotick) 0 51 54 set expgui(pixelregion) 5 55 # location for web pages, if not found locally 56 set expgui(website) www.ncnr.nist.gov/xtal/software/expgui 52 57 set peakinfo(obssym) scross 53 58 set peakinfo(obssize) 1.0 … … 201 206 } 202 207 $box element show [lsort -decreasing [$box element show]] 208 global program 209 if {$program == "bkgedit"} bkghstInit 203 210 } 204 211 … … 217 224 # set input [open "| $expgui(gsasexe)/hstdump $expnam < histdump.inp" w+] 218 225 ########################################################################### 219 # use histd ump for right now226 # use histdmp for histogram info 220 227 set input [open histdump$hst.inp w] 221 228 puts $input "$expnam" … … 843 850 } 844 851 } 852 # evaluate the Chebyshev polynomial with coefficients A at point x 853 # coordinates are rescaled from $xmin=-1 to $xmax=1 854 proc chebeval {A x xmin xmax} { 855 set xs [expr {-1 + 2 * (1.*$x - $xmin) / (1.*$xmax - 1.*$xmin)}] 856 set Tpp 0 857 set Tp 0 858 set total 0 859 foreach a $A { 860 if {$Tpp == $Tp && $Tp == 0} { 861 set T 1 862 } elseif {$Tpp == 0} { 863 set T $xs 864 } else { 865 set T [expr {2. * $xs * $Tp - $Tpp}] 866 } 867 set total [expr {$total + $a * $T}] 868 set Tpp $Tp 869 set Tp $T 870 } 871 return $total 872 } 873 874 # determine a very approximate set of Chebyshev coefficients of order n 875 # to compute Y from X (fast but not very good) 876 proc chebgen {X Y xmin xmax n} { 877 if {[llength $X] != [llength $Y]} return 878 set xnorm [expr {2. / ($xmax - $xmin)}] 879 set pi [expr {2*asin(1)}] 880 set a(0) 0. 881 for {set i 1} {$i < $n} {incr i} {set a($i) 0.} 882 foreach x1 $X x2 [lrange $X 1 end] y1 $Y y2 [lrange $Y 1 end] { 883 if {$x2 == ""} break 884 set xs1 [expr {-1 + ($x1 - $xmin) * $xnorm}] 885 set th1 [expr {acos(-1 + ($x1 - $xmin) * $xnorm)}] 886 set xs2 [expr {-1 + ($x2 - $xmin) * $xnorm}] 887 set th2 [expr {acos(-1 + ($x2 - $xmin) * $xnorm)}] 888 set thbar [expr {($th1 + $th2)/2.}] 889 set dth [expr {$th1 - $th2}] 890 set xsbar [expr {cos($thbar)}] 891 set ybar [expr {($xsbar - $xs1) / ($xs2 - $xs1) * ($y2 - $y1) + $y1}] 892 # seems to work better starting with just 2 terms 893 # for {set i 0} {$i < $n} {incr i} 894 for {set i 0} {$i < 2} {incr i} { 895 set a($i) [expr {$a($i) + $ybar * cos($i*$thbar) * $dth}] 896 } 897 } 898 set A [expr {$a(0) / $pi}] 899 for {set i 1} {$i < $n} {incr i} { 900 lappend A [expr {2 * $a($i) / $pi}] 901 } 902 return $A 903 } 904 905 # disable the improve fit button 906 proc bkgResetFit {} { 907 .bkg.f.fit2 config -state disabled 908 } 909 910 # enable the improve fit button, if appropriate 911 proc bkgMoreFit {} { 912 global cheblist 913 if {[llength $cheblist] < 2} {bkgResetFit;return} 914 .bkg.f.fit2 config -state normal 915 } 916 917 # perform a Gauss-Newton fit to optimize Chebyshev coefficients A 918 proc chebGN {X Y S A xmin xmax "damp 0.75"} { 919 # Gauss-Newton 920 if {[llength $X] != [llength $Y]} return 921 set xnorm [expr {2. / ($xmax - $xmin)}] 922 # denominator 923 set sum2 0. 924 foreach x $X s $S { 925 set xs [expr {-1 + (1.*$x - $xmin) * $xnorm}] 926 set Tpp 0 927 set Tp 0 928 foreach a1 $A { 929 if {$Tpp == $Tp && $Tp == 0} { 930 set T 1 931 } elseif {$Tpp == 0} { 932 set T $xs 933 } else { 934 set T [expr {2. * $xs * $Tp - $Tpp}] 935 } 936 set sum2 [expr {$sum2 + $T /($s*$s)}] 937 set Tpp $Tp 938 set Tp $T 939 } 940 } 941 # Evaluate Ycalc & sum(delta2) 942 set sumd2 0. 943 foreach x $X y $Y { 944 # set xs [expr {-1 + (1.*$x - $xmin) * $xnorm}] 945 lappend Ycalc [set yc [chebeval $A $x $xmin $xmax]] 946 set sumd2 [expr {$sumd2 + ($y - $yc)*($y - $yc)}] 947 } 948 set k -1 949 foreach a $A {incr k; set sum($k) 0} 950 foreach x $X y $Y yc $Ycalc s $S { 951 set xs [expr {-1 + (1.*$x - $xmin) * $xnorm}] 952 set Tpp 0 953 set Tp 0 954 set k -1 955 foreach a $A { 956 incr k 957 if {$Tpp == $Tp && $Tp == 0} { 958 set T 1 959 } elseif {$Tpp == 0} { 960 set T $xs 961 } else { 962 set T [expr {2. * $xs * $Tp - $Tpp}] 963 } 964 set sum($k) [expr {$sum($k) + ($T * ($yc - $y))/($s*$s)}] 965 set Tpp $Tp 966 set Tp $T 967 } 968 } 969 set sumd2r $sumd2 970 set d $damp 971 # compute new cheb terms 972 while {$d > $damp/32} { 973 set k -1 974 set Anew {} 975 foreach a $A { 976 incr k 977 lappend Anew [expr {$a - $d*($sum($k) / $sum2)}] 978 } 979 # Evaluate new Ycalc & sum(delta2) 980 set sumd2r 0. 981 foreach x $X y $Y { 982 # set xs [expr {-1 + (1.*$x - $xmin) * $xnorm}] 983 set yc [chebeval $Anew $x $xmin $xmax] 984 set sumd2r [expr {$sumd2r + ($y - $yc)*($y - $yc)}] 985 } 986 # are these shifts an improvement? 987 if {$sumd2r < $sumd2} { 988 # are we converged? 989 if {[expr {($sumd2-$sumd2r)/$sumd2}] < 0.0001} {return ""} 990 return $Anew 991 } 992 set d [expr {$d/2.}] 993 } 994 return "" 995 } 996 997 # change the binding of the mouse, based on the selected mode 998 proc bkgEditMode {b} { 999 global zoomcommand box 1000 # get binding 1001 set bindtag $box 1002 catch { 1003 if {[bind bltZoomGraph] != ""} { 1004 set bindtag bltZoomGraph 1005 } 1006 } 1007 # save the zoom command 1008 if [catch {set zoomcommand}] { 1009 set zoomcommand [bind $bindtag <1>] 1010 .bkg.f.fit1 config -state disabled 1011 .bkg.f.fit2 config -state disabled 1012 .bkg.f.terms config -state disabled 1013 } 1014 foreach c {1 2 3} { 1015 if {$c == $b} { 1016 .bkg.l.b$c config -relief sunken 1017 } else { 1018 .bkg.l.b$c config -relief raised 1019 } 1020 } 1021 if {$b == 2} { 1022 bind $bindtag <1> "bkgAddPoint %x %y" 1023 .g config -cursor arrow 1024 } elseif {$b == 3} { 1025 bind $bindtag <1> "bkgDelPoint %x %y" 1026 .g config -cursor circle 1027 } else { 1028 bind $bindtag <1> $zoomcommand 1029 .g config -cursor crosshair 1030 } 1031 } 1032 1033 # plot the background points 1034 proc bkgPointPlot {} { 1035 global bkglist termmenu chebterms expnam hst tmin tmax 1036 set l {} 1037 set fp [open $expnam.bkg$hst w] 1038 puts $fp "y p h e $hst b ! fixed background points for use in BKGEDIT" 1039 foreach p $bkglist { 1040 puts $fp "i\t$p\t0.0" 1041 append l " $p" 1042 } 1043 if {[llength $bkglist] > 0} { 1044 puts $fp "i\t[expr $tmin*0.99] [lindex [lindex $bkglist 0] 1]\t0.0" 1045 puts $fp "i\t[expr $tmax*1.01] [lindex [lindex $bkglist end] 1]\t0.0" 1046 } 1047 close $fp 1048 .g element config 12 -data $l 1049 if {[set l [llength $bkglist]] > 3} { 1050 .bkg.f.fit1 config -state normal 1051 .bkg.f.terms config -state normal 1052 $termmenu delete 0 end 1053 set imax {} 1054 for {set i 2} {$i <= $l/1.5} {incr i 2} { 1055 $termmenu insert end radiobutton -label $i \ 1056 -variable chebterms -command {bkgMoreFit} 1057 set imax $i 1058 } 1059 if {$imax < $chebterms} {set chebterms $imax} 1060 } else { 1061 .bkg.f.fit1 config -state disabled 1062 .bkg.f.fit2 config -state disabled 1063 .bkg.f.terms config -state disabled 1064 set chebterms 2 1065 } 1066 } 1067 1068 # add a bkg point at screen coordinates x,y 1069 proc bkgAddPoint {x y} { 1070 global bkglist tmin tmax 1071 set xy [.g invtransform $x $y] 1072 set x [lindex $xy 0] 1073 if {$x < $tmin} {set x $tmin} 1074 if {$x > $tmax} {set x $tmax} 1075 lappend bkglist [list $x [lindex $xy 1]] 1076 set bkglist [lsort -real -index 0 $bkglist] 1077 bkgMoreFit 1078 bkgFillPoints 1079 bkgPointPlot 1080 } 1081 1082 # delete the bkg point closest to screen coordinates x,y 1083 proc bkgDelPoint {x y} { 1084 global bkglist 1085 set closest {} 1086 set dist2 {} 1087 set i -1 1088 foreach p $bkglist { 1089 incr i 1090 set sxy [eval .g transform $p] 1091 if {$closest == ""} { 1092 set closest $i 1093 set dist2 0 1094 foreach v1 $sxy v2 "$x $y" { 1095 set dist2 [expr {$dist2 + ($v1 - $v2)*($v1 - $v2)}] 1096 } 1097 } else { 1098 set d2 0 1099 foreach v1 $sxy v2 "$x $y" { 1100 set d2 [expr {$d2 + ($v1 - $v2)*($v1 - $v2)}] 1101 } 1102 if {$d2 < $dist2} { 1103 set closest $i 1104 set dist2 $d2 1105 } 1106 } 1107 } 1108 set bkglist [lreplace $bkglist $closest $closest] 1109 bkgMoreFit 1110 bkgPointPlot 1111 bkgFillPoints 1112 } 1113 1114 # initialize the background plot 1115 proc bkghstInit {} { 1116 global bkglist tmin tmax hst expnam cheblist chebterms 1117 set tmin [histinfo $hst tmin] 1118 set tmax [histinfo $hst tmax] 1119 if {[catch {expr $tmin}] || [catch {expr $tmax}]} { 1120 tk_dialog .err "MIN/MAX Error" "Error -- Unable read tmin or tmax (has POWPREF been run?" \ 1121 error 0 Quit 1122 destroy . 1123 } 1124 1125 set bkglist {} 1126 if [file exists $expnam.bkg$hst] { 1127 catch { 1128 set fp [open $expnam.bkg$hst r] 1129 gets $fp line 1130 while {[gets $fp line]>=0} { 1131 set x [lindex $line 1] 1132 set y [lindex $line 2] 1133 if {$x >= $tmin && $x <= $tmax} { 1134 lappend bkglist [list $x $y] 1135 } 1136 } 1137 } 1138 close $fp 1139 } 1140 1141 bkgEditMode 1 1142 bkgPointPlot 1143 bkgFillPoints 1144 set cheblist "" 1145 bkgResetFit 1146 BkgFillCheb 1147 set chebterms 2 1148 } 1149 1150 # fit a Chebyshev polynomial to the selected background points 1151 proc bkgFit {termlist button} { 1152 global bkglist chebterms cheblist 1153 $button config -relief sunken 1154 update 1155 foreach p $bkglist { 1156 lappend S 1. 1157 foreach v $p var {X Y} { 1158 lappend $var $v 1159 } 1160 } 1161 global tmin tmax 1162 if {[llength $termlist] < 2} { 1163 # get a starting point 1164 set termlist [chebgen $X $Y $tmin $tmax $chebterms] 1165 # plot it 1166 set calcb {} 1167 foreach x [xvec range 0 end] { 1168 lappend calcb [chebeval $termlist $x $tmin $tmax] 1169 } 1170 .g element configure 11 -xdata xvec -ydata $calcb 1171 update 1172 } elseif {[llength $termlist] < $chebterms} { 1173 while {[llength $termlist] < $chebterms} { 1174 lappend termlist 0. 1175 } 1176 } elseif {[llength $termlist] > $chebterms} { 1177 set termlist [lrange $termlist 0 [expr $chebterms -1]] 1178 } 1179 # iterate 1180 for {set i 1} {$i < 20} {incr i} { 1181 set termlist1 [chebGN $X $Y $S $termlist $tmin $tmax] 1182 # have we converged? 1183 if {$termlist1 == ""} { 1184 bkgResetFit 1185 set cheblist $termlist 1186 BkgFillCheb 1187 bkgFillPoints 1188 $button config -relief raised 1189 return 1190 } 1191 set termlist $termlist1 1192 set calcb {} 1193 foreach x [xvec range 0 end] { 1194 lappend calcb [chebeval $termlist $x $tmin $tmax] 1195 } 1196 .g element configure 11 -xdata xvec -ydata $calcb 1197 update 1198 } 1199 set cheblist $termlist 1200 BkgFillCheb 1201 bkgFillPoints 1202 bkgMoreFit 1203 $button config -relief raised 1204 } 1205 1206 # put the Chebyshev coefficients into edit widgets 1207 proc BkgFillCheb {} { 1208 global cheblist 1209 global chebedit 1210 catch {destroy .bkg.canvas.fr} 1211 set top [frame .bkg.canvas.fr] 1212 .bkg.canvas create window 0 0 -anchor nw -window $top 1213 # delete trace on chebedit 1214 foreach v [ trace vinfo chebedit] { 1215 eval trace vdelete chebedit $v 1216 } 1217 if {[llength $cheblist] == 0} { 1218 grid [label $top.0 -text "(no terms defined)"] -col 1 -row 1 1219 .bkg.cw config -state disabled 1220 } else { 1221 set i -1 1222 .bkg.cw config -state normal 1223 foreach c $cheblist { 1224 incr i 1225 grid [frame $top.$i -relief groove -bd 3] -col $i -row 1 1226 grid [label $top.$i.l -text "[expr 1+$i]"] -col 1 -row 1 1227 grid [entry $top.$i.e -textvariable chebedit($i) -width 13] \ 1228 -col 2 -row 1 1229 set chebedit($i) $c 1230 } 1231 trace variable chebedit w "BkgRecalcCheb $top" 1232 } 1233 update idletasks 1234 set sizes [grid bbox $top] 1235 .bkg.canvas config -scrollregion $sizes -height [lindex $sizes 3] 1236 } 1237 1238 # respond to edits made to Chebyshev terms 1239 proc BkgRecalcCheb {top var i mode} { 1240 global chebedit cheblist 1241 if [catch {expr $chebedit($i)}] { 1242 $top.$i.e config -fg red 1243 } else { 1244 $top.$i.e config -fg black 1245 set cheblist [lreplace $cheblist $i $i $chebedit($i)] 1246 global tmin tmax 1247 # plot it 1248 set calcb {} 1249 foreach x [xvec range 0 end] { 1250 lappend calcb [chebeval $cheblist $x $tmin $tmax] 1251 } 1252 .g element configure 11 -xdata xvec -ydata $calcb 1253 update 1254 bkgMoreFit 1255 } 1256 } 1257 1258 # put the bkg points into edit widgets 1259 proc bkgFillPoints {} { 1260 global bkglist tmin tmax bkgedit 1261 # delete trace on bkgedit 1262 foreach v [ trace vinfo bkgedit] { 1263 eval trace vdelete bkgedit $v 1264 } 1265 catch {destroy .bkg.bc.fr} 1266 set top [frame .bkg.bc.fr] 1267 .bkg.bc create window 0 0 -anchor nw -window $top 1268 if {[llength $bkglist] == 0} { 1269 grid [label $top.0 -text "(no points defined)"] -col 1 -row 1 1270 } else { 1271 set i -1 1272 foreach p $bkglist { 1273 incr i 1274 grid [frame $top.$i -relief groove -bd 3] -col $i -row 1 1275 grid [label $top.$i.l -text "[expr 1+$i]"] -col 1 -rowspan 2 -row 1 1276 grid [entry $top.$i.ex -textvariable bkgedit(x$i) -width 13] \ 1277 -col 2 -row 1 1278 grid [entry $top.$i.ey -textvariable bkgedit(y$i) -width 13] \ 1279 -col 2 -row 2 1280 foreach val $p var {x y} { 1281 set bkgedit(${var}$i) $val 1282 } 1283 } 1284 trace variable bkgedit w "BkgRecalcBkg $top" 1285 } 1286 update idletasks 1287 set sizes [grid bbox $top] 1288 .bkg.bc config -scrollregion $sizes -height [lindex $sizes 3] 1289 } 1290 1291 # respond to edits made to bkg points 1292 proc BkgRecalcBkg {top var i mode} { 1293 global bkgedit bkglist tmin tmax 1294 regexp {(.)([0-9]*)} $i junk var num 1295 if [catch {expr $bkgedit($i)}] { 1296 $top.$num.e$var config -fg red 1297 } else { 1298 $top.$num.e$var config -fg black 1299 set p [lindex $bkglist $num] 1300 if {$var == "x"} { 1301 set x $bkgedit($i) 1302 if {$x < $tmin} {set x $tmin} 1303 if {$x > $tmax} {set x $tmax} 1304 set bkglist [lreplace $bkglist $num $num \ 1305 [list $x [lindex $p 1]]] 1306 } else { 1307 set bkglist [lreplace $bkglist $num $num \ 1308 [list [lindex $p 0] $bkgedit($i)]] 1309 } 1310 } 1311 bkgPointPlot 1312 } 1313 1314 # save the Chebyshev terms in the .EXP file 1315 proc bkgChebSave {} { 1316 global hst cheblist expgui Revision expmap expnam 1317 histinfo $hst backtype set 1 1318 histinfo $hst backterms set [llength $cheblist] 1319 set num 0 1320 foreach v $cheblist { 1321 set var "bterm[incr num]" 1322 histinfo $hst $var set $v 1323 } 1324 histinfo $hst bref set 0 1325 # add a history record 1326 exphistory add " BKGEDIT [lindex $Revision 1] [lindex $expmap(Revision) 1] -- [clock format [clock seconds]]" 1327 # now save the file 1328 expwrite $expnam.EXP 1329 } 1330 845 1331 846 1332 source [file join $expgui(scriptdir) gsascmds.tcl] 1333 source [file join $expgui(scriptdir) readexp.tcl] 847 1334 848 1335 # override options with locally defined values … … 887 1374 error 0 "Limp ahead" 888 1375 } 1376 # modify zoom so that y2axis is not zoomed in for blt2.4u+ 1377 catch { 1378 regsub -all y2axis [info body blt::PushZoom] " " b1 1379 proc blt::PushZoom {graph} $b1 1380 } 1381 889 1382 $box element create 0 -xdata xvec -ydata wifdvec -color magenta \ 890 1383 -line 3 -symbol none -label "Chi2" -mapy y2 1384 $box element create 1 -label bckgr -color green -symbol none 1385 $box element config 1 -xdata xvec -ydata bckvec 891 1386 $box element create 3 -color black -linewidth 0 -label Obs \ 892 1387 -symbol $peakinfo(obssym) \ … … 894 1389 $box element create 2 -label Calc -color red -symbol none 895 1390 $box element create 4 -label diff -color blue -symbol none 1391 1392 if {$program == "liveplot"} { 1393 $box y2axis config -min 0 -title {Cumulative Chi Squared} 1394 } elseif {$program == "bkgedit"} { 1395 eval $box element config 0 $graph(ElementHideOption) 1396 eval $box y2axis config $graph(ElementHideOption) 1397 $box element config 0 -label "" 1398 eval $box element config 1 $graph(ElementHideOption) 1399 $box element config 1 -label "" 1400 eval $box element config 4 $graph(ElementHideOption) 1401 $box element config 4 -label "" 1402 $box element create 11 1403 $box element create 12 1404 $box element configure 12 -color magenta -pixels 12 \ 1405 -line 0 -symbol triangle -label "bkg pts" 1406 $box element configure 11 -color blue \ 1407 -symbol none -label "Cheb fit" -dashes 5 -line 2 1408 $box element show "3 2 11 12" 1409 } 896 1410 $box element config 3 -xdata xvec -ydata obsvec 897 1411 $box element config 2 -xdata xvec -ydata calcvec 898 1412 $box element config 4 -xdata xvec -ydata diffvec 1413 899 1414 if {$expgui(tcldump) != ""} { 900 $box element create 1 -label bckgr -color green -symbol none901 $box element config 1 -xdata xvec -ydata bckvec902 bind . <Shift-Button-1> "lblhkl $box %x"903 1415 bind . <Key-h> "lblhkl $box %x" 904 1416 bind . <Key-H> "lblhkl $box %x" 905 1417 # bind $box <Shift-Double-Button-1> "lblallhkl %W" 906 bind $box <Shift-Button-3> "delallhkllbl %W" 1418 if {[bind bltZoomGraph] != ""} { 1419 bind bltZoomGraph <Shift-Button-1> "lblhkl $box %x" 1420 bind bltZoomGraph <Shift-Button-3> "delallhkllbl %W" 1421 } else { 1422 bind $box <Shift-Button-1> "lblhkl $box %x" 1423 bind $box <Shift-Button-3> "delallhkllbl %W" 1424 } 1425 } else { 1426 $box element config 1 -label "" 1427 eval $box element config 4 $graph(ElementHideOption) 907 1428 } 908 1429 $box yaxis config -title {} 909 1430 setlegend $box $graph(legend) 910 ShowCumulativeChi2 911 912 updateifnew 1431 913 1432 frame .a -bd 3 -relief groove 914 1433 pack [menubutton .a.file -text File -underline 0 -menu .a.file.menu] -side left … … 953 1472 } 954 1473 .a.options.menu add command -label "Obs symbol" -command setsymopts 955 if {$expgui(tcldump) != "" } {1474 if {$expgui(tcldump) != "" && $program == "liveplot"} { 956 1475 .a.options.menu add cascade -label "X units" -menu .a.options.menu.xunits 957 1476 menu .a.options.menu.xunits … … 977 1496 -variable graph(backsub) \ 978 1497 -command {set cycle [getcycle];readdata .g} 1498 } else { 1499 set graph(xunits) 0 979 1500 } 980 1501 … … 983 1504 -command {setlegend $box $graph(legend)} 984 1505 .a.options.menu add command -label "Set PS output" -command setpostscriptout 985 .a.options.menu add checkbutton -label "Raise on update" \ 986 -variable graph(autoraise) 987 .a.options.menu add checkbutton -label "Cumulative Chi2" \ 988 -variable graph(chi2) -command ShowCumulativeChi2 989 .a.options.menu add command -label "Save Options" -underline 1 \ 990 -command "SaveOptions" 991 $box y2axis config -min 0 -title {Cumulative Chi Squared} 992 ShowCumulativeChi2 1506 if {$program == "liveplot"} { 1507 .a.options.menu add checkbutton -label "Raise on update" \ 1508 -variable graph(autoraise) 1509 .a.options.menu add checkbutton -label "Cumulative Chi2" \ 1510 -variable graph(chi2) -command ShowCumulativeChi2 1511 .a.options.menu add command -label "Save Options" -underline 1 \ 1512 -command "SaveOptions" 1513 ShowCumulativeChi2 1514 } elseif {$program == "bkgedit"} { 1515 catch {pack [frame .bkg -bd 3 -relief sunken] -side bottom -fill both} 1516 grid [label .bkg.top -text "Background Point Editing"] \ 1517 -col 0 -row 0 -columnspan 4 1518 grid [button .bkg.help -text Help -bg yellow \ 1519 -command "MakeWWWHelp liveplot.html bkgedit"] \ 1520 -column 5 -row 0 -rowspan 2 -sticky n 1521 1522 grid [frame .bkg.l -bd 3 -relief groove] \ 1523 -col 0 -row 1 -columnspan 2 -sticky nse 1524 grid [label .bkg.l.1 -text "Mouse click\naction"] -col 0 -row 0 1525 foreach c {1 2 3} l {zoom add delete} { 1526 grid [button .bkg.l.b$c -text $l -command "bkgEditMode $c"] \ 1527 -col $c -row 0 1528 } 1529 grid [frame .bkg.f -bd 3 -relief groove] \ 1530 -col 3 -row 1 -columnspan 2 -sticky nsw 1531 grid [button .bkg.f.fit1 -text "Start\nFit" -command {bkgFit "" .bkg.f.fit1}] \ 1532 -col 1 -row 1 1533 grid [button .bkg.f.fit2 -text "Improve\nFit" \ 1534 -command {bkgFit $cheblist .bkg.f.fit2}] -col 2 -row 1 1535 grid [label .bkg.f.tl -text "with"] -col 3 -row 1 1536 set termmenu [tk_optionMenu .bkg.f.terms chebterms 0] 1537 grid .bkg.f.terms -col 4 -row 1 1538 grid [label .bkg.f.tl1 -text "terms"] -col 5 -row 1 1539 1540 grid [frame .bkg.c1 -bd 3 -relief groove] \ 1541 -col 0 -row 5 -rowspan 2 -sticky nsew 1542 grid [label .bkg.c1.1 -text "Chebyshev\nterms"] -col 0 -row 0 1543 grid [canvas .bkg.canvas \ 1544 -scrollregion {0 0 5000 500} -width 0 -height 0 \ 1545 -xscrollcommand ".bkg.scroll set"] \ 1546 -column 1 -row 5 -columnspan 3 -sticky nsew 1547 grid [scrollbar .bkg.scroll -command ".bkg.canvas xview" \ 1548 -orient horizontal] -column 1 -row 6 -columnspan 3 -sticky nsew 1549 grid [button .bkg.cw -text "Save in EXP\nfile & Exit" \ 1550 -command "bkgChebSave;exit"] \ 1551 -col 4 -columnspan 2 -row 5 -rowspan 2 -sticky ns 1552 1553 grid [frame .bkg.bl -bd 3 -relief groove] \ 1554 -col 0 -row 3 -rowspan 2 -sticky nsew 1555 grid [label .bkg.bl.1 -text "Background\npoints"] -col 0 -row 0 1556 grid [canvas .bkg.bc \ 1557 -scrollregion {0 0 5000 500} -width 0 -height 0 \ 1558 -xscrollcommand ".bkg.bs set"] \ 1559 -column 1 -row 3 -columnspan 5 -sticky nsew 1560 grid [scrollbar .bkg.bs -command ".bkg.bc xview" -orient horizontal] \ 1561 -column 1 -row 4 -columnspan 5 -sticky nsew 1562 1563 grid columnconfigure .bkg 1 -weight 1 1564 grid columnconfigure .bkg 2 -weight 1 1565 grid columnconfigure .bkg 3 -weight 1 1566 grid rowconfigure .bkg 3 -weight 1 1567 grid rowconfigure .bkg 5 -weight 1 1568 .g config -title "" 1569 } 993 1570 994 1571 pack [menubutton .a.help -text Help -underline 0 -menu .a.help.menu] -side right … … 1006 1583 if [file exists $fl] {source $fl} 1007 1584 1585 if {$program == "bkgedit"} { 1586 expload $expnam.EXP 1587 mapexp 1588 1589 # bkghstInit 1590 } 1591 updateifnew 1008 1592 donewaitmsg 1009 1593 trace variable peakinfo w plotdataupdate
Note: See TracChangeset
for help on using the changeset viewer.