[931] | 1 | #!/bin/sh |
---|
| 2 | # the next line restarts this script using wish found in the path\ |
---|
| 3 | exec wish "$0" "$@" |
---|
| 4 | # If this does not work, change the #!/usr/bin/wish line below |
---|
| 5 | # to reflect the actual wish location and delete all preceeding lines |
---|
| 6 | # |
---|
| 7 | # (delete here and above) |
---|
| 8 | #!/usr/bin/wish |
---|
| 9 | # $Id: widplt,v 1.20 2008/04/15 17:30:45 toby Exp toby $ |
---|
| 10 | set Revision {$Revision: 1.20 $ $Date: 2008/04/15 17:30:45 $} |
---|
| 11 | package require Tk |
---|
| 12 | bind all <Control-KeyPress-c> {destroy .} |
---|
| 13 | set expnam [lindex $argv 0] |
---|
| 14 | if {$expnam != ""} { |
---|
| 15 | if {[string toupper [file extension $expnam]] != ".EXP"} { |
---|
| 16 | append expnam ".EXP" |
---|
| 17 | } |
---|
| 18 | } |
---|
| 19 | # get name of script |
---|
| 20 | set expgui(script) [info script] |
---|
| 21 | # what are we running here? |
---|
| 22 | set program [file tail $argv0] |
---|
| 23 | # fix up problem with starkit tcl |
---|
| 24 | if {$program != "absplt" && $program != "widplt"} { |
---|
| 25 | set program [file tail $expgui(script)] |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | if [catch {package require BLT} errmsg] { |
---|
| 29 | tk_dialog .err "BLT Error" "Error -- Unable to load the BLT package" \ |
---|
| 30 | error 0 Quit |
---|
| 31 | destroy . |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | # handle Tcl/Tk v8+ where BLT is in a namespace |
---|
| 35 | # use the command so that it is loaded |
---|
| 36 | catch {blt::graph} |
---|
| 37 | catch { |
---|
| 38 | namespace import blt::graph |
---|
| 39 | namespace import blt::vector |
---|
| 40 | } |
---|
| 41 | # old versions of blt don't report a version number |
---|
| 42 | if [catch {set blt_version}] {set blt_version 0} |
---|
| 43 | |
---|
| 44 | set expgui(debug) 0 |
---|
| 45 | catch {if $env(DEBUG) {set expgui(debug) 1}} |
---|
| 46 | #set expgui(debug) 1 |
---|
| 47 | |
---|
| 48 | proc waitmsg {message} { |
---|
| 49 | set w .wait |
---|
| 50 | # kill any window/frame with this name |
---|
| 51 | catch {destroy $w} |
---|
| 52 | pack [frame $w] |
---|
| 53 | frame $w.bot -relief raised -bd 1 |
---|
| 54 | pack $w.bot -side bottom -fill both |
---|
| 55 | frame $w.top -relief raised -bd 1 |
---|
| 56 | pack $w.top -side top -fill both -expand 1 |
---|
| 57 | label $w.msg -justify left -text $message -wrap 3i |
---|
| 58 | catch {$w.msg configure -font \ |
---|
| 59 | -Adobe-Times-Medium-R-Normal--*-180-*-*-*-*-*-* |
---|
| 60 | } |
---|
| 61 | pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m |
---|
| 62 | label $w.bitmap -bitmap info |
---|
| 63 | pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m |
---|
| 64 | update |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | proc donewaitmsg {} { |
---|
| 68 | catch {destroy .wait} |
---|
| 69 | update |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | if {$expnam != ""} {waitmsg "Loading $expnam, Please wait"} |
---|
| 73 | |
---|
| 74 | # get profile/absorption information out from an EXP file |
---|
| 75 | proc getprofiles {expnam} { |
---|
| 76 | global WidSetList absSetList wave XY UVWP lblarr ttrange |
---|
| 77 | global expmap |
---|
| 78 | |
---|
| 79 | if {$expnam != ""} { |
---|
| 80 | if {[expload $expnam] == -1} { |
---|
| 81 | tk_dialog .err "EXP Error" "Warning -- Unable to read $expnam" \ |
---|
| 82 | error 0 OK |
---|
| 83 | return |
---|
| 84 | } |
---|
| 85 | mapexp |
---|
| 86 | } else { |
---|
| 87 | set expmap(powderlist) {} |
---|
| 88 | } |
---|
| 89 | foreach hist $expmap(powderlist) { |
---|
| 90 | # wavelength |
---|
| 91 | set lambda1 [histinfo $hist lam1] |
---|
| 92 | # data range |
---|
| 93 | set drange [string trim [readexp "HST $hist TRNGE"]] |
---|
| 94 | global program |
---|
| 95 | if {$program == "absplt"} { |
---|
| 96 | global ABS |
---|
| 97 | set ABS($hist) [list \ |
---|
| 98 | [histinfo $hist abscor1] \ |
---|
| 99 | [histinfo $hist abscor2] \ |
---|
| 100 | [histinfo $hist abstype] \ |
---|
| 101 | $drange \ |
---|
| 102 | "Hist $hist" \ |
---|
| 103 | $expmap(htype_$hist)] |
---|
| 104 | lappend absSetList $hist |
---|
| 105 | } else { |
---|
| 106 | foreach phase $expmap(phaselist_$hist) { |
---|
| 107 | set ptype [hapinfo $hist $phase proftype] |
---|
| 108 | set pterms [hapinfo $hist $phase profterms] |
---|
| 109 | set key "H${hist}P${phase}" |
---|
| 110 | # make sure the key is not present already |
---|
| 111 | if {[lsearch $WidSetList $key] == -1} { |
---|
| 112 | lappend WidSetList $key |
---|
| 113 | } |
---|
| 114 | set lblarr($key) "Histogram $hist Phase $phase" |
---|
| 115 | set wave($key) $lambda1 |
---|
| 116 | set ttrange($key) $drange |
---|
| 117 | if {$ptype == 1} { |
---|
| 118 | set UVWP($key) [list [hapinfo $hist $phase pterm1] \ |
---|
| 119 | [hapinfo $hist $phase pterm2] \ |
---|
| 120 | [hapinfo $hist $phase pterm3] 0] |
---|
| 121 | set XY($key) {0 0} |
---|
| 122 | } elseif {$ptype == 2} { |
---|
| 123 | set UVWP($key) [list [hapinfo $hist $phase pterm1] \ |
---|
| 124 | [hapinfo $hist $phase pterm2] \ |
---|
| 125 | [hapinfo $hist $phase pterm3] \ |
---|
| 126 | [hapinfo $hist $phase pterm9]] |
---|
| 127 | set XY($key) [list [hapinfo $hist $phase pterm4] \ |
---|
| 128 | [hapinfo $hist $phase pterm5]] |
---|
| 129 | } elseif {$ptype == 3 || $ptype == 4 || $ptype == 5} { |
---|
| 130 | set UVWP($key) [list [hapinfo $hist $phase pterm1] \ |
---|
| 131 | [hapinfo $hist $phase pterm2] \ |
---|
| 132 | [hapinfo $hist $phase pterm3] \ |
---|
| 133 | [hapinfo $hist $phase pterm4]] |
---|
| 134 | if {$ptype == 3 || $ptype == 5} { |
---|
| 135 | set XY($key) [list [hapinfo $hist $phase pterm5] \ |
---|
| 136 | [hapinfo $hist $phase pterm6]] |
---|
| 137 | } else { |
---|
| 138 | set XY($key) [list [hapinfo $hist $phase pterm5] 0] |
---|
| 139 | } |
---|
| 140 | } |
---|
| 141 | } |
---|
| 142 | } |
---|
| 143 | } |
---|
| 144 | MakeCascadeMenus |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | proc makepostscriptout {} { |
---|
| 148 | global graph box |
---|
| 149 | if !$graph(printout) { |
---|
| 150 | set out [open "| $graph(outcmd) >& widplt.msg" w] |
---|
| 151 | catch { |
---|
| 152 | puts $out [$box postscript output -landscape 1 \ |
---|
| 153 | -decorations no -height 7.i -width 9.5i] |
---|
| 154 | close $out |
---|
| 155 | } msg |
---|
| 156 | catch { |
---|
| 157 | set out [open widplt.msg r] |
---|
| 158 | if {$msg != ""} {append msg "\n"} |
---|
| 159 | append msg [read $out] |
---|
| 160 | close $out |
---|
| 161 | file delete widplt.msg |
---|
| 162 | } |
---|
| 163 | if {$msg != ""} { |
---|
| 164 | tk_dialog .msg "file created" \ |
---|
| 165 | "Postscript file processed with command \ |
---|
| 166 | $graph(outcmd). Result: $msg" "" 0 OK |
---|
| 167 | } else { |
---|
| 168 | tk_dialog .msg "file created" \ |
---|
| 169 | "Postscript file processed with command \ |
---|
| 170 | $graph(outcmd)" "" 0 OK |
---|
| 171 | } |
---|
| 172 | } else { |
---|
| 173 | $box postscript output $graph(outname) -landscape 1 \ |
---|
| 174 | -decorations no -height 7.i -width 9.5i |
---|
| 175 | tk_dialog .msg "file created" \ |
---|
| 176 | "Postscript file $graph(outname) created" "" 0 OK |
---|
| 177 | } |
---|
| 178 | } |
---|
| 179 | |
---|
| 180 | proc setprintopt {page} { |
---|
| 181 | global graph |
---|
| 182 | if $graph(printout) { |
---|
| 183 | $page.4.1 config -fg black |
---|
| 184 | $page.4.2 config -fg black -state normal |
---|
| 185 | $page.6.1 config -fg #888 |
---|
| 186 | $page.6.2 config -fg #888 -state disabled |
---|
| 187 | } else { |
---|
| 188 | $page.4.1 config -fg #888 |
---|
| 189 | $page.4.2 config -fg #888 -state disabled |
---|
| 190 | $page.6.1 config -fg black |
---|
| 191 | $page.6.2 config -fg black -state normal |
---|
| 192 | } |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | proc seteqwave {top} { |
---|
| 196 | global graph |
---|
| 197 | set box .wave |
---|
| 198 | catch {destroy $box} |
---|
| 199 | toplevel $box |
---|
| 200 | focus $box |
---|
| 201 | grab $box |
---|
| 202 | pack [frame $box.1] -side top |
---|
| 203 | pack [label $box.1.a -text "Equivalent wavelength:"] -side top |
---|
| 204 | pack [entry $box.1.b -textvariable graph(equivwave)] -side top |
---|
| 205 | pack [frame $box.2] -side top |
---|
| 206 | pack [button $box.2.c -text Clear -command "set graph(equivwave) {}; destroy $box"] |
---|
| 207 | pack [button $box.2.u -text Use -command "destroy $box"] |
---|
| 208 | tkwait window $box |
---|
| 209 | plotdata $top |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | proc setpostscriptout {} { |
---|
| 213 | global graph tcl_platform |
---|
| 214 | set box .out |
---|
| 215 | catch {destroy $box} |
---|
| 216 | toplevel $box |
---|
| 217 | focus $box |
---|
| 218 | grab $box |
---|
| 219 | pack [frame $box.4] -side top -anchor w -fill x |
---|
| 220 | pack [checkbutton $box.4.a -text "Write PostScript files" \ |
---|
| 221 | -variable graph(printout) -offvalue 0 -onvalue 1 \ |
---|
| 222 | -command "setprintopt $box"] -side left -anchor w |
---|
| 223 | pack [entry $box.4.2 -textvariable graph(outname)] -side right -anchor w |
---|
| 224 | pack [label $box.4.1 -text "PostScript file name:"] -side right -anchor w |
---|
| 225 | pack [frame $box.6] -side top -anchor w -fill x |
---|
| 226 | pack [checkbutton $box.6.a -text "Print PostScript files" \ |
---|
| 227 | -variable graph(printout) -offvalue 1 -onvalue 0 \ |
---|
| 228 | -command "setprintopt $box" ] -side left -anchor w |
---|
| 229 | pack [entry $box.6.2 -textvariable graph(outcmd)] -side right -anchor w |
---|
| 230 | pack [label $box.6.1 -text "Command to print files:"] -side right -anchor w |
---|
| 231 | |
---|
| 232 | pack [button $box.a -text "Close" -command "destroy $box"] -side top |
---|
| 233 | if {$tcl_platform(platform) == "windows"} { |
---|
| 234 | set graph(printout) 1 |
---|
| 235 | $box.4.a config -state disabled |
---|
| 236 | $box.6.a config -fg #888 -state disabled |
---|
| 237 | } |
---|
| 238 | setprintopt $box |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | proc aboutwidplot {} { |
---|
| 242 | global Revision |
---|
| 243 | tk_dialog .warn About " |
---|
| 244 | GSAS\n\ |
---|
[953] | 245 | R. B. Von Dreele, Argonne National Lab\n |
---|
| 246 | and A. C. Larson, Los Alamos (retired)\n\n\ |
---|
| 247 | WIDPLT/ABSPLT\nB. H. Toby, Argonne National Lab\n\n\ |
---|
[931] | 248 | $Revision\n\ |
---|
| 249 | " {} 0 OK |
---|
| 250 | } |
---|
| 251 | |
---|
| 252 | proc nextcolor {var} { |
---|
| 253 | set num [uplevel "incr $var"] |
---|
| 254 | return [lindex {red green blue cyan magenta yellow} [expr $num % 6]] |
---|
| 255 | } |
---|
| 256 | |
---|
| 257 | proc NewProfileValues {} { |
---|
| 258 | global newmenu datanum |
---|
| 259 | incr datanum |
---|
| 260 | set base .edit |
---|
| 261 | catch {destroy $base} |
---|
| 262 | toplevel $base |
---|
| 263 | focus $base |
---|
| 264 | grab $base |
---|
| 265 | wm title $base {Enter a new profile} |
---|
| 266 | MakeEditProfileBox $base |
---|
| 267 | grid [button $base.bttn1 -text Add \ |
---|
| 268 | -command "AddProfileValues; destroy $base"] -row 6 -column 6 |
---|
| 269 | grid [button $base.bttn2 -text Quit \ |
---|
| 270 | -command "destroy $base"] -row 6 -column 7 |
---|
| 271 | set newmenu(U) 0 |
---|
| 272 | set newmenu(V) 0 |
---|
| 273 | set newmenu(W) 0 |
---|
| 274 | set newmenu(P) 0 |
---|
| 275 | set newmenu(X) 0 |
---|
| 276 | set newmenu(Y) 0 |
---|
| 277 | set newmenu(min) 5 |
---|
| 278 | set newmenu(max) 100 |
---|
| 279 | set newmenu(label) "Curve #$datanum" |
---|
| 280 | set newmenu(wave) 1.5418 |
---|
| 281 | } |
---|
| 282 | |
---|
| 283 | proc AddProfileValues {} { |
---|
| 284 | global newmenu datanum lblarr WidDisplay UVWP XY WidSetList ttrange wave |
---|
| 285 | set key new$datanum |
---|
| 286 | set UVWP($key) [list $newmenu(U) $newmenu(V) $newmenu(W) $newmenu(P)] |
---|
| 287 | set XY($key) [list $newmenu(X) $newmenu(Y)] |
---|
| 288 | set lblarr($key) $newmenu(label) |
---|
| 289 | set ttrange($key) "$newmenu(min) $newmenu(max)" |
---|
| 290 | set wave($key) $newmenu(wave) |
---|
| 291 | lappend WidSetList $key |
---|
| 292 | MakeCascadeMenus |
---|
| 293 | } |
---|
| 294 | |
---|
| 295 | proc editProfileValues {key} { |
---|
| 296 | global newmenu WidSetList lblarr |
---|
| 297 | |
---|
| 298 | set base .edit |
---|
| 299 | catch {destroy $base} |
---|
| 300 | toplevel $base |
---|
| 301 | wm title $base {Edit a profile} |
---|
| 302 | MakeEditProfileBox $base |
---|
| 303 | grid [button $base.bttn1 -text Apply \ |
---|
| 304 | -command "SaveProfileEdits $key"] -row 6 -column 6 |
---|
| 305 | grid [button $base.bttn2 -text Close \ |
---|
| 306 | -command "destroy $base"] -row 6 -column 7 |
---|
| 307 | |
---|
| 308 | global UVWP XY ttrange wave lblarr |
---|
| 309 | set newmenu(label) $lblarr($key) |
---|
| 310 | set newmenu(U) [lindex $UVWP($key) 0] |
---|
| 311 | set newmenu(V) [lindex $UVWP($key) 1] |
---|
| 312 | set newmenu(W) [lindex $UVWP($key) 2] |
---|
| 313 | set newmenu(P) [lindex $UVWP($key) 3] |
---|
| 314 | set newmenu(X) [lindex $XY($key) 0] |
---|
| 315 | set newmenu(Y) [lindex $XY($key) 1] |
---|
| 316 | set newmenu(min) [lindex $ttrange($key) 0] |
---|
| 317 | set newmenu(max) [lindex $ttrange($key) 1] |
---|
| 318 | set newmenu(wave) $wave($key) |
---|
| 319 | } |
---|
| 320 | |
---|
| 321 | proc SaveProfileEdits {key} { |
---|
| 322 | global newmenu datanum lblarr WidDisplay UVWP XY WidSetList ttrange wave box |
---|
| 323 | set UVWP($key) [list $newmenu(U) $newmenu(V) $newmenu(W) $newmenu(P)] |
---|
| 324 | set XY($key) [list $newmenu(X) $newmenu(Y)] |
---|
| 325 | set ttrange($key) [list $newmenu(min) $newmenu(max)] |
---|
| 326 | set wave($key) $newmenu(wave) |
---|
| 327 | set lblarr($key) $newmenu(label) |
---|
| 328 | MakeCascadeMenus |
---|
| 329 | plotdata $box |
---|
| 330 | } |
---|
| 331 | |
---|
| 332 | proc MakeEditProfileBox {base} { |
---|
| 333 | grid [label $base.lb7 -text Gaussian] -row 2 -column 1 -columnspan 4 |
---|
| 334 | grid [label $base.lb8 -text Lorentz] -row 2 -column 6 -columnspan 2 |
---|
| 335 | grid [label $base.lb1 -text U] -row 3 -column 1 |
---|
| 336 | grid [label $base.lb2 -text V] -row 3 -column 2 |
---|
| 337 | grid [label $base.lb3 -text W] -row 3 -column 3 |
---|
| 338 | grid [label $base.lb4 -text P] -row 3 -column 4 |
---|
| 339 | grid [label $base.lb5 -text X] -row 3 -column 6 |
---|
| 340 | grid [label $base.lb6 -text Y] -row 3 -column 7 |
---|
| 341 | grid [entry $base.ent1 -textvariable newmenu(U) -width 12] \ |
---|
| 342 | -row 4 -column 1 |
---|
| 343 | grid [entry $base.ent2 -textvariable newmenu(V) -width 12] \ |
---|
| 344 | -row 4 -column 2 |
---|
| 345 | grid [entry $base.ent3 -textvariable newmenu(W) -width 12] \ |
---|
| 346 | -row 4 -column 3 |
---|
| 347 | grid [entry $base.ent4 -textvariable newmenu(P) -width 12] \ |
---|
| 348 | -row 4 -column 4 |
---|
| 349 | grid [entry $base.ent5 -textvariable newmenu(X) -width 12] \ |
---|
| 350 | -row 4 -column 6 |
---|
| 351 | grid [entry $base.ent6 -textvariable newmenu(Y) -width 12] \ |
---|
| 352 | -row 4 -column 7 |
---|
| 353 | |
---|
| 354 | grid [label $base.lb9 -text label] -row 5 -column 1 -sticky e |
---|
| 355 | grid [entry $base.ent7 -textvariable newmenu(label)]\ |
---|
| 356 | -row 5 -column 2 -columnspan 3 -sticky ew |
---|
| 357 | |
---|
| 358 | grid [label $base.lb13 -text Wavelength] -row 5 -column 5 -columnspan 2 |
---|
| 359 | grid [entry $base.ent11 -textvariable newmenu(wave) -width 8] \ |
---|
| 360 | -row 5 -column 7 |
---|
| 361 | |
---|
| 362 | grid [label $base.lb11 -text {2Theta Min}] -row 6 -column 1 |
---|
| 363 | grid [entry $base.ent9 -textvariable newmenu(min) -width 9] \ |
---|
| 364 | -row 6 -column 2 |
---|
| 365 | grid [label $base.lb12 -text {2Theta Max}] -row 6 -column 3 |
---|
| 366 | grid [entry $base.ent10 -textvariable newmenu(max) -width 9] \ |
---|
| 367 | -row 6 -column 4 |
---|
| 368 | grid rowconfigure $base 5 -weight 0 -pad 40 |
---|
| 369 | grid columnconfigure $base 5 -weight 0 -minsize 25 |
---|
| 370 | } |
---|
| 371 | |
---|
| 372 | proc editAbsValues {key} { |
---|
| 373 | global newmenu absSetList lblarr |
---|
| 374 | |
---|
| 375 | set base .edit |
---|
| 376 | catch {destroy $base} |
---|
| 377 | toplevel $base |
---|
| 378 | wm title $base {Edit Absorption Values} |
---|
| 379 | MakeEditAbsBox $base |
---|
| 380 | grid [button $base.bttn1 -text Apply \ |
---|
| 381 | -command "SaveAbsorptionEdits $key"] -row 8 -column 6 |
---|
| 382 | grid [button $base.bttn2 -text Close \ |
---|
| 383 | -command "destroy $base"] -row 8 -column 7 |
---|
| 384 | |
---|
| 385 | global ABS |
---|
| 386 | foreach v {1 2 opt range label htype} val $ABS($key) { |
---|
| 387 | set newmenu($v) $val |
---|
| 388 | } |
---|
| 389 | foreach {newmenu(min) newmenu(max)} $newmenu(range) {} |
---|
| 390 | if {[string range $newmenu(htype) 2 2] == "T"} { |
---|
| 391 | set newmenu(units) "TOF (ms):" |
---|
| 392 | } elseif {[string range $newmenu(htype) 2 2] == "C"} { |
---|
| 393 | set newmenu(units) "2-Theta (deg):" |
---|
| 394 | } elseif {[string range $newmenu(htype) 2 2] == "E"} { |
---|
| 395 | set newmenu(units) "Energy (KeV):" |
---|
| 396 | } |
---|
| 397 | } |
---|
| 398 | |
---|
| 399 | proc SaveAbsorptionEdits {key} { |
---|
| 400 | global ABS newmenu box |
---|
| 401 | set ABS($key) [list \ |
---|
| 402 | $newmenu(1) $newmenu(2) $newmenu(opt) \ |
---|
| 403 | [list $newmenu(min) $newmenu(max)] \ |
---|
| 404 | $newmenu(label) \ |
---|
| 405 | [lindex $ABS($key) 5]] |
---|
| 406 | plotdata $box |
---|
| 407 | } |
---|
| 408 | |
---|
| 409 | proc MakeEditAbsBox {base} { |
---|
| 410 | grid [label $base.lb1 -text "Absorption Coefficients"] \ |
---|
| 411 | -row 2 -column 1 -columnspan 2 |
---|
| 412 | grid [label $base.lb1a -text "1"] -row 3 -column 1 |
---|
| 413 | grid [label $base.lb2a -text "2"] -row 3 -column 2 |
---|
| 414 | grid [label $base.lb3 -text Absorption\nFunction] \ |
---|
| 415 | -row 2 -column 6 -rowspan 2 -columnspan 2 |
---|
| 416 | grid [entry $base.ent1 -textvariable newmenu(1) -width 12] \ |
---|
| 417 | -row 4 -column 1 |
---|
| 418 | grid [entry $base.ent2 -textvariable newmenu(2) -width 12] \ |
---|
| 419 | -row 4 -column 2 |
---|
| 420 | eval tk_optionMenu $base.m1 newmenu(opt) 0 1 2 3 4 |
---|
| 421 | grid $base.m1 -row 4 -column 6 -columnspan 2 |
---|
| 422 | |
---|
| 423 | grid [label $base.lb8 -textvariable newmenu(opttxt) \ |
---|
| 424 | -wrap 180 -justify left] -row 5 -column 1 -sticky e -columnspan 7 |
---|
| 425 | grid [label $base.lb9 -text label] -row 7 -column 1 -sticky e |
---|
| 426 | grid [entry $base.ent7 -textvariable newmenu(label)]\ |
---|
| 427 | -row 7 -column 2 -columnspan 3 -sticky ew |
---|
| 428 | |
---|
| 429 | grid [frame $base.f] -row 8 -column 1 -columnspan 4 |
---|
| 430 | grid [label $base.f.1 -textvariable newmenu(units)] -row 0 -column 1 |
---|
| 431 | grid [label $base.f.2 -text {Min}] -row 0 -column 2 |
---|
| 432 | grid [entry $base.f.3 -textvariable newmenu(min) -width 9] \ |
---|
| 433 | -row 0 -column 3 |
---|
| 434 | grid [label $base.f.4 -text {Max}] -row 0 -column 4 |
---|
| 435 | grid [entry $base.f.5 -textvariable newmenu(max) -width 9] \ |
---|
| 436 | -row 0 -column 5 |
---|
| 437 | grid rowconfigure $base 6 -min 15 |
---|
| 438 | } |
---|
| 439 | |
---|
| 440 | proc plotdata {top} { |
---|
| 441 | global program graph |
---|
| 442 | global UVWP XY wave lblarr WidSetList WidDisplay ttrange |
---|
| 443 | global ABS absSetList AbsDisplay |
---|
| 444 | if {$graph(plotunits) == "d"} { |
---|
| 445 | $top xaxis configure -title "d (A)" |
---|
| 446 | } elseif {$graph(plotunits) == "q"} { |
---|
| 447 | $top xaxis configure -title "Q (A-1)" |
---|
| 448 | } elseif {$graph(equivwave) == ""} { |
---|
| 449 | $top xaxis configure -title "2Theta" |
---|
| 450 | } else { |
---|
| 451 | $top xaxis configure -title "2Theta @ $graph(equivwave)" |
---|
| 452 | } |
---|
| 453 | if {$program == "absplt"} { |
---|
| 454 | $top yaxis config -title {Abs. Corr.} |
---|
| 455 | } else { |
---|
| 456 | $top yaxis config -title {FWHM} |
---|
| 457 | } |
---|
| 458 | $top yaxis configure -min 0 |
---|
| 459 | $top xaxis configure -min 0 |
---|
| 460 | # delete all graphs |
---|
| 461 | eval $top element delete [$top element names] |
---|
| 462 | set num -1 |
---|
| 463 | if {$program == "absplt"} { |
---|
| 464 | foreach item $absSetList { |
---|
| 465 | if {$AbsDisplay($item)} { |
---|
| 466 | set ttlist {} |
---|
| 467 | set abscor1 [lindex $ABS($item) 0] |
---|
| 468 | set abscor2 [lindex $ABS($item) 1] |
---|
| 469 | set abstype [lindex $ABS($item) 2] |
---|
| 470 | set abslbl [lindex $ABS($item) 4] |
---|
| 471 | set htype [lindex $ABS($item) 5] |
---|
| 472 | set ttmin [lindex [lindex $ABS($item) 3] 0] |
---|
| 473 | set ttmax [lindex [lindex $ABS($item) 3] 1] |
---|
| 474 | set ttstep [expr {($ttmax - $ttmin)/50.}] |
---|
| 475 | if {$graph(equivwave) == ""} { |
---|
| 476 | if {[string range $htype 2 2] == "T"} { |
---|
| 477 | $top xaxis configure -title "TOF (ms)" |
---|
| 478 | } elseif {[string range $htype 2 2] == "E"} { |
---|
| 479 | $top xaxis configure -title "Energy (KeV)" |
---|
| 480 | } |
---|
| 481 | } |
---|
| 482 | for {set tt $ttmin} \ |
---|
| 483 | {$tt <= $ttmax} \ |
---|
| 484 | {set tt [expr {$tt + $ttstep}]} { |
---|
| 485 | catch { |
---|
| 486 | lappend abslist [AbsorbCalc \ |
---|
| 487 | $item $tt $abscor1 $abscor2 $abstype] |
---|
| 488 | lappend ttlist $tt |
---|
| 489 | } |
---|
| 490 | } |
---|
| 491 | if {[llength $ttlist] == 0} continue |
---|
| 492 | if {$graph(plotunits) == "d"} { |
---|
| 493 | set ttlist [tod $ttlist $item] |
---|
| 494 | } elseif {$graph(plotunits) == "q"} { |
---|
| 495 | set ttlist [toQ $ttlist $item] |
---|
| 496 | } |
---|
| 497 | catch { |
---|
| 498 | $top element create $item |
---|
| 499 | } |
---|
| 500 | $top element config $item -label $abslbl \ |
---|
| 501 | -xdata $ttlist -ydata $abslist -linewidth 3 \ |
---|
| 502 | -color [nextcolor num] |
---|
| 503 | } |
---|
| 504 | } |
---|
| 505 | } else { |
---|
| 506 | foreach item $WidSetList { |
---|
| 507 | if {$WidDisplay($item)} { |
---|
| 508 | if {[expr [lindex $XY($item) 0] + [lindex $XY($item) 1]] != 0} { |
---|
| 509 | set lflag 1 |
---|
| 510 | } else { |
---|
| 511 | set lflag 0 |
---|
| 512 | } |
---|
| 513 | set ttlist {} |
---|
| 514 | set fwhmlist {} |
---|
| 515 | set lfwhmlist {} |
---|
| 516 | set tfwhmlist {} |
---|
| 517 | # loop over two-theta |
---|
| 518 | for {set tt [lindex $ttrange($item) 0]} \ |
---|
| 519 | {$tt <= [lindex $ttrange($item) 1]} \ |
---|
| 520 | {set tt [expr $tt + 4]} { |
---|
| 521 | set lfwhm 0 |
---|
| 522 | catch { |
---|
| 523 | if {$graph(plotunits) == "d"} { |
---|
| 524 | lappend ttlist [tt2d $wave($item) $tt ] |
---|
| 525 | set gfwhm [deltad $wave($item) $tt \ |
---|
| 526 | [eval FWHM $tt $UVWP($item)]] |
---|
| 527 | lappend fwhmlist $gfwhm |
---|
| 528 | if $lflag { |
---|
| 529 | set lfwhm [deltad $wave($item) $tt \ |
---|
| 530 | [eval LFWHM $tt $XY($item)]] |
---|
| 531 | lappend lfwhmlist $lfwhm |
---|
| 532 | } |
---|
| 533 | } elseif {$graph(plotunits) == "q"} { |
---|
| 534 | lappend ttlist [tt2Q $wave($item) $tt ] |
---|
| 535 | set gfwhm [deltaQ $wave($item) $tt \ |
---|
| 536 | [eval FWHM $tt $UVWP($item)]] |
---|
| 537 | lappend fwhmlist $gfwhm |
---|
| 538 | if $lflag { |
---|
| 539 | set lfwhm [deltaQ $wave($item) $tt \ |
---|
| 540 | [eval LFWHM $tt $XY($item)]] |
---|
| 541 | lappend lfwhmlist $lfwhm |
---|
| 542 | } |
---|
| 543 | } elseif {$graph(equivwave) == ""} { |
---|
| 544 | lappend ttlist $tt |
---|
| 545 | set gfwhm [eval FWHM $tt $UVWP($item)] |
---|
| 546 | lappend fwhmlist $gfwhm |
---|
| 547 | if $lflag { |
---|
| 548 | set lfwhm [eval LFWHM $tt $XY($item)] |
---|
| 549 | lappend lfwhmlist $lfwhm |
---|
| 550 | } |
---|
| 551 | } else { |
---|
| 552 | set tteq [ttequiv $wave($item) $tt $graph(equivwave)] |
---|
| 553 | if {$tteq != ""} { |
---|
| 554 | lappend ttlist $tteq |
---|
| 555 | set gfwhm [delta2teq $wave($item) $tt \ |
---|
| 556 | [eval FWHM $tt $UVWP($item)] $graph(equivwave)] |
---|
| 557 | lappend fwhmlist $gfwhm |
---|
| 558 | if $lflag { |
---|
| 559 | set lfwhm [delta2teq $wave($item) $tt \ |
---|
| 560 | [eval LFWHM $tt $XY($item)] $graph(equivwave)] |
---|
| 561 | lappend lfwhmlist $lfwhm |
---|
| 562 | } |
---|
| 563 | } |
---|
| 564 | } |
---|
| 565 | # assume FWHM add as square roots |
---|
| 566 | lappend tfwhmlist \ |
---|
| 567 | [expr sqrt($gfwhm*$gfwhm + $lfwhm*$lfwhm)] |
---|
| 568 | } |
---|
| 569 | } |
---|
| 570 | if $lflag { |
---|
| 571 | catch { |
---|
| 572 | $top element create ${item}G -label "$lblarr($item) G" |
---|
| 573 | } |
---|
| 574 | $top element config ${item}G \ |
---|
| 575 | -xdata $ttlist -ydata $fwhmlist -linewidth 3 \ |
---|
| 576 | -color [nextcolor num] |
---|
| 577 | catch { |
---|
| 578 | $top element create ${item}L -label "$lblarr($item) L" |
---|
| 579 | } |
---|
| 580 | $top element config ${item}L \ |
---|
| 581 | -xdata $ttlist -ydata $lfwhmlist -linewidth 3 \ |
---|
| 582 | -color [nextcolor num] |
---|
| 583 | } |
---|
| 584 | catch { |
---|
| 585 | $top element create $item -label $lblarr($item) |
---|
| 586 | } |
---|
| 587 | $top element config $item \ |
---|
| 588 | -xdata $ttlist -ydata $tfwhmlist -linewidth 3 \ |
---|
| 589 | -color [nextcolor num] |
---|
| 590 | } |
---|
| 591 | } |
---|
| 592 | } |
---|
| 593 | } |
---|
| 594 | proc AbsorbCalc {hst ttof abscor1 abscor2 mode} { |
---|
| 595 | global expmap |
---|
| 596 | set htype $expmap(htype_$hst) |
---|
| 597 | set pi [expr {2.*acos(0.)}] |
---|
| 598 | # determine sin(theta) & lambda |
---|
| 599 | if {[string range $htype 2 2] == "T"} { |
---|
| 600 | set sth [expr {sin($pi * abs([histinfo $hst tofangle])/360.)}] |
---|
| 601 | set lamb [expr {2 * [toftod $ttof $hst] * $sth}] |
---|
| 602 | } elseif {[string range $htype 2 2] == "C"} { |
---|
| 603 | set lamb [histinfo $hst lam1] |
---|
| 604 | set sth [expr {sin($pi * ($ttof - [histinfo $hst zero]/100.)/360.)}] |
---|
| 605 | } elseif {[string range $htype 2 2] == "E"} { |
---|
| 606 | set lamb [expr { 12.398 / $ttof}] |
---|
| 607 | set sth [expr {sin($pi * [histinfo $hst lam1] / 360.)}] |
---|
| 608 | } |
---|
| 609 | set sth2 [expr $sth*$sth] |
---|
| 610 | set cth2 [expr {1 - $sth2}] |
---|
| 611 | set cth [expr {sqrt($cth2)}] |
---|
| 612 | |
---|
| 613 | if {$mode == 0} { |
---|
| 614 | set murl [expr {$abscor1 * $lamb}]; # Lobanov & Alte da Veiga |
---|
| 615 | if {$murl <= 3} { |
---|
| 616 | set TERM0 [expr { 16.0/(3*$pi) }] |
---|
| 617 | set TERM1 [expr { (25.99978-0.01911*pow($sth2,0.25)) * \ |
---|
| 618 | exp(-0.024551*$sth2) + 0.109561*sqrt($sth2)-26.04556 }] |
---|
| 619 | set TERM2 [expr {-0.02489 - 0.39499*$sth2 + \ |
---|
| 620 | 1.219077*pow($sth2,1.5) - 1.31268*pow($sth2,2) + \ |
---|
| 621 | 0.871081*pow($sth2,2.5) - 0.2327*pow($sth2,3) }] |
---|
| 622 | set TERM3 [expr { 0.003045+0.018167*$sth2 - 0.03305*pow($sth2,2) }] |
---|
| 623 | set TRANS [expr { -$TERM0*$murl - $TERM1*pow($murl,2) - \ |
---|
| 624 | $TERM2*pow($murl,3) - $TERM3*pow($murl,4) }] |
---|
| 625 | if {$TRANS <= -20.0} { |
---|
| 626 | set TRANS 2.06E-9 |
---|
| 627 | } elseif {$TRANS >= 20.0} { |
---|
| 628 | set TRANS 4.85E8 |
---|
| 629 | } else { |
---|
| 630 | set TRANS [expr {exp($TRANS)}] |
---|
| 631 | } |
---|
| 632 | } else { |
---|
| 633 | set TERM1 [expr { 1.433902 + 11.07504*$sth2 - \ |
---|
| 634 | 8.77629*pow($sth2,2) + 10.02088*pow($sth2,3) - \ |
---|
| 635 | 3.36778*pow($sth2,4) }] |
---|
| 636 | set TERM2 [expr { (0.013869 - 0.01249*$sth2) * \ |
---|
| 637 | exp(3.27094*$sth2) + \ |
---|
| 638 | (0.337894 + 13.77317*$sth2) / \ |
---|
| 639 | pow((1.0+11.53544*$sth2),1.555039) }] |
---|
| 640 | set TERM3 [expr { 1.933433 / pow((1.0+23.12967*$sth2),1.686715) - \ |
---|
| 641 | 0.13576*sqrt($sth2) + 1.163198}] |
---|
| 642 | set TERM4 [expr { 0.044365 - 0.4259 / \ |
---|
| 643 | pow((1.0+0.41051*$sth2),148.4202) }] |
---|
| 644 | set TRANS [expr { ($TERM1-$TERM4) / \ |
---|
| 645 | pow((1.0+$TERM2*($murl-3.0)),$TERM3) + $TERM4 }] |
---|
| 646 | set TRANS [expr { $TRANS/100.0}] |
---|
| 647 | } |
---|
| 648 | } elseif {$mode == 1} { |
---|
| 649 | #!Simple linear absorption |
---|
| 650 | set TRANS [expr { -$abscor1*$lamb }] |
---|
| 651 | set TRANS [expr { exp($TRANS) }] |
---|
| 652 | } elseif {$mode == 2} { |
---|
| 653 | #!Pitschke, Hermann & Muttern - surface roughness |
---|
| 654 | set TERM1 [expr { 1.0/$sth-$abscor2/$sth2 }] |
---|
| 655 | set TERM2 [expr { 1.0-$abscor1*(1.0+$abscor2) }] |
---|
| 656 | set TRANS [expr { (1.0-$abscor1*$TERM1)/$TERM2 }] |
---|
| 657 | } elseif {$mode == 3} { |
---|
| 658 | #!Suortti - surface roughness |
---|
| 659 | set TERM1 [expr { exp(-$abscor2/$sth) }] |
---|
| 660 | set TERM2 [expr { $abscor1 + (1.0-$abscor1) * exp(-$abscor2) }] |
---|
| 661 | set TRANS [expr { ($abscor1 +(1.0-$abscor1) * $TERM1)/$TERM2 }] |
---|
| 662 | } elseif {$mode == 4} { |
---|
| 663 | #!Plate transmission absorption |
---|
| 664 | if {abs($abscor2) < 1} { |
---|
| 665 | #!Use symmetric fxn. if phi 1 deg or less |
---|
| 666 | set TRANS [expr { -$abscor1*$lamb/$cth }] |
---|
| 667 | set TRANS [expr { exp($TRANS) }] |
---|
| 668 | } else { |
---|
| 669 | #!Bigger tilts |
---|
| 670 | set SPH [expr { sin($pi/180. * $abscor2) }] |
---|
| 671 | set CPH [expr { cos($pi/180. * $abscor2) }] |
---|
| 672 | set CTPP [expr { $CPH*$cth - $SPH*$sth }] |
---|
| 673 | set CTMP [expr { $CPH*$cth + $SPH*$sth }] |
---|
| 674 | set T [expr { -$abscor1*$lamb }] |
---|
| 675 | set T1 [expr { $T / $CTPP }] |
---|
| 676 | set TRANS1 [expr { exp($T1) }] |
---|
| 677 | set T2 [expr { $T/$CTMP }] |
---|
| 678 | set TRANS2 [expr { exp($T2) }] |
---|
| 679 | set TB [expr { $T * (1.0 - $CTMP / $CTPP) }] |
---|
| 680 | set TRANS [expr { ($TRANS1 - $TRANS2) / $TB }] |
---|
| 681 | } |
---|
| 682 | } |
---|
| 683 | return $TRANS |
---|
| 684 | } |
---|
| 685 | |
---|
| 686 | # save some of the global options in ~/.gsas_config |
---|
| 687 | proc SaveOptions {} { |
---|
| 688 | global graph tcl_platform |
---|
| 689 | if {$tcl_platform(platform) == "windows"} { |
---|
| 690 | set fp [open c:/gsas.config a] |
---|
| 691 | } else { |
---|
| 692 | set fp [open [file join ~ .gsas_config] a] |
---|
| 693 | } |
---|
| 694 | puts $fp "# WIDPLT saved options from [clock format [clock ticks]]" |
---|
| 695 | puts $fp "set graph(legend) [list $graph(legend)]" |
---|
| 696 | puts $fp "set graph(printout) [list $graph(printout)]" |
---|
| 697 | puts $fp "set graph(outname) [list $graph(outname)]" |
---|
| 698 | puts $fp "set graph(outcmd) [list $graph(outcmd)]" |
---|
| 699 | puts $fp "set graph(plotunits) [list $graph(plotunits)]" |
---|
| 700 | puts $fp "set graph(equivwave) [list $graph(equivwave)]" |
---|
| 701 | close $fp |
---|
| 702 | } |
---|
| 703 | |
---|
| 704 | proc MakeCascadeMenus {} { |
---|
| 705 | global WidSetList lblarr box absSetList ABS |
---|
| 706 | .a.plot.menu delete 0 end |
---|
| 707 | .a.file.menu.edit delete 0 end |
---|
| 708 | global program |
---|
| 709 | if {$program != "absplt"} { |
---|
| 710 | foreach item $WidSetList { |
---|
| 711 | .a.plot.menu add checkbutton -label $lblarr($item) \ |
---|
| 712 | -command "plotdata $box" -variable WidDisplay($item) |
---|
| 713 | .a.file.menu.edit add command -label $lblarr($item) \ |
---|
| 714 | -command "editProfileValues $item" |
---|
| 715 | } |
---|
| 716 | } else { |
---|
| 717 | foreach item $absSetList { |
---|
| 718 | .a.plot.menu add checkbutton -label [lindex $ABS($item) 4] \ |
---|
| 719 | -command "plotdata $box" -variable AbsDisplay($item) |
---|
| 720 | .a.file.menu.edit add command -label [lindex $ABS($item) 4] \ |
---|
| 721 | -command "editAbsValues $item" |
---|
| 722 | } |
---|
| 723 | } |
---|
| 724 | } |
---|
| 725 | #------------------------------------------------------------------------- |
---|
| 726 | # converts 2theta(deg) to Q (A-1) |
---|
| 727 | proc tt2Q {lambda twotheta} { |
---|
| 728 | set pi 3.14159 |
---|
| 729 | set torad [expr $pi / 360.] |
---|
| 730 | return [expr 4 * $pi / ($lambda) * sin (($twotheta) * $torad)] |
---|
| 731 | } |
---|
| 732 | |
---|
| 733 | # converts Q (A-1) to 2theta(deg) |
---|
| 734 | proc Q2tt {lambda Q} { |
---|
| 735 | set pi 3.14159 |
---|
| 736 | set todeg [expr 360. / $pi] |
---|
| 737 | set asinarg [expr ($lambda) * $Q * 0.25 / $pi] |
---|
| 738 | if {$asinarg <= 1} { |
---|
| 739 | return [expr $todeg * asin ($asinarg)] |
---|
| 740 | } |
---|
| 741 | return {} |
---|
| 742 | } |
---|
| 743 | |
---|
| 744 | # converts a FWHM in 2theta(deg) to a FWHM in Q (A-1) |
---|
| 745 | proc deltaQ {lambda twotheta FWHM} { |
---|
| 746 | return [expr [tt2Q $lambda $twotheta+($FWHM/2.)] - \ |
---|
| 747 | [tt2Q $lambda $twotheta-($FWHM/2.)] ] |
---|
| 748 | } |
---|
| 749 | |
---|
| 750 | # converts 2theta(deg) to d (A) |
---|
| 751 | proc tt2d {lambda twotheta} { |
---|
| 752 | set pi 3.14159 |
---|
| 753 | set torad [expr $pi / 360.] |
---|
| 754 | return [expr 0.5 * ($lambda) / sin (($twotheta) * $torad)] |
---|
| 755 | } |
---|
| 756 | |
---|
| 757 | # converts d (A) to 2theta(deg) |
---|
| 758 | proc d2tt {lambda d} { |
---|
| 759 | set pi 3.14159 |
---|
| 760 | set todeg [expr 360. / $pi] |
---|
| 761 | set asinarg [expr ($lambda) * 0.5 / $d] |
---|
| 762 | if {$asinarg <= 1} { |
---|
| 763 | return [expr $todeg * asin ($asinarg)] |
---|
| 764 | } |
---|
| 765 | return {} |
---|
| 766 | } |
---|
| 767 | |
---|
| 768 | # converts a FWHM in 2theta(deg) to a FWHM in Q (A-1) |
---|
| 769 | proc deltad {lambda twotheta FWHM} { |
---|
| 770 | return [expr [tt2d $lambda $twotheta-($FWHM/2.)] - \ |
---|
| 771 | [tt2d $lambda $twotheta+($FWHM/2.)] ] |
---|
| 772 | } |
---|
| 773 | |
---|
| 774 | # computes an equivalent 2theta at a different wavelength |
---|
| 775 | proc ttequiv {lambda twotheta lambda_eq} { |
---|
| 776 | return [Q2tt $lambda_eq [tt2Q $lambda $twotheta]] |
---|
| 777 | } |
---|
| 778 | |
---|
| 779 | # converts a FWHM in 2theta(deg) to a FWHM at in 2theta |
---|
| 780 | # at a different wavelength |
---|
| 781 | proc delta2teq {lambda twotheta FWHM lambda_eq} { |
---|
| 782 | return [expr [Q2tt $lambda_eq [tt2Q $lambda $twotheta+($FWHM/2.)]] - \ |
---|
| 783 | [Q2tt $lambda_eq [tt2Q $lambda $twotheta-($FWHM/2.)]] ] |
---|
| 784 | } |
---|
| 785 | |
---|
| 786 | # convert x values to d-space |
---|
| 787 | proc tod {xlist hst} { |
---|
| 788 | global expmap |
---|
| 789 | if {[string range $expmap(htype_$hst) 2 2] == "T"} { |
---|
| 790 | return [toftod $xlist $hst] |
---|
| 791 | } elseif {[string range $expmap(htype_$hst) 2 2] == "C"} { |
---|
| 792 | return [tttod $xlist $hst] |
---|
| 793 | } elseif {[string range $expmap(htype_$hst) 2 2] == "E"} { |
---|
| 794 | return [engtod $xlist $hst] |
---|
| 795 | } else { |
---|
| 796 | return {} |
---|
| 797 | } |
---|
| 798 | } |
---|
| 799 | |
---|
| 800 | # convert tof to d-space |
---|
| 801 | proc toftod {toflist hst} { |
---|
| 802 | set difc [expr {[histinfo $hst difc]/1000.}] |
---|
| 803 | set difc2 [expr {$difc*$difc}] |
---|
| 804 | set difa [expr {[histinfo $hst difa]/1000.}] |
---|
| 805 | set zero [expr {[histinfo $hst zero]/1000.}] |
---|
| 806 | set ans {} |
---|
| 807 | foreach tof $toflist { |
---|
| 808 | if {$tof == 0.} { |
---|
| 809 | lappend ans 0. |
---|
| 810 | } elseif {$tof == 1000.} { |
---|
| 811 | lappend ans 1000. |
---|
| 812 | } else { |
---|
| 813 | set td [expr {$tof-$zero}] |
---|
| 814 | lappend ans [expr {$td*($difc2+$difa*$td)/ \ |
---|
| 815 | ($difc2*$difc+2.0*$difa*$td)}] |
---|
| 816 | } |
---|
| 817 | } |
---|
| 818 | return $ans |
---|
| 819 | } |
---|
| 820 | |
---|
| 821 | # convert two-theta to d-space |
---|
| 822 | proc tttod {twotheta hst} { |
---|
| 823 | set lamo2 [expr {0.5 * [histinfo $hst lam1]}] |
---|
| 824 | set zero [expr [histinfo $hst zero]/100.] |
---|
| 825 | set ans {} |
---|
| 826 | set cnv [expr {acos(0.)/180.}] |
---|
| 827 | foreach tt $twotheta { |
---|
| 828 | if {$tt == 0.} { |
---|
| 829 | lappend ans 99999. |
---|
| 830 | } elseif {$tt == 1000.} { |
---|
| 831 | lappend ans 0. |
---|
| 832 | } else { |
---|
| 833 | lappend ans [expr {$lamo2 / sin($cnv*($tt-$zero))}] |
---|
| 834 | } |
---|
| 835 | } |
---|
| 836 | return $ans |
---|
| 837 | } |
---|
| 838 | |
---|
| 839 | # convert energy (edx-ray) to d-space |
---|
| 840 | # (note that this ignores the zero correction) |
---|
| 841 | proc engtod {eng hst} { |
---|
| 842 | set lam [histinfo $hst lam1] |
---|
| 843 | set zero [histinfo $hst zero] |
---|
| 844 | set ans {} |
---|
| 845 | set v [expr {12.398/(2.0*[sind[expr ($lam/2.0)]])}] |
---|
| 846 | foreach e $eng { |
---|
| 847 | if {$e == 0.} { |
---|
| 848 | lappend ans 1000. |
---|
| 849 | } elseif {$e == 1000.} { |
---|
| 850 | lappend ans 0. |
---|
| 851 | } else { |
---|
| 852 | lappend ans [expr {$v/$e}] |
---|
| 853 | } |
---|
| 854 | } |
---|
| 855 | return $ans |
---|
| 856 | } |
---|
| 857 | |
---|
| 858 | # convert x values to Q |
---|
| 859 | proc toQ {xlist hst} { |
---|
| 860 | global expmap |
---|
| 861 | if {[string range $expmap(htype_$hst) 2 2] == "T"} { |
---|
| 862 | return [toftoQ $xlist $hst] |
---|
| 863 | } elseif {[string range $expmap(htype_$hst) 2 2] == "C"} { |
---|
| 864 | return [tttoQ $xlist $hst] |
---|
| 865 | } elseif {[string range $expmap(htype_$hst) 2 2] == "E"} { |
---|
| 866 | return [engtoQ $xlist $hst] |
---|
| 867 | } else { |
---|
| 868 | return {} |
---|
| 869 | } |
---|
| 870 | } |
---|
| 871 | # convert tof to Q |
---|
| 872 | proc toftoQ {toflist hst} { |
---|
| 873 | set difc [expr {[histinfo $hst difc]/1000.}] |
---|
| 874 | set difc2 [expr {$difc*$difc}] |
---|
| 875 | set difa [expr {[histinfo $hst difa]/1000.}] |
---|
| 876 | set zero [expr {[histinfo $hst zero]/1000.}] |
---|
| 877 | set 2pi [expr {4.*acos(0.)}] |
---|
| 878 | set ans {} |
---|
| 879 | foreach tof $toflist { |
---|
| 880 | if {$tof == 0.} { |
---|
| 881 | lappend ans 99999. |
---|
| 882 | } elseif {$tof == 1000.} { |
---|
| 883 | lappend ans 0. |
---|
| 884 | } else { |
---|
| 885 | set td [expr {$tof-$zero}] |
---|
| 886 | lappend ans [expr {$2pi * \ |
---|
| 887 | ($difc2*$difc+2.0*$difa*$td)/($td*($difc2+$difa*$td))}] |
---|
| 888 | } |
---|
| 889 | } |
---|
| 890 | return $ans |
---|
| 891 | } |
---|
| 892 | |
---|
| 893 | # convert two-theta to Q |
---|
| 894 | proc tttoQ {twotheta hst} { |
---|
| 895 | set lamo2 [expr {0.5 * [histinfo $hst lam1]}] |
---|
| 896 | set zero [expr [histinfo $hst zero]/100.] |
---|
| 897 | set ans {} |
---|
| 898 | set cnv [expr {acos(0.)/180.}] |
---|
| 899 | set 2pi [expr {4.*acos(0.)}] |
---|
| 900 | foreach tt $twotheta { |
---|
| 901 | if {$tt == 0.} { |
---|
| 902 | lappend ans 0. |
---|
| 903 | } elseif {$tt == 1000.} { |
---|
| 904 | lappend ans 1000. |
---|
| 905 | } else { |
---|
| 906 | lappend ans [expr {$2pi * sin($cnv*($tt-$zero)) / $lamo2}] |
---|
| 907 | } |
---|
| 908 | } |
---|
| 909 | return $ans |
---|
| 910 | } |
---|
| 911 | # convert energy (edx-ray) to Q |
---|
| 912 | # (note that this ignores the zero correction) |
---|
| 913 | proc engtoQ {eng hst} { |
---|
| 914 | set lam [histinfo $hst lam1] |
---|
| 915 | set zero [histinfo $hst zero] |
---|
| 916 | set ans {} |
---|
| 917 | set v [expr {12.398/(2.0*[sind[expr ($lam/2.0)]])}] |
---|
| 918 | set 2pi [expr {4.*acos(0.)}] |
---|
| 919 | foreach e $eng { |
---|
| 920 | if {$e == 0.} { |
---|
| 921 | lappend ans 0. |
---|
| 922 | } elseif {$e == 1000.} { |
---|
| 923 | lappend ans 1000. |
---|
| 924 | } else { |
---|
| 925 | lappend ans [expr {$2pi * $e / $v}] |
---|
| 926 | } |
---|
| 927 | } |
---|
| 928 | return $ans |
---|
| 929 | } |
---|
| 930 | proc sind {angle} { |
---|
| 931 | return [expr {sin($angle*acos(0.)/90.)}] |
---|
| 932 | } |
---|
| 933 | |
---|
| 934 | proc FWHM {tt U V W P} { |
---|
| 935 | set pi 3.14159 |
---|
| 936 | set torad [expr $pi / 360.] |
---|
| 937 | # tan theta |
---|
| 938 | set tantt [expr tan($tt * $torad ) ] |
---|
| 939 | set costt [expr cos($tt * $torad ) ] |
---|
| 940 | return [expr sqrt \ |
---|
| 941 | (8.* log(2) * ($U * $tantt * $tantt + $V * $tantt + $W \ |
---|
| 942 | + $P / ($costt * $costt))) / 100.] |
---|
| 943 | } |
---|
| 944 | proc LFWHM {tt X Y} { |
---|
| 945 | set pi 3.14159 |
---|
| 946 | set torad [expr $pi / 360.] |
---|
| 947 | # tan theta |
---|
| 948 | set tantt [expr tan($tt * $torad ) ] |
---|
| 949 | set costt [expr cos($tt * $torad ) ] |
---|
| 950 | return [expr ($X / $costt + $Y * $tantt) / 100.] |
---|
| 951 | } |
---|
| 952 | |
---|
| 953 | proc setlegend {box legend} { |
---|
| 954 | global blt_version |
---|
| 955 | if {$blt_version >= 2.3 && $blt_version < 8.0} { |
---|
| 956 | if $legend { |
---|
| 957 | $box legend config -hide no |
---|
| 958 | } else { |
---|
| 959 | $box legend config -hide yes |
---|
| 960 | } |
---|
| 961 | } else { |
---|
| 962 | if $legend { |
---|
| 963 | $box legend config -mapped yes |
---|
| 964 | } else { |
---|
| 965 | $box legend config -mapped no |
---|
| 966 | } |
---|
| 967 | } |
---|
| 968 | } |
---|
| 969 | |
---|
| 970 | #------------------------------------------------------------------------- |
---|
| 971 | # export current plot to Grace |
---|
| 972 | #------------------------------------------------------------------------- |
---|
| 973 | if {$tcl_platform(platform) == "unix"} { |
---|
| 974 | set graph(GraceFile) /tmp/grace_out.agr |
---|
| 975 | } else { |
---|
| 976 | set graph(GraceFile) C:/graceout.agr |
---|
| 977 | } |
---|
| 978 | proc exportgrace {} { |
---|
| 979 | global graph box |
---|
| 980 | global tcl_platform graph |
---|
| 981 | catch {toplevel .export} |
---|
| 982 | raise .export |
---|
| 983 | eval destroy [grid slaves .export] |
---|
| 984 | set col 5 |
---|
| 985 | grid [label .export.1a -text Title:] -column 1 -row 1 |
---|
| 986 | set graph(title) [$box cget -title] |
---|
| 987 | grid [entry .export.1b -width 60 -textvariable graph(title)] \ |
---|
| 988 | -column 2 -row 1 -columnspan 4 |
---|
| 989 | grid [label .export.2a -text Subtitle:] -column 1 -row 2 |
---|
| 990 | grid [entry .export.2b -width 60 -textvariable graph(subtitle)] \ |
---|
| 991 | -column 2 -row 2 -columnspan 4 |
---|
| 992 | grid [label .export.3a -text "File name:"] -column 1 -row 3 |
---|
| 993 | grid [entry .export.3b -width 60 -textvariable graph(GraceFile)] \ |
---|
| 994 | -column 2 -row 3 -columnspan 4 |
---|
| 995 | grid [button .export.help -text Help -bg yellow \ |
---|
| 996 | -command "MakeWWWHelp liveplot.html grace"] \ |
---|
| 997 | -column [incr col -1] -row 4 |
---|
| 998 | grid [button .export.c -text "Close" \ |
---|
| 999 | -command "set graph(export) 0; destroy .export"] \ |
---|
| 1000 | -column [incr col -1] -row 4 |
---|
| 1001 | if {$tcl_platform(platform) == "unix" && [auto_execok xmgrace] != ""} { |
---|
| 1002 | grid [button .export.d -text "Export & \nstart grace" \ |
---|
| 1003 | -command "set graph(export) 1; destroy .export"] \ |
---|
| 1004 | -column [incr col -1] -row 4 |
---|
| 1005 | } |
---|
| 1006 | grid [button .export.e -text "Export" \ |
---|
| 1007 | -command "set graph(export) 2; destroy .export"] \ |
---|
| 1008 | -column [incr col -1] -row 4 |
---|
| 1009 | tkwait window .export |
---|
| 1010 | if {$graph(export) == 0} return |
---|
| 1011 | if {[catch { |
---|
| 1012 | set fp [open $graph(GraceFile) w] |
---|
| 1013 | puts $fp [output_grace $box $graph(title) $graph(subtitle)] |
---|
| 1014 | close $fp |
---|
| 1015 | } errmsg]} { |
---|
| 1016 | MyMessageBox -parent . -title "Export Error" \ |
---|
| 1017 | -message "An error occured during the export: $errmsg" \ |
---|
| 1018 | -icon error -type Ignore -default ignore |
---|
| 1019 | return |
---|
| 1020 | } |
---|
| 1021 | |
---|
| 1022 | if {$graph(export) == 1} { |
---|
| 1023 | set err [catch {exec xmgrace $graph(GraceFile) &} errmsg] |
---|
| 1024 | if $err { |
---|
| 1025 | MyMessageBox -parent . -title "Grace Error" \ |
---|
| 1026 | -message "An error occured launching grace (xmgrace): $errmsg" \ |
---|
| 1027 | -icon error -type Ignore -default ignore |
---|
| 1028 | } |
---|
| 1029 | } else { |
---|
| 1030 | MyMessageBox -parent . -title "OK" \ |
---|
| 1031 | -message "File $graph(GraceFile) created" \ |
---|
| 1032 | -type OK -default ok |
---|
| 1033 | } |
---|
| 1034 | } |
---|
| 1035 | #------------------------------------------------------------------------- |
---|
| 1036 | # export current plot as .csv file |
---|
| 1037 | #------------------------------------------------------------------------- |
---|
| 1038 | proc makecsvfile {} { |
---|
| 1039 | global graph box expnam program |
---|
| 1040 | global tcl_platform graph |
---|
| 1041 | set typelist { |
---|
| 1042 | {{Comma separated} {.csv} } |
---|
| 1043 | {{Text File} {.txt} } |
---|
| 1044 | } |
---|
| 1045 | set file [tk_getSaveFile -filetypes $typelist \ |
---|
| 1046 | -initialfile ${expnam}_$program.csv] |
---|
| 1047 | if {$file == ""} return |
---|
| 1048 | set varlist {} |
---|
| 1049 | set line {} |
---|
| 1050 | foreach element_name [$box element names] { |
---|
| 1051 | lappend varlist ${element_name}_x |
---|
| 1052 | set ${element_name}_x [$box element cget $element_name -xdata] |
---|
| 1053 | lappend varlist ${element_name}_y |
---|
| 1054 | set ${element_name}_y [$box element cget $element_name -ydata] |
---|
| 1055 | append line [$box element cget $element_name -label] "-X, " |
---|
| 1056 | append line [$box element cget $element_name -label] "-Y, " |
---|
| 1057 | } |
---|
| 1058 | set fp [open $file w] |
---|
| 1059 | # get x and y axis limits |
---|
| 1060 | foreach v {x y} { |
---|
| 1061 | foreach "${v}min ${v}max" [$box ${v}axis limits] {} |
---|
| 1062 | puts $fp "\"$v axis range [set ${v}min] to [set ${v}max]\"" |
---|
| 1063 | puts $fp "\"$v axis label [$box ${v}axis cget -title]\"" |
---|
| 1064 | } |
---|
| 1065 | puts $fp $line |
---|
| 1066 | set i 0 |
---|
| 1067 | set done 1 |
---|
| 1068 | while {$done} { |
---|
| 1069 | set line {} |
---|
| 1070 | set done 0 |
---|
| 1071 | foreach var $varlist { |
---|
| 1072 | set val [lindex [set $var] $i] |
---|
| 1073 | if {$val != ""} {set done 1} |
---|
| 1074 | append line "$val, " |
---|
| 1075 | } |
---|
| 1076 | if {$done} {puts $fp $line} |
---|
| 1077 | incr i |
---|
| 1078 | } |
---|
| 1079 | close $fp |
---|
| 1080 | } |
---|
| 1081 | |
---|
| 1082 | |
---|
| 1083 | set graph(legend) 0 |
---|
| 1084 | set graph(equivwave) {} |
---|
| 1085 | set graph(plotunits) tt |
---|
| 1086 | if {$tcl_platform(platform) == "windows"} { |
---|
| 1087 | set graph(printout) 1 |
---|
| 1088 | } else { |
---|
| 1089 | set graph(printout) 0 |
---|
| 1090 | } |
---|
| 1091 | set graph(outname) out.ps |
---|
| 1092 | set graph(outcmd) lpr |
---|
| 1093 | set WidSetList {} |
---|
| 1094 | set absSetList {} |
---|
| 1095 | |
---|
| 1096 | #---------------------------------------------------------------- |
---|
| 1097 | # find location of other files relative to the current script |
---|
| 1098 | # 1st, translate links -- go six levels deep |
---|
| 1099 | foreach i {1 2 3 4 5 6} { |
---|
| 1100 | if {[file type $expgui(script)] == "link"} { |
---|
| 1101 | set link [file readlink $expgui(script)] |
---|
| 1102 | if { [file pathtype $link] == "absolute" } { |
---|
| 1103 | h set expgui(script) $link |
---|
| 1104 | } { |
---|
| 1105 | set expgui(script) [file dirname $expgui(script)]/$link |
---|
| 1106 | } |
---|
| 1107 | } else { |
---|
| 1108 | break |
---|
| 1109 | } |
---|
| 1110 | } |
---|
| 1111 | # fixup relative paths |
---|
| 1112 | if {[file pathtype $expgui(script)] == "relative"} { |
---|
| 1113 | set expgui(script) [file join [pwd] $expgui(script)] |
---|
| 1114 | } |
---|
| 1115 | set expgui(scriptdir) [file dirname $expgui(script) ] |
---|
| 1116 | set expgui(docdir) [file join $expgui(scriptdir) doc] |
---|
| 1117 | # location for web pages, if not found locally |
---|
[953] | 1118 | set expgui(website) 11bm.xor.aps.anl.gov/expguidoc/ |
---|
[931] | 1119 | |
---|
| 1120 | # fetch EXP file processing routines |
---|
| 1121 | source [file join $expgui(scriptdir) readexp.tcl] |
---|
| 1122 | source [file join $expgui(scriptdir) gsascmds.tcl] |
---|
| 1123 | |
---|
| 1124 | # override options with locally defined values |
---|
| 1125 | set filelist [file join $expgui(scriptdir) localconfig] |
---|
| 1126 | if {$tcl_platform(platform) == "windows"} { |
---|
| 1127 | lappend filelist "c:/gsas.config" |
---|
| 1128 | } else { |
---|
| 1129 | lappend filelist [file join ~ .gsas_config] |
---|
| 1130 | } |
---|
| 1131 | if {[catch { |
---|
| 1132 | foreach file $filelist { |
---|
| 1133 | if [file exists $file] {source $file} |
---|
| 1134 | } |
---|
| 1135 | } errmsg]} { |
---|
| 1136 | set msg "Error reading file $file (aka [file nativename $file]): $errmsg" |
---|
| 1137 | MyMessageBox -parent . -title "Customize warning" \ |
---|
| 1138 | -message $msg -icon warning -type Ignore -default ignore \ |
---|
| 1139 | -helplink "expguierr.html Customizewarning" |
---|
| 1140 | } |
---|
| 1141 | #---------------------------------------------------------------- |
---|
| 1142 | |
---|
| 1143 | set datalist {} |
---|
| 1144 | if {$program != "absplt"} { |
---|
| 1145 | foreach file [glob -nocomplain [file join [pwd] widplt_*]] { |
---|
| 1146 | source $file |
---|
| 1147 | } |
---|
| 1148 | foreach file [glob -nocomplain [file join $expgui(scriptdir) widplt_*]] { |
---|
| 1149 | source $file |
---|
| 1150 | } |
---|
| 1151 | set WidSetList $datalist |
---|
| 1152 | } |
---|
| 1153 | |
---|
| 1154 | # create the graph |
---|
| 1155 | if [catch { |
---|
| 1156 | set box [graph .g] |
---|
| 1157 | } errmsg] { |
---|
| 1158 | tk_dialog .err "BLT Error" \ |
---|
| 1159 | "BLT Setup Error: could not create a graph (msg: $errmsg). \ |
---|
| 1160 | There is a problem with the setup of BLT on your system. |
---|
| 1161 | See the expgui.html file for more info." \ |
---|
| 1162 | error 0 "Quit" |
---|
| 1163 | exit |
---|
| 1164 | } |
---|
| 1165 | if [catch { |
---|
| 1166 | Blt_ZoomStack $box |
---|
| 1167 | Blt_ActiveLegend $box |
---|
| 1168 | Blt_ClosestPoint $box |
---|
| 1169 | } errmsg] { |
---|
| 1170 | tk_dialog .err "BLT Error" \ |
---|
| 1171 | "BLT Setup Error: could not access a Blt_ routine (msg: $errmsg). \ |
---|
| 1172 | The pkgIndex.tcl is probably not loading bltGraph.tcl. |
---|
| 1173 | See the expgui.html file for more info." \ |
---|
| 1174 | error 0 "Limp ahead" |
---|
| 1175 | } |
---|
| 1176 | $box config -title {} |
---|
| 1177 | setlegend $box $graph(legend) |
---|
| 1178 | |
---|
| 1179 | #frame .a -bd 8 -relief groove |
---|
| 1180 | frame .a -bd 2 -relief groove |
---|
| 1181 | |
---|
| 1182 | pack [menubutton .a.file -text File -underline 0 -menu .a.file.menu] -side left |
---|
| 1183 | menu .a.file.menu |
---|
| 1184 | pack [menubutton .a.plot -text "Plot Contents" -underline 0 -menu .a.plot.menu] -side left |
---|
| 1185 | menu .a.plot.menu |
---|
| 1186 | #.a.file.menu add cascade -label Tickmarks -menu .a.file.menu.tick |
---|
| 1187 | if {$expnam != ""} { |
---|
| 1188 | .a.file.menu add command -label "Reload from EXP" \ |
---|
| 1189 | -command "getprofiles $expnam; plotdata $box" |
---|
| 1190 | } |
---|
| 1191 | if {$program == "absplt"} { |
---|
| 1192 | .a.file.menu add cascade -label "Edit Abs Params" -menu .a.file.menu.edit |
---|
| 1193 | } else { |
---|
| 1194 | .a.file.menu add command -label "Add New Curve" -command NewProfileValues |
---|
| 1195 | .a.file.menu add cascade -label "Edit Curve" -menu .a.file.menu.edit |
---|
| 1196 | } |
---|
| 1197 | #.a.file.menu add command -label "Make PostScript" -command makepostscriptout |
---|
| 1198 | menu .a.file.menu.edit |
---|
| 1199 | .a.file.menu add cascade -label "Export plot" -menu .a.file.menu.export |
---|
| 1200 | menu .a.file.menu.export |
---|
| 1201 | .a.file.menu.export add command -label "Make PostScript" \ |
---|
| 1202 | -command makepostscriptout |
---|
| 1203 | if {$blt_version > 2.3 && $blt_version != 8.0} { |
---|
| 1204 | source [file join $expgui(scriptdir) graceexport.tcl] |
---|
| 1205 | .a.file.menu.export add command -label "to Grace" -command exportgrace |
---|
| 1206 | } |
---|
| 1207 | .a.file.menu.export add command -label "as .csv file" \ |
---|
| 1208 | -command makecsvfile |
---|
| 1209 | .a.file.menu add command -label Quit -command "destroy ." |
---|
| 1210 | pack [menubutton .a.options -text Options -underline 0 -menu .a.options.menu] \ |
---|
| 1211 | -side left |
---|
| 1212 | menu .a.options.menu |
---|
| 1213 | if {$program == "absplt"} { |
---|
| 1214 | .a.options.menu add radiobutton -label "2Theta/Tof/Eng" -value tt \ |
---|
| 1215 | -variable graph(plotunits) \ |
---|
| 1216 | -command "plotdata $box" |
---|
| 1217 | } else { |
---|
| 1218 | .a.options.menu add radiobutton -label "2Theta" -value tt \ |
---|
| 1219 | -variable graph(plotunits) \ |
---|
| 1220 | -command "plotdata $box" |
---|
| 1221 | .a.options.menu add command -label "Set Equiv. Wavelength" \ |
---|
| 1222 | -command "seteqwave $box" |
---|
| 1223 | } |
---|
| 1224 | .a.options.menu add radiobutton -label "d-space" -value d \ |
---|
| 1225 | -variable graph(plotunits) \ |
---|
| 1226 | -command "plotdata $box" |
---|
| 1227 | .a.options.menu add radiobutton -label "Q" -value q \ |
---|
| 1228 | -variable graph(plotunits) \ |
---|
| 1229 | -command "plotdata $box" |
---|
| 1230 | .a.options.menu add checkbutton -label "Include legend" \ |
---|
| 1231 | -variable graph(legend) \ |
---|
| 1232 | -command {setlegend $box $graph(legend)} |
---|
| 1233 | .a.options.menu add command -label "Set PS output" \ |
---|
| 1234 | -command setpostscriptout |
---|
| 1235 | .a.options.menu add command -label "Save Options" -underline 1 \ |
---|
| 1236 | -command "SaveOptions" |
---|
| 1237 | |
---|
| 1238 | pack [menubutton .a.help -text Help -underline 0 -menu .a.help.menu] -side right |
---|
| 1239 | menu .a.help.menu -tearoff 0 |
---|
| 1240 | if {$program == "absplt"} { |
---|
| 1241 | .a.help.menu add command -command "MakeWWWHelp expgui.html ABSPLT" \ |
---|
| 1242 | -label "Web page" |
---|
| 1243 | } else { |
---|
| 1244 | .a.help.menu add command -command "MakeWWWHelp expgui.html WIDPLT" \ |
---|
| 1245 | -label "Web page" |
---|
| 1246 | } |
---|
| 1247 | if {![catch {package require tkcon} errmsg]} { |
---|
| 1248 | .a.help.menu add command -label "Open console" -command {tkcon show} |
---|
| 1249 | } elseif {$tcl_platform(platform) == "windows"} { |
---|
| 1250 | .a.help.menu add command -label "Open console" -command {console show} |
---|
| 1251 | } |
---|
| 1252 | .a.help.menu add command -command aboutwidplot -label About |
---|
| 1253 | |
---|
| 1254 | pack .a -side top -fill both |
---|
| 1255 | pack $box -fill both -expand yes |
---|
| 1256 | |
---|
| 1257 | #---------------------------------------------------------------- |
---|
| 1258 | # OK now go get the profile info |
---|
| 1259 | getprofiles $expnam |
---|
| 1260 | #---------------------------------------------------------------- |
---|
| 1261 | |
---|
| 1262 | trace variable newmenu(opt) w setoptmsg |
---|
| 1263 | |
---|
| 1264 | proc setoptmsg {args} { |
---|
| 1265 | global newmenu |
---|
| 1266 | array set opttxt { |
---|
| 1267 | 0 "Cylindrical samples, Lobanov & Alte da Veiga (TOF, CW, synch.)" |
---|
| 1268 | 1 "Simple linear (TOF)" |
---|
| 1269 | 2 "Surface Roughness, Pitschke, Hermann & Muttern (Bragg-Brentano)" |
---|
| 1270 | 3 "Surface Roughness, Suortti (Bragg-Brentano)" |
---|
| 1271 | 4 "Flat plate, transmission mode" |
---|
| 1272 | } |
---|
| 1273 | set newmenu(opttxt) "" |
---|
| 1274 | catch {set newmenu(opttxt) [set opttxt($newmenu(opt))]} |
---|
| 1275 | } |
---|
| 1276 | set datanum 0 |
---|
| 1277 | # seems to be needed in OSX |
---|
| 1278 | update |
---|
| 1279 | wm geom . [winfo reqwidth .]x[winfo reqheight .] |
---|
| 1280 | # |
---|
| 1281 | donewaitmsg |
---|