1 | #!/usr/local/bin/wish |
---|
2 | set expgui(Revision) {$Revision: 10 $ $Date: 2009-12-04 22:58:51 +0000 (Fri, 04 Dec 2009) $} |
---|
3 | |
---|
4 | # to do: |
---|
5 | # |
---|
6 | # global background editing & profile work differently: should both |
---|
7 | # start out blank with a "load from option"? |
---|
8 | # |
---|
9 | # menu for least squares options |
---|
10 | # idea: |
---|
11 | # a scroll list for all histogram refinement flags ; click on takes you to the |
---|
12 | # appropriate menu. |
---|
13 | # |
---|
14 | # to allow global access on phase page |
---|
15 | # change buttons from radio to multiple |
---|
16 | # -- or display all 9 cell flag/damps and all atoms |
---|
17 | # make editMultipleRecords work with multiple phases, also cell flag/damp |
---|
18 | # blank cell entries |
---|
19 | # add phase to atom number in listing |
---|
20 | # DisplayAllAtoms needs to loop over phases: expgui(curPhase) |
---|
21 | |
---|
22 | if {$argv != ""} { |
---|
23 | set expfile [lindex $argv 0] |
---|
24 | if {[string toupper [file extension $expfile]] != ".EXP"} { |
---|
25 | append expfile ".EXP" |
---|
26 | } |
---|
27 | } else { |
---|
28 | # windows needs this update or focus gets screwed up after tk_getOpenFile |
---|
29 | update |
---|
30 | set expfile [tk_getOpenFile -defaultextension .EXP \ |
---|
31 | -filetypes {{"GSAS Experiment" ".EXP"}} -parent .] |
---|
32 | } |
---|
33 | if {$expfile == ""} exit |
---|
34 | if ![file exists $expfile] { |
---|
35 | tk_dialog .expFileErrorMsg "File Open Error" \ |
---|
36 | "File $expfile does not exist" error 0 "Exit" |
---|
37 | exit |
---|
38 | } |
---|
39 | |
---|
40 | set expgui(debug) 0 |
---|
41 | catch {if $env(DEBUG) {set expgui(debug) 1}} |
---|
42 | #set expgui(debug) 1 |
---|
43 | |
---|
44 | set expgui(havetix) 1 |
---|
45 | # for debugging non-Tix version set environment variable NOTIX |
---|
46 | catch {if $env(NOTIX) {set expgui(havetix) 0}} |
---|
47 | if $expgui(havetix) { |
---|
48 | if [catch {package require Tix}] {set expgui(havetix) 0} |
---|
49 | } |
---|
50 | # default is archive = on |
---|
51 | set expgui(archive) 1 |
---|
52 | #---------------------------------------------------------------- |
---|
53 | # where are we? |
---|
54 | set expgui(script) [info script] |
---|
55 | # translate links -- go six levels deep |
---|
56 | foreach i {1 2 3 4 5 6} { |
---|
57 | if {[file type $expgui(script)] == "link"} { |
---|
58 | set link [file readlink $expgui(script)] |
---|
59 | if { [file pathtype $link] == "absolute" } { |
---|
60 | h set expgui(script) $link |
---|
61 | } { |
---|
62 | set expgui(script) [file dirname $expgui(script)]/$link |
---|
63 | } |
---|
64 | } else { |
---|
65 | break |
---|
66 | } |
---|
67 | } |
---|
68 | set expgui(scriptdir) [file dirname $expgui(script) ] |
---|
69 | #---------------------------------------------------------------- |
---|
70 | # fetch EXP routines |
---|
71 | source [file join $expgui(scriptdir) readexp.tcl] |
---|
72 | |
---|
73 | # constants |
---|
74 | set expgui(coordfont) "-*-courier-bold-r-normal--12-*" |
---|
75 | set expgui(histfont) "-*-courier-bold-r-normal--12-*" |
---|
76 | |
---|
77 | #============================================================================= |
---|
78 | # Store names of profile terms. |
---|
79 | array set expgui { |
---|
80 | prof-T-1 {TOF-type1 alp-0 bet-0 sig-0 alp-1 bet-1 sig-1 rstr rsta \ |
---|
81 | sig-2 rsca s1ec s2ec } |
---|
82 | prof-T-2 {TOF-type2 alp-0 sig-0 gam-0 alp-1 sig-1 gam-1 beta sig-2 \ |
---|
83 | gam-2 switch ptec stec difc difa zero } |
---|
84 | prof-T-3 {TOF-type3 alp bet-0 bet-1 sig-0 sig-1 sig-2 gam-0 gam-1 \ |
---|
85 | gam-2 gsf g1ec g2ec rstr rsta rsca L11 L22 L33 L12 L13 L23 } |
---|
86 | prof-T-4 {TOF-type4 alp bet-0 bet-1 sig-1 sig-2 gam-2 g2ec gsf \ |
---|
87 | rstr rsta rsca eta} |
---|
88 | prof-C-1 {CW-type U V W asym F1 F2 } |
---|
89 | prof-C-2 {CW-type2 GU GV GW LX LY trns asym shft GP stec ptec sfec \ |
---|
90 | L11 L22 L33 L12 L13 L23 } |
---|
91 | prof-C-3 {CW-type3 GU GV GW GP LX LY S/L H/L trns shft stec ptec sfec \ |
---|
92 | L11 L22 L33 L12 L13 L23 } |
---|
93 | prof-C-4 {CW-type4 GU GV GW GP LX ptec trns shft sfec S/L H/L eta} |
---|
94 | } |
---|
95 | # >>>>>>>>>>>>>>>> End of Profile Terms >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
96 | # |
---|
97 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
98 | # <<<<<<<<<< BEGINNING OF MAIN: GLOBAL AREA FOR DATA EXTRACTION >>>>>>>>>>> |
---|
99 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
100 | # load exp file and set up dialogs |
---|
101 | proc loadexp {expfile} { |
---|
102 | global expgui expmap entryvar entrycmd |
---|
103 | global exparray |
---|
104 | catch { |
---|
105 | unset exparray |
---|
106 | unset expmap |
---|
107 | } |
---|
108 | expload $expfile |
---|
109 | set expgui(changed) 0 |
---|
110 | mapexp |
---|
111 | |
---|
112 | # set the window/icon title |
---|
113 | wm title . $expfile |
---|
114 | wm iconname . [file tail $expfile] |
---|
115 | |
---|
116 | set expgui(curPhase) "" |
---|
117 | # set the number of phases on the phase page |
---|
118 | setphases |
---|
119 | |
---|
120 | set expgui(pagenow) "" |
---|
121 | |
---|
122 | # update the histogram list |
---|
123 | sethistlist |
---|
124 | |
---|
125 | if !$expgui(havetix) { |
---|
126 | RaisePage phaseFrame |
---|
127 | } else { |
---|
128 | .n raise phasePane |
---|
129 | set expgui(pagenow) phaseFrame |
---|
130 | } |
---|
131 | # select the 1st phase |
---|
132 | SelectOnePhase [lindex $expmap(phaselist) 0] |
---|
133 | # disable the "global options" that don't make sense |
---|
134 | foreach num {1 2 3 4 5} { |
---|
135 | set flag($num) 0 |
---|
136 | } |
---|
137 | foreach h $expmap(powderlist) { |
---|
138 | if {[string range $expmap(htype_$h) 2 2] == "T"} {set flag(1) 1} |
---|
139 | if {[string range $expmap(htype_$h) 1 2] == "NC"} {set flag(2) 1} |
---|
140 | if {[string range $expmap(htype_$h) 1 2] == "XC" && \ |
---|
141 | [histinfo $h lam2] != 0.0} {set flag(3) 1} |
---|
142 | if {[string range $expmap(htype_$h) 1 2] == "XC" && \ |
---|
143 | [histinfo $h lam2] == 0.0} {set flag(4) 1} |
---|
144 | if {[string range $expmap(htype_$h) 1 2] == "XE"} {set flag(5) 1} |
---|
145 | } |
---|
146 | foreach num {1 2 3 4 5} \ |
---|
147 | lbl {TOF "CW Neutron" "Alpha12 Xray" "Monochromatic Xray" \ |
---|
148 | "Energy Disp Xray"} { |
---|
149 | if $flag($num) { |
---|
150 | $expgui(fm).edit.menu entryconfigure $lbl -state normal |
---|
151 | } else { |
---|
152 | $expgui(fm).edit.menu entryconfigure $lbl -state disabled |
---|
153 | } |
---|
154 | } |
---|
155 | # least squares page |
---|
156 | set entryvar(cycles) [expinfo cycles] |
---|
157 | set entrycmd(cycles) "expinfo cycles" |
---|
158 | set expgui(globalmode) 0 |
---|
159 | set expgui(printopt) "Print Options ([expinfo print])" |
---|
160 | global printopts |
---|
161 | foreach num [array names printopts] { |
---|
162 | set entrycmd(printopt$num) "printsetting $num" |
---|
163 | set entryvar(printopt$num) [printsetting $num] |
---|
164 | } |
---|
165 | } |
---|
166 | |
---|
167 | # called to reread the .EXP file -- use after another program |
---|
168 | # has changed the experiment file |
---|
169 | proc rereadexp {expfile} { |
---|
170 | global expgui |
---|
171 | if $expgui(changed) { |
---|
172 | set decision [tk_dialog .instrSaveData {Save .EXP changes} \ |
---|
173 | {You have made changes to the Experiment. Rereading will cause the changes to be lost. Select an option:} \ |
---|
174 | {} 0 "Save and reread" "Reread without Save" "Cancel reread command"] |
---|
175 | switch $decision { |
---|
176 | 0 { archiveexp $expfile } |
---|
177 | 1 { } |
---|
178 | 2 { return } |
---|
179 | } |
---|
180 | } |
---|
181 | loadexp $expfile |
---|
182 | } |
---|
183 | |
---|
184 | proc SaveAsFile {} { |
---|
185 | global expfile expgui |
---|
186 | set newexpfile [tk_getSaveFile -defaultextension .EXP \ |
---|
187 | -filetypes {{"GSAS Experiment" ".EXP"}} -parent . \ |
---|
188 | -initialdir [file dirname $expfile] \ |
---|
189 | -initialfile [file tail $expfile] ] |
---|
190 | if {$newexpfile == ""} return |
---|
191 | set expfile $newexpfile |
---|
192 | expwrite $expfile |
---|
193 | set expgui(changed) 0 |
---|
194 | # set the window/icon title |
---|
195 | wm title . $expfile |
---|
196 | wm iconname . [file tail $expfile] |
---|
197 | } |
---|
198 | |
---|
199 | # called to read a different .EXP file |
---|
200 | proc readnewexp {} { |
---|
201 | global expgui expfile |
---|
202 | if $expgui(changed) { |
---|
203 | set decision [tk_dialog .instrSaveData {Save .EXP changes} \ |
---|
204 | {You have made changes to the Experiment. Reading a different file will cause the changes to be lost. Select an option:} \ |
---|
205 | {} 0 "Save and read" "Read without Save" "Cancel read command"] |
---|
206 | switch $decision { |
---|
207 | 0 { archiveexp $expfile } |
---|
208 | 1 { } |
---|
209 | 2 { return } |
---|
210 | } |
---|
211 | } |
---|
212 | set newexpfile [tk_getOpenFile -defaultextension .EXP \ |
---|
213 | -filetypes {{"GSAS Experiment" ".EXP"}} -parent . \ |
---|
214 | -initialdir [file dirname $expfile] ] |
---|
215 | if {$newexpfile == ""} return |
---|
216 | set expfile $newexpfile |
---|
217 | loadexp $expfile |
---|
218 | } |
---|
219 | |
---|
220 | #------------- set up data read/write layer ---------------------- |
---|
221 | # trace routine on entryvar |
---|
222 | proc entvartrace {array elem action} { |
---|
223 | global expgui entrycmd entryvar |
---|
224 | if !$entrycmd(trace) return |
---|
225 | |
---|
226 | catch { |
---|
227 | incr expgui(changed) |
---|
228 | if $expgui(debug) {puts "$entrycmd($elem) set $entryvar($elem) "} |
---|
229 | if {$entrycmd($elem) == ""} return |
---|
230 | if [catch { |
---|
231 | eval $entrycmd($elem) set $entryvar($elem) |
---|
232 | if {[lindex $entrycmd($elem) 0] == "atominfo"} { |
---|
233 | after idle {DisplayAllAtoms noreset} |
---|
234 | } |
---|
235 | } errmsg] {puts "entvartrace error: $errmsg"} |
---|
236 | } |
---|
237 | } |
---|
238 | |
---|
239 | # disable traces on entryvar until we are ready |
---|
240 | set entrycmd(trace) 0 |
---|
241 | trace variable entryvar w entvartrace |
---|
242 | |
---|
243 | # |
---|
244 | # |
---|
245 | # |
---|
246 | ############################################################################## |
---|
247 | ##### ##################################################### |
---|
248 | ##### PROCEDURES SECTION ##################################################### |
---|
249 | ##### ##################################################### |
---|
250 | ############################################################################## |
---|
251 | # reset routine is used for debugging |
---|
252 | proc reset {} { |
---|
253 | global expgui script argv expfile |
---|
254 | set script $expgui(script) |
---|
255 | set argv $expfile |
---|
256 | # remove traces |
---|
257 | global entryvar |
---|
258 | foreach cmd [trace vinfo entryvar] { |
---|
259 | eval trace vdelete entryvar $cmd |
---|
260 | } |
---|
261 | global expgui |
---|
262 | foreach cmd [trace vinfo expgui(backterms)] { |
---|
263 | eval trace vdelete entryvar $cmd |
---|
264 | } |
---|
265 | foreach cmd [trace vinfo expgui(backtype)] { |
---|
266 | eval trace vdelete entryvar $cmd |
---|
267 | } |
---|
268 | foreach a {exparray expmap expgui entryvar entrycmd} { |
---|
269 | global $a |
---|
270 | catch {unset $a} |
---|
271 | } |
---|
272 | foreach w [winfo children .] { |
---|
273 | destroy $w |
---|
274 | } |
---|
275 | |
---|
276 | uplevel #0 {source $script} |
---|
277 | } |
---|
278 | |
---|
279 | proc About { } { |
---|
280 | global expgui expmap |
---|
281 | tk_dialog .about {About...} \ |
---|
282 | "EXPGUI\n\ |
---|
283 | Jonathan Wasserman and Brian Toby\n\ |
---|
284 | NIST Center for Neutron Research\n\n\ |
---|
285 | 1998, Not subject to copyright\n\n\ |
---|
286 | Revision [lindex $expgui(Revision) 1] (readexp.tcl [lindex $expmap(Revision) 1])" \ |
---|
287 | info 0 OK |
---|
288 | } |
---|
289 | |
---|
290 | # -------- called to confirm before exiting |
---|
291 | proc catchQuit {} { |
---|
292 | if {[confirmBeforeSave] == "Continue"} { |
---|
293 | destroy . |
---|
294 | } |
---|
295 | } |
---|
296 | # save the .EXP file before exiting? |
---|
297 | proc confirmBeforeSave {} { |
---|
298 | global expgui expfile |
---|
299 | if !$expgui(changed) { |
---|
300 | return "Continue" |
---|
301 | } |
---|
302 | set decision [tk_dialog .instrSaveData {Save .EXP changes} \ |
---|
303 | {You have made changes to the Experiment, but the changes are not saved. Select an option:} \ |
---|
304 | {} 0 "Save and Exit" "Exit without Save" "Cancel exit command"] |
---|
305 | switch $decision { |
---|
306 | 0 { archiveexp $expfile; return "Continue" } |
---|
307 | 1 { return "Continue" } |
---|
308 | 2 { return "Cancel" } |
---|
309 | } |
---|
310 | } |
---|
311 | |
---|
312 | proc archiveexp {expfile} { |
---|
313 | global expgui tcl_platform |
---|
314 | if !$expgui(changed) return |
---|
315 | if $expgui(archive) { |
---|
316 | catch { |
---|
317 | set expnam [file rootname $expfile] |
---|
318 | if {$tcl_platform(platform) == "windows"} { |
---|
319 | if ![file executable [file join $expgui(scriptdir) pkzip.exe]] { |
---|
320 | # archive w/o pkzip |
---|
321 | set files [glob -nocomplain ${expnam}!*.exp] |
---|
322 | if {$files == ""} { |
---|
323 | set num -1 |
---|
324 | } else { |
---|
325 | set file [lindex [lsort -decreasing $files] 0] |
---|
326 | regexp {!([0-9]+)\.EXP} [string toupper $file] a num |
---|
327 | } |
---|
328 | set file $expnam![format "%3.3d" [incr num]].EXP |
---|
329 | file copy $expnam.EXP $file |
---|
330 | set fp [open $expnam.lst a] |
---|
331 | puts $fp "\n--------------------------------------------------------------" |
---|
332 | puts $fp "Archiving $expnam.EXP as $file" |
---|
333 | puts $fp "--------------------------------------------------------------\n" |
---|
334 | close $fp |
---|
335 | } else { |
---|
336 | # archive with PKZIP |
---|
337 | # need to limit expnam to 8 characters |
---|
338 | set sexp [string toupper [string range [file root [file tail $expnam] ] 0 7]] |
---|
339 | # PKZIP can't handle long dir names either |
---|
340 | cd [set dir [file dirname $expnam]] |
---|
341 | set num -1 |
---|
342 | # get the versions from the listing |
---|
343 | if [file exists $sexp.zip] { |
---|
344 | set fp [open "| [file join $expgui(scriptdir) pkzip.exe] -vb $sexp" r] |
---|
345 | while {[gets $fp line] >= 0} { |
---|
346 | regexp "$sexp\.0?0?(\[0-9\]+)" [string toupper $line] junk n |
---|
347 | catch {if {$n > $num} {set num $n}} |
---|
348 | } |
---|
349 | close $fp |
---|
350 | } |
---|
351 | incr num |
---|
352 | set file $sexp.[format "%3.3d" $num] |
---|
353 | file copy -force $expnam.EXP $file |
---|
354 | exec [file join $expgui(scriptdir) pkzip.exe] -m $expnam $file > x.x & |
---|
355 | set fp [open $expnam.lst a] |
---|
356 | puts $fp "\n--------------------------------------------------------------" |
---|
357 | puts $fp "Archiving $expnam.EXP as $file in [file join $dir $sexp.ZIP]" |
---|
358 | puts $fp "--------------------------------------------------------------\n" |
---|
359 | close $fp |
---|
360 | } |
---|
361 | } else { |
---|
362 | set files [glob -nocomplain $expnam.EXP.*] |
---|
363 | if {$files == ""} { |
---|
364 | set file $expnam.EXP.000 |
---|
365 | } else { |
---|
366 | set file [lindex [lsort -decreasing $files] 0] |
---|
367 | regexp {.*\.EXP.0?0?([0-9]*).*} $file junk number |
---|
368 | incr number |
---|
369 | set file $expnam.EXP.[format "%3.3d" $number] |
---|
370 | } |
---|
371 | exec cp $expfile $file |
---|
372 | if [catch {exec gzip $file}] { |
---|
373 | exec echo "\n----------------------------------------------" >> $expnam.LST |
---|
374 | exec echo " Archiving $expnam.EXP as $file " >> $expnam.LST |
---|
375 | exec echo "----------------------------------------------\n" >> $expnam.LST |
---|
376 | } else { |
---|
377 | exec echo "\n----------------------------------------------" >> $expnam.LST |
---|
378 | exec echo " Archiving $expnam.EXP as $file.gz " >> $expnam.LST |
---|
379 | exec echo "----------------------------------------------\n" >> $expnam.LST |
---|
380 | } |
---|
381 | } |
---|
382 | } errmsg |
---|
383 | if {$errmsg != ""} { |
---|
384 | tk_dialog .warn Confirm "Error in archive: $errmsg" warning 0 OK |
---|
385 | } |
---|
386 | } |
---|
387 | # now save the file |
---|
388 | expwrite $expfile |
---|
389 | } |
---|
390 | |
---|
391 | # set the number of phases on the phase page |
---|
392 | proc setphases {} { |
---|
393 | global expgui expmap |
---|
394 | eval destroy [pack slaves $expgui(phaseFrame).top.ps] |
---|
395 | foreach num $expmap(phaselist) { |
---|
396 | pack [button $expgui(phaseFrame).top.ps.$num -text $num \ |
---|
397 | -command "SelectOnePhase $num"] -side left |
---|
398 | } |
---|
399 | # set the default data to be the first phase and the first histogram |
---|
400 | set expgui(lasthist) [lindex $expmap(powderlist) 0] |
---|
401 | } |
---|
402 | |
---|
403 | # Procedure to respond to changes the phase. |
---|
404 | # This loads the "phases" widgets with data corresponding to the selected phase. |
---|
405 | proc SelectOnePhase {num} { |
---|
406 | global entryvar entrycmd expmap expgui |
---|
407 | foreach n $expmap(phaselist) { |
---|
408 | if {$n == $num} { |
---|
409 | $expgui(phaseFrame).top.ps.$num config -relief sunken |
---|
410 | } else { |
---|
411 | $expgui(phaseFrame).top.ps.$n config -relief raised |
---|
412 | } |
---|
413 | } |
---|
414 | set crsPhase $num |
---|
415 | if {$crsPhase == ""} return |
---|
416 | set expgui(curPhase) $crsPhase |
---|
417 | # we have a phase |
---|
418 | |
---|
419 | # disable traces on entryvar for right now |
---|
420 | set entrycmd(trace) 0 |
---|
421 | |
---|
422 | ########################################################## |
---|
423 | ###### SECTION: ASSIGNMENT OF DATA VARIABLES ########## |
---|
424 | ########################################################## |
---|
425 | # phase title |
---|
426 | set entrycmd(phasename) {} |
---|
427 | set entryvar(phasename) [phaseinfo $crsPhase name] |
---|
428 | # cell parameters & flags |
---|
429 | foreach ent {a b c alpha beta gamma cellref celldamp} { |
---|
430 | set entrycmd($ent) "phaseinfo $crsPhase $ent" |
---|
431 | set entryvar($ent) [phaseinfo $crsPhase $ent] |
---|
432 | } |
---|
433 | |
---|
434 | #Procedure call: DisplayU -- Display Anisotropic/Isotropic widget or disable |
---|
435 | # initialize to diasbled |
---|
436 | DisplayAtom 0 0 |
---|
437 | DisplayU 0 0 |
---|
438 | DisplayRefFlags 0 0 |
---|
439 | $expgui(EditingAtoms) config -text "" |
---|
440 | |
---|
441 | DisplayAllAtoms |
---|
442 | |
---|
443 | # enable traces on entryvar now |
---|
444 | set entrycmd(trace) 1 |
---|
445 | } |
---|
446 | |
---|
447 | set expgui(noreenterDisplayAllAtoms) 0 |
---|
448 | # Populate expgui(atomlistbox) (ScrolledListBox) with atoms from selected phase. |
---|
449 | proc DisplayAllAtoms {"mode reset"} { |
---|
450 | global entryvar entrycmd expmap expgui |
---|
451 | # if it does not show, dont bother |
---|
452 | if {$expgui(pagenow) != "phaseFrame"} return |
---|
453 | if {$expgui(curPhase) == ""} return |
---|
454 | if $expgui(noreenterDisplayAllAtoms) return |
---|
455 | |
---|
456 | set expgui(noreenterDisplayAllAtoms) 1 |
---|
457 | if {$mode != "reset"} { |
---|
458 | set selectlist [$expgui(atomlistbox) curselection] |
---|
459 | set pos [lindex [$expgui(atomlistbox) yview] 0] |
---|
460 | } |
---|
461 | $expgui(atomlistbox) delete 0 end |
---|
462 | # loop over atoms |
---|
463 | set maxline I |
---|
464 | set phase $expgui(curPhase) |
---|
465 | set atomlist {} |
---|
466 | if {$expgui(asorttype) == "type"} { |
---|
467 | # sort on atom type |
---|
468 | foreach atom $expmap(atomlist_$phase) { |
---|
469 | lappend atomlist "$atom [atominfo $phase $atom type] $phase" |
---|
470 | } |
---|
471 | set expmap(atomlistboxcontents) [lsort -ascii -index 1 $atomlist] |
---|
472 | } elseif {$expgui(asorttype) == "number"} { |
---|
473 | # sort on atom number |
---|
474 | foreach atom $expmap(atomlist_$phase) { |
---|
475 | lappend atomlist "$atom $atom $phase" |
---|
476 | } |
---|
477 | set expmap(atomlistboxcontents) [lsort -integer -index 1 $atomlist] |
---|
478 | } elseif {$expgui(asorttype) == "x"} { |
---|
479 | # sort on x |
---|
480 | foreach atom $expmap(atomlist_$phase) { |
---|
481 | lappend atomlist "$atom [atominfo $phase $atom x] $phase" |
---|
482 | } |
---|
483 | set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist] |
---|
484 | } elseif {$expgui(asorttype) == "y"} { |
---|
485 | # sort on y |
---|
486 | foreach atom $expmap(atomlist_$phase) { |
---|
487 | lappend atomlist "$atom [atominfo $phase $atom y] $phase" |
---|
488 | } |
---|
489 | set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist] |
---|
490 | } elseif {$expgui(asorttype) == "z"} { |
---|
491 | # sort on z |
---|
492 | foreach atom $expmap(atomlist_$phase) { |
---|
493 | lappend atomlist "$atom [atominfo $phase $atom z] $phase" |
---|
494 | } |
---|
495 | set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist] |
---|
496 | } else { |
---|
497 | error "Bad expgui(asorttype = $expgui(asorttype)" |
---|
498 | } |
---|
499 | |
---|
500 | foreach tuple $expmap(atomlistboxcontents) { |
---|
501 | set atom [lindex $tuple 0] |
---|
502 | set phase [lindex $tuple 2] |
---|
503 | set refflag {} |
---|
504 | foreach type {x u f} { |
---|
505 | if {[atominfo $phase $atom ${type}ref]} { |
---|
506 | append refflag "[string toupper $type][atominfo $phase $atom ${type}damp] " |
---|
507 | } else { |
---|
508 | append refflag " [atominfo $phase $atom ${type}damp] " |
---|
509 | } |
---|
510 | } |
---|
511 | set line [format "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%9.4f" \ |
---|
512 | $atom \ |
---|
513 | [atominfo $phase $atom label] \ |
---|
514 | [atominfo $phase $atom type] \ |
---|
515 | $refflag \ |
---|
516 | [atominfo $phase $atom x] \ |
---|
517 | [atominfo $phase $atom y] \ |
---|
518 | [atominfo $phase $atom z] \ |
---|
519 | [atominfo $phase $atom frac] |
---|
520 | ] |
---|
521 | # add temperature factors (iso/anoiso) |
---|
522 | if {[atominfo $phase $atom temptype] == "A"} { |
---|
523 | set maxline A |
---|
524 | append line [format " %9.5f%9.5f%9.5f%9.5f%9.5f%9.5f" \ |
---|
525 | [atominfo $phase $atom U11] \ |
---|
526 | [atominfo $phase $atom U22] \ |
---|
527 | [atominfo $phase $atom U33] \ |
---|
528 | [atominfo $phase $atom U12] \ |
---|
529 | [atominfo $phase $atom U23] \ |
---|
530 | [atominfo $phase $atom U13] |
---|
531 | ] |
---|
532 | } else { |
---|
533 | append line [format " %9.5f" \ |
---|
534 | [atominfo $phase $atom Uiso] |
---|
535 | ] |
---|
536 | } |
---|
537 | $expgui(atomlistbox) insert end $line |
---|
538 | } |
---|
539 | $expgui(atomtitle) delete 0 end |
---|
540 | if {$maxline == "A"} { |
---|
541 | $expgui(atomtitle) insert end [format "%10s %6s %8s %30s%9s %s" \ |
---|
542 | " name " "type " "ref/damp " "fractional coordinates " \ |
---|
543 | " Occupancy" \ |
---|
544 | "Uiso/Uij "] |
---|
545 | } else { |
---|
546 | $expgui(atomtitle) insert end [format "%10s %6s %8s %30s%9s %s" \ |
---|
547 | " name " "type " "ref/damp " "fractional coordinates " \ |
---|
548 | " Occupancy" \ |
---|
549 | "Uiso"] |
---|
550 | } |
---|
551 | if {$mode != "reset"} { |
---|
552 | foreach i $selectlist { |
---|
553 | $expgui(atomlistbox) selection set $i |
---|
554 | $expgui(atomlistbox) yview moveto $pos |
---|
555 | } |
---|
556 | } |
---|
557 | set expgui(noreenterDisplayAllAtoms) 0 |
---|
558 | } |
---|
559 | |
---|
560 | # Procedure to select all atoms in response to a right-click |
---|
561 | proc SelectAllAtoms {} { |
---|
562 | global expgui |
---|
563 | $expgui(atomlistbox) selection set 0 end |
---|
564 | # just in case this was called at the wrong time: |
---|
565 | editRecord |
---|
566 | } |
---|
567 | |
---|
568 | # Procedure to respond to left mouse release in the atoms Pane |
---|
569 | proc editRecord { args } { |
---|
570 | global entrycmd expgui |
---|
571 | set selectIndex [$expgui(atomlistbox) curselection] |
---|
572 | # disable traces on entryvar for right now |
---|
573 | set entrycmd(trace) 0 |
---|
574 | |
---|
575 | if {[llength $selectIndex] == 0} { |
---|
576 | puts "How did this happen: [$expgui(atomlistbox) curselection]" |
---|
577 | } elseif {[llength $selectIndex] == 1} { |
---|
578 | editOneRecord $selectIndex |
---|
579 | } else { |
---|
580 | editMultipleRecords $selectIndex |
---|
581 | } |
---|
582 | # reenable traces on entryvar |
---|
583 | set entrycmd(trace) 1 |
---|
584 | # repaint the atoms box in case anything was changed |
---|
585 | # DisplayAllAtoms noreset |
---|
586 | } |
---|
587 | |
---|
588 | proc editOneRecord { AtomIndex } { |
---|
589 | global expmap expgui |
---|
590 | # get atom number & phase |
---|
591 | set tuple [lindex $expmap(atomlistboxcontents) $AtomIndex] |
---|
592 | set atomnum [lindex $tuple 0] |
---|
593 | set p [lindex $tuple 2] |
---|
594 | DisplayU $atomnum $p |
---|
595 | DisplayAtom $atomnum $p |
---|
596 | DisplayRefFlags $atomnum $p |
---|
597 | $expgui(EditingAtoms) config -text "Editing atom #$atomnum -- [atominfo $p $atomnum label]" |
---|
598 | } |
---|
599 | |
---|
600 | # this will not work for a multi-phase list of atoms (yet) |
---|
601 | proc editMultipleRecords { AtomIndexList } { |
---|
602 | global expmap expgui |
---|
603 | set numberList {} |
---|
604 | # current phase |
---|
605 | set p $expgui(curPhase) |
---|
606 | foreach AtomIndex $AtomIndexList { |
---|
607 | # get atom number & phase |
---|
608 | set tuple [lindex $expmap(atomlistboxcontents) $AtomIndex] |
---|
609 | lappend numberList [lindex $tuple 0] |
---|
610 | # set p [lindex $tuple 2] |
---|
611 | } |
---|
612 | # this needs to track by phase |
---|
613 | $expgui(EditingAtoms) config -text \ |
---|
614 | "Set refinement options: atoms [CompressList $numberList]" |
---|
615 | DisplayU 0 0 |
---|
616 | DisplayAtom 0 0 |
---|
617 | # this needs to track by phase |
---|
618 | DisplayRefFlags $numberList $p |
---|
619 | } |
---|
620 | |
---|
621 | # format a string of numbers to save space, e.g. "1 2 3 4 6 7 19 13 14 15" |
---|
622 | # becomes "1-4,6,7,13-15,19" |
---|
623 | proc CompressList {numberList} { |
---|
624 | # format the number list to save space |
---|
625 | set lastnum -99 |
---|
626 | set flist {} |
---|
627 | set count 0 |
---|
628 | foreach num [lsort -integer $numberList] { |
---|
629 | set next [expr $lastnum+1] |
---|
630 | if {$num != $next} { |
---|
631 | if {$count == 0 && $flist != ""} { |
---|
632 | append flist ",$num" |
---|
633 | } elseif {$count == 1 && $flist != ""} { |
---|
634 | append flist ",$lastnum,$num" |
---|
635 | } elseif {$flist != ""} { |
---|
636 | append flist "-$lastnum,$num" |
---|
637 | } else { |
---|
638 | append flist "$num" |
---|
639 | } |
---|
640 | set lastnum $num |
---|
641 | set count 0 |
---|
642 | } else { |
---|
643 | incr count |
---|
644 | incr lastnum |
---|
645 | } |
---|
646 | } |
---|
647 | if {$count == 1 && $flist != ""} { |
---|
648 | append flist ",$lastnum" |
---|
649 | } elseif {$flist != "" && $count > 1} { |
---|
650 | append flist "-$lastnum" |
---|
651 | } |
---|
652 | return $flist |
---|
653 | } |
---|
654 | |
---|
655 | # Procedure to display Isotropic or Anisotropic temperature factors |
---|
656 | # Changes the display to one entry widget for Isotropic motion OR |
---|
657 | # 6 entry widgets for Anisotropic motion in Frame3. |
---|
658 | # or disables the widet entirly if atom = 0 |
---|
659 | proc DisplayU { atomnum p} { |
---|
660 | global expgui entryvar entrycmd |
---|
661 | if {$atomnum == 0} { |
---|
662 | set iOrA disable |
---|
663 | } else { |
---|
664 | set iOrA [atominfo $p $atomnum temptype] |
---|
665 | } |
---|
666 | |
---|
667 | set firstbox [lindex $expgui(anisolabels) 0] |
---|
668 | if { $iOrA == "A" } { |
---|
669 | $firstbox config -text "U11 " |
---|
670 | foreach item $expgui(anisolabels) { |
---|
671 | $item config -fg black |
---|
672 | } |
---|
673 | foreach item $expgui(anisoentry) var {U11 U22 U33 U12 U13 U23} { |
---|
674 | set entrycmd($var) "atominfo $p $atomnum $var" |
---|
675 | set entryvar($var) [eval $entrycmd($var)] |
---|
676 | $item config -fg black -state normal -bg white |
---|
677 | } |
---|
678 | } elseif { $iOrA == "I" || $iOrA == "disable"} { |
---|
679 | foreach item $expgui(anisolabels) { |
---|
680 | # $item config -fg grey |
---|
681 | $item config -fg beige |
---|
682 | } |
---|
683 | foreach item [lrange $expgui(anisoentry) 1 end] \ |
---|
684 | var {U22 U33 U12 U13 U23} { |
---|
685 | set entrycmd($var) "" |
---|
686 | set entryvar($var) "" |
---|
687 | $item config -fg beige -bg beige -state disabled |
---|
688 | } |
---|
689 | if { $iOrA == "disable"} { |
---|
690 | set entrycmd($var) "" |
---|
691 | set entryvar($var) "" |
---|
692 | # [lindex $expgui(anisoentry) 0] config -fg white -state disabled |
---|
693 | [lindex $expgui(anisoentry) 0] config -fg beige -bg beige -state disabled |
---|
694 | } else { |
---|
695 | set entrycmd(U11) "atominfo $p $atomnum Uiso" |
---|
696 | set entryvar(U11) [eval $entrycmd(U11)] |
---|
697 | $firstbox config -text Uiso -fg black |
---|
698 | [lindex $expgui(anisoentry) 0] config -fg black -bg white -state normal |
---|
699 | } |
---|
700 | } |
---|
701 | } |
---|
702 | |
---|
703 | # need to think about multiple phases |
---|
704 | |
---|
705 | # Procedure to display refinement flags |
---|
706 | proc DisplayRefFlags { atomnum p} { |
---|
707 | global expgui entryvar entrycmd |
---|
708 | if {$atomnum == 0} { |
---|
709 | foreach label $expgui(atomreflbl) { |
---|
710 | $label config -fg beige |
---|
711 | } |
---|
712 | foreach entry $expgui(atomref) { |
---|
713 | $entry config -state disabled -fg beige -bg beige |
---|
714 | } |
---|
715 | return |
---|
716 | } |
---|
717 | foreach label $expgui(atomreflbl) { |
---|
718 | $label config -fg black |
---|
719 | } |
---|
720 | foreach entry $expgui(atomref) { |
---|
721 | $entry config -state normal -fg black -bg beige |
---|
722 | } |
---|
723 | foreach var {xref uref fref xdamp udamp fdamp} { |
---|
724 | set entrycmd($var) "atominfo $p [list $atomnum] $var" |
---|
725 | set entryvar($var) [eval $entrycmd($var)] |
---|
726 | } |
---|
727 | } |
---|
728 | |
---|
729 | # Procedure to display an atom in the atom edit boxes |
---|
730 | proc DisplayAtom { atomnum p} { |
---|
731 | global expgui entryvar entrycmd |
---|
732 | if {$atomnum == 0} { |
---|
733 | foreach label $expgui(atomlabels) { |
---|
734 | $label config -fg beige |
---|
735 | } |
---|
736 | foreach entry $expgui(atomentry) { |
---|
737 | $entry config -state disabled -fg beige -bg beige |
---|
738 | } |
---|
739 | return |
---|
740 | } |
---|
741 | foreach label $expgui(atomlabels) { |
---|
742 | $label config -fg black |
---|
743 | } |
---|
744 | foreach entry $expgui(atomentry) { |
---|
745 | $entry config -state normal -fg black -bg white |
---|
746 | } |
---|
747 | foreach var {x y z label frac } { |
---|
748 | set entrycmd($var) "atominfo $p $atomnum $var" |
---|
749 | set entryvar($var) [eval $entrycmd($var)] |
---|
750 | } |
---|
751 | } |
---|
752 | |
---|
753 | # update the histogram list |
---|
754 | # to do: show histogram ref flags? |
---|
755 | proc sethistlist {} { |
---|
756 | global expgui expmap |
---|
757 | set expgui(curhist) 0 |
---|
758 | foreach lbox $expgui(HistSelectList) { |
---|
759 | $lbox.title delete 0 end |
---|
760 | $lbox.lbox delete 0 end |
---|
761 | if {$expgui(globalmode) != 0} { |
---|
762 | $lbox.lbox config -selectmode extended |
---|
763 | } else { |
---|
764 | $lbox.lbox config -selectmode browse |
---|
765 | } |
---|
766 | } |
---|
767 | # disable the unallowed pages in all mode |
---|
768 | if {$expgui(globalmode) == 6} { |
---|
769 | foreach pair $expgui(GlobalModeAllDisable) { |
---|
770 | if {$expgui(pagenow) == [lindex $pair 0]} { |
---|
771 | if !$expgui(havetix) { |
---|
772 | RaisePage phaseFrame |
---|
773 | } else { |
---|
774 | .n raise phasePane |
---|
775 | set expgui(pagenow) phaseFrame |
---|
776 | } |
---|
777 | } |
---|
778 | eval [lindex $pair 1] -state disabled |
---|
779 | } |
---|
780 | } else { |
---|
781 | foreach pair $expgui(GlobalModeAllDisable) { |
---|
782 | eval [lindex $pair 1] -state normal |
---|
783 | } |
---|
784 | } |
---|
785 | if {$expgui(hsorttype) == "type"} { |
---|
786 | # sort on histogram type |
---|
787 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
788 | lappend histlist "$h [string range $expmap(htype_$h) 1 2]" |
---|
789 | } |
---|
790 | set expmap(histlistboxcontents) [lsort -ascii -index 1 $histlist] |
---|
791 | } elseif {$expgui(hsorttype) == "number"} { |
---|
792 | # sort on histogram number |
---|
793 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
794 | lappend histlist "$h $h" |
---|
795 | } |
---|
796 | set expmap(histlistboxcontents) [lsort -integer -index 1 $histlist] |
---|
797 | } elseif {$expgui(hsorttype) == "bank"} { |
---|
798 | # sort on original bank number |
---|
799 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
800 | lappend histlist "$h [histinfo $h bank]" |
---|
801 | } |
---|
802 | set expmap(histlistboxcontents) [lsort -integer -index 1 $histlist] |
---|
803 | } elseif {$expgui(hsorttype) == "angle"} { |
---|
804 | # sort on wavelength (CW) or angle (E disp.) |
---|
805 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
806 | if {[string range $expmap(htype_$h) 2 2] == "T"} { |
---|
807 | set det [format %8.2f [histinfo $h tofangle]] |
---|
808 | } elseif {[string range $expmap(htype_$h) 2 2] == "C"} { |
---|
809 | set det [format %8.5f [histinfo $h lam1]] |
---|
810 | } elseif {[string range $expmap(htype_$h) 2 2] == "E"} { |
---|
811 | set det [format %8.2f [histinfo $h lam1]] |
---|
812 | } else { |
---|
813 | set det {} |
---|
814 | } |
---|
815 | lappend histlist "$h $det" |
---|
816 | } |
---|
817 | set expmap(histlistboxcontents) [lsort -real -index 1 $histlist] |
---|
818 | } |
---|
819 | # title field needs to match longest title |
---|
820 | foreach lbox $expgui(HistSelectList) { |
---|
821 | $lbox.title insert end [format "%2s %s %4s %8s %-67s" \ |
---|
822 | "h#" \ |
---|
823 | type \ |
---|
824 | bank \ |
---|
825 | "ang/wave" \ |
---|
826 | " title" \ |
---|
827 | ] |
---|
828 | } |
---|
829 | foreach tuple $expmap(histlistboxcontents) { |
---|
830 | set h [lindex $tuple 0] |
---|
831 | |
---|
832 | if {$expgui(globalmode) == 1} { |
---|
833 | if {[string range $expmap(htype_$h) 2 2] != "T"} continue |
---|
834 | } elseif {$expgui(globalmode) == 2} { |
---|
835 | if {[string range $expmap(htype_$h) 1 2] != "NC"} continue |
---|
836 | } elseif {$expgui(globalmode) == 3} { |
---|
837 | if {[string range $expmap(htype_$h) 1 2] != "XC" || \ |
---|
838 | [histinfo $h lam2] == 0.0} continue |
---|
839 | } elseif {$expgui(globalmode) == 4} { |
---|
840 | if {[string range $expmap(htype_$h) 1 2] != "XC" || \ |
---|
841 | [histinfo $h lam2] != 0.0} continue |
---|
842 | } elseif {$expgui(globalmode) == 5} { |
---|
843 | if {[string range $expmap(htype_$h) 1 2] != "XE"} continue |
---|
844 | } |
---|
845 | |
---|
846 | if {[string range $expmap(htype_$h) 2 2] == "T"} { |
---|
847 | set det [format %8.2f [histinfo $h tofangle]] |
---|
848 | } elseif {[string range $expmap(htype_$h) 2 2] == "C"} { |
---|
849 | set det [format %8.5f [histinfo $h lam1]] |
---|
850 | } elseif {[string range $expmap(htype_$h) 2 2] == "E"} { |
---|
851 | set det [format %8.2f [histinfo $h lam1]] |
---|
852 | } else { |
---|
853 | set det {} |
---|
854 | } |
---|
855 | foreach lbox $expgui(HistSelectList) { |
---|
856 | $lbox.lbox insert end [format "%2d %s %4d %8s %-67s" \ |
---|
857 | $h \ |
---|
858 | [string range $expmap(htype_$h) 1 2] \ |
---|
859 | [histinfo $h bank] \ |
---|
860 | $det \ |
---|
861 | [string range [histinfo $h title] 0 66] \ |
---|
862 | ] |
---|
863 | } |
---|
864 | } |
---|
865 | foreach set $expgui(frameactionlist) { |
---|
866 | if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1] |
---|
867 | } |
---|
868 | } |
---|
869 | |
---|
870 | #----------------------------------------------------------------------- |
---|
871 | # ----------- draw Histogram page |
---|
872 | #----------------------------------------------------------------------- |
---|
873 | proc DisplayHistogram {} { |
---|
874 | global expgui entrycmd entryvar expmap |
---|
875 | |
---|
876 | # display the selected histograms |
---|
877 | $expgui(histFrame).hs.lbox selection clear 0 end |
---|
878 | foreach h $expgui(curhist) { |
---|
879 | $expgui(histFrame).hs.lbox selection set $h |
---|
880 | } |
---|
881 | |
---|
882 | # disable traces on entryvar for right now |
---|
883 | set entrycmd(trace) 0 |
---|
884 | |
---|
885 | # get histogram list |
---|
886 | set histlist {} |
---|
887 | foreach item $expgui(curhist) { |
---|
888 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
889 | } |
---|
890 | if {$expgui(globalmode) != 0} { |
---|
891 | set expgui(backtermlbl) "" |
---|
892 | set expgui(backtypelbl) "" |
---|
893 | foreach var {scale sref sdamp bref bdamp} { |
---|
894 | set entrycmd($var) "histinfo [list $histlist] $var" |
---|
895 | set entryvar($var) [histinfo [lindex $histlist 0] $var] |
---|
896 | } |
---|
897 | } else { |
---|
898 | set hist $histlist |
---|
899 | set terms [histinfo $hist backterms] |
---|
900 | set expgui(backtermlbl) "($terms terms)" |
---|
901 | set expgui(backtypelbl) "Function type [histinfo $hist backtype]" |
---|
902 | foreach var {scale sref sdamp bref bdamp} { |
---|
903 | set entrycmd($var) "histinfo $hist $var" |
---|
904 | set entryvar($var) [eval $entrycmd($var)] |
---|
905 | } |
---|
906 | } |
---|
907 | # Scale factor box & Top box |
---|
908 | if {$expgui(globalmode) != 0} { |
---|
909 | $expgui(histFrame).top.txt config \ |
---|
910 | -text "Selected Histograms: [CompressList $histlist]" |
---|
911 | grid $expgui(histFrame).top -column 1 -row 0 -sticky nsew |
---|
912 | set parm [grid info $expgui(scaleBox).ent1] |
---|
913 | if {$parm != ""} { |
---|
914 | grid forget $expgui(scaleBox).ent1 |
---|
915 | eval grid $expgui(scaleBox).but1 $parm |
---|
916 | } |
---|
917 | set expgui(bkglbl) "Globally Edit Background" |
---|
918 | } else { |
---|
919 | grid forget $expgui(histFrame).top |
---|
920 | set parm [grid info $expgui(scaleBox).but1] |
---|
921 | if {$parm != ""} { |
---|
922 | grid forget $expgui(scaleBox).but1 |
---|
923 | eval grid $expgui(scaleBox).ent1 $parm |
---|
924 | } |
---|
925 | set expgui(bkglbl) "Edit Background" |
---|
926 | } |
---|
927 | |
---|
928 | # diffractometer constants |
---|
929 | foreach var {lam1 lam2 kratio pola ipola ddamp zero \ |
---|
930 | wref pref dcref daref ratref ttref zref } { |
---|
931 | set entrycmd($var) "histinfo [list $histlist] $var" |
---|
932 | set entryvar($var) [histinfo [lindex $histlist 0] $var] |
---|
933 | } |
---|
934 | |
---|
935 | eval destroy [grid slaves $expgui(diffBox)] |
---|
936 | if {$expgui(globalmode) == 0} { |
---|
937 | if {[string range $expmap(htype_$hist) 2 2] == "T"} { |
---|
938 | #------ |
---|
939 | # TOF | |
---|
940 | #------ |
---|
941 | grid [ label $expgui(diffBox).lDCrc -text "Refine DIFC" ] \ |
---|
942 | -column 1 -row 1 |
---|
943 | grid [ checkbutton $expgui(diffBox).rfDCrc -variable entryvar(dcref) ] \ |
---|
944 | -column 2 -row 1 |
---|
945 | grid [ label $expgui(diffBox).lDCdifc -text DIFC ] \ |
---|
946 | -column 3 -row 1 -sticky w |
---|
947 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
948 | -width 15 ] -column 4 -row 1 |
---|
949 | # |
---|
950 | grid [ label $expgui(diffBox).lDCra -text "Refine DIFA" ] \ |
---|
951 | -column 1 -row 2 |
---|
952 | grid [ checkbutton $expgui(diffBox).rfDCra -variable entryvar(daref) ] \ |
---|
953 | -column 2 -row 2 |
---|
954 | grid [ label $expgui(diffBox).lDCdifa -text DIFA ] \ |
---|
955 | -column 3 -row 2 |
---|
956 | grid [ entry $expgui(diffBox).eDCdifa -textvariable entryvar(lam2) \ |
---|
957 | -width 15 ] -column 4 -row 2 |
---|
958 | # |
---|
959 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
960 | -column 3 -row 3 |
---|
961 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
962 | -width 15 ] -column 4 -row 3 |
---|
963 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
964 | -column 1 -row 3 -sticky w |
---|
965 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
966 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
967 | } elseif {[string range $expmap(htype_$hist) 1 2] == "NC"} { |
---|
968 | #--------------- |
---|
969 | # CW - neutron | |
---|
970 | #--------------- |
---|
971 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
972 | -column 1 -row 1 |
---|
973 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
974 | -column 2 -row 1 |
---|
975 | grid [ label $expgui(diffBox).lDCdifc -text wave ] \ |
---|
976 | -column 3 -row 1 -sticky w |
---|
977 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
978 | -width 15 ] -column 4 -row 1 |
---|
979 | # |
---|
980 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
981 | -column 1 -row 3 -sticky w |
---|
982 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
983 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
984 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
985 | -column 3 -row 3 |
---|
986 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
987 | -width 15 ] -column 4 -row 3 |
---|
988 | } elseif {[string range $expmap(htype_$hist) 1 2] == "XC" && \ |
---|
989 | [histinfo $hist lam2] == 0.0} { |
---|
990 | #-------------------------- |
---|
991 | # CW - x-ray 1 wavelength | |
---|
992 | #-------------------------- |
---|
993 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
994 | -column 1 -row 1 |
---|
995 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
996 | -column 2 -row 1 |
---|
997 | grid [ label $expgui(diffBox).lDCdifc -text wave ] \ |
---|
998 | -column 3 -row 1 -sticky w |
---|
999 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
1000 | -width 15 ] -column 4 -row 1 |
---|
1001 | # |
---|
1002 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
1003 | -column 1 -row 3 -sticky w |
---|
1004 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
1005 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1006 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
1007 | -column 3 -row 3 |
---|
1008 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
1009 | -width 15 ] -column 4 -row 3 |
---|
1010 | # |
---|
1011 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
1012 | -column 1 -row 4 -sticky w |
---|
1013 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
1014 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
1015 | grid [ label $expgui(diffBox).lDCpola -text POLA ] \ |
---|
1016 | -column 3 -row 4 |
---|
1017 | grid [ entry $expgui(diffBox).eDCpola \ |
---|
1018 | -textvariable entryvar(pola) -width 15 ] -column 4 -row 4 |
---|
1019 | grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \ |
---|
1020 | -column 5 -row 4 |
---|
1021 | grid [ entry $expgui(diffBox).eDCipola -width 2 \ |
---|
1022 | -textvariable entryvar(ipola)] -column 6 -row 4 |
---|
1023 | } elseif {[string range $expmap(htype_$hist) 1 2] == "XC"} { |
---|
1024 | #--------------------------- |
---|
1025 | # CW - x-ray 2 wavelengths | |
---|
1026 | #--------------------------- |
---|
1027 | grid [ label $expgui(diffBox).lDCdifc -text wavelengths ] \ |
---|
1028 | -column 3 -row 1 -sticky w |
---|
1029 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
1030 | -width 15 ] -column 4 -row 1 |
---|
1031 | grid [ entry $expgui(diffBox).eDCdifa -textvariable entryvar(lam2) \ |
---|
1032 | -width 15 ] -column 5 -row 1 |
---|
1033 | # |
---|
1034 | grid [ label $expgui(diffBox).lDCrref -text "Refine ratio" ] \ |
---|
1035 | -column 1 -row 2 -sticky w |
---|
1036 | grid [ checkbutton $expgui(diffBox).rfDCrref \ |
---|
1037 | -variable entryvar(ratref) ] -column 2 -row 2 |
---|
1038 | grid [ label $expgui(diffBox).lDCratio -text Ratio ] \ |
---|
1039 | -column 3 -row 2 |
---|
1040 | grid [ entry $expgui(diffBox).eDCkratio \ |
---|
1041 | -textvariable entryvar(kratio) \ |
---|
1042 | -width 15 ] -column 4 -row 2 |
---|
1043 | # |
---|
1044 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
1045 | -column 3 -row 3 |
---|
1046 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
1047 | -width 15 ] -column 4 -row 3 |
---|
1048 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
1049 | -column 1 -row 3 -sticky w |
---|
1050 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
1051 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1052 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
1053 | -column 1 -row 4 -sticky w |
---|
1054 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
1055 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
1056 | grid [ label $expgui(diffBox).lDCpola -text POLA ] \ |
---|
1057 | -column 3 -row 4 |
---|
1058 | grid [ entry $expgui(diffBox).eDCpola \ |
---|
1059 | -textvariable entryvar(pola) -width 15 ] -column 4 -row 4 |
---|
1060 | grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \ |
---|
1061 | -column 5 -row 4 |
---|
1062 | grid [ entry $expgui(diffBox).eDCipola -width 2 \ |
---|
1063 | -textvariable entryvar(ipola)] -column 6 -row 4 |
---|
1064 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1065 | } elseif {[string range $expmap(htype_$hist) 1 2] == "XE"} { |
---|
1066 | #------------- |
---|
1067 | # ED - x-ray | |
---|
1068 | #------------- |
---|
1069 | grid [ label $expgui(diffBox).lDC1 -text "Refine 2theta" ] \ |
---|
1070 | -column 1 -row 1 |
---|
1071 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(ttref) ] \ |
---|
1072 | -column 2 -row 1 |
---|
1073 | grid [ label $expgui(diffBox).lDCdifc -text 2Theta ] \ |
---|
1074 | -column 3 -row 1 -sticky w |
---|
1075 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
1076 | -width 15 ] -column 4 -row 1 |
---|
1077 | # |
---|
1078 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
1079 | -column 1 -row 4 -sticky w |
---|
1080 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
1081 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
1082 | grid [ label $expgui(diffBox).lDCpola -text POLA ] \ |
---|
1083 | -column 3 -row 4 |
---|
1084 | grid [ entry $expgui(diffBox).eDCpola \ |
---|
1085 | -textvariable entryvar(pola) -width 15 ] -column 4 -row 4 |
---|
1086 | grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \ |
---|
1087 | -column 5 -row 4 |
---|
1088 | grid [ entry $expgui(diffBox).eDCipola -width 2 \ |
---|
1089 | -textvariable entryvar(ipola)] -column 6 -row 4 |
---|
1090 | } |
---|
1091 | } elseif {$expgui(globalmode) == 1} { |
---|
1092 | #------------- |
---|
1093 | # Global TOF | |
---|
1094 | #------------- |
---|
1095 | grid [ label $expgui(diffBox).lDCrc -text "Refine DIFC" ] \ |
---|
1096 | -column 1 -row 1 |
---|
1097 | grid [ checkbutton $expgui(diffBox).rfDCrc -variable entryvar(dcref) ] \ |
---|
1098 | -column 2 -row 1 |
---|
1099 | grid [button $expgui(diffBox).bDCdifc -text "Set DIFC Globally" \ |
---|
1100 | -command "editglobalparm histinfo difc {DIFC}"] -column 3 -row 1 |
---|
1101 | # |
---|
1102 | grid [ label $expgui(diffBox).lDCra -text "Refine DIFA" ] \ |
---|
1103 | -column 1 -row 2 |
---|
1104 | grid [ checkbutton $expgui(diffBox).rfDCra -variable entryvar(daref) ] \ |
---|
1105 | -column 2 -row 2 |
---|
1106 | grid [ button $expgui(diffBox).bDCdifa -text "Set DIFA Globally" \ |
---|
1107 | -command "editglobalparm histinfo difa {DIFA}"] -column 3 -row 2 |
---|
1108 | # |
---|
1109 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
1110 | -column 1 -row 3 -sticky w |
---|
1111 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
1112 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1113 | grid [ button $expgui(diffBox).bDCzero -text "Set ZERO Globally" \ |
---|
1114 | -command "editglobalparm histinfo zero {Zero}"] -column 3 -row 3 |
---|
1115 | } elseif {$expgui(globalmode) == 2} { |
---|
1116 | #-------------------- |
---|
1117 | # Global CW neutron | |
---|
1118 | #-------------------- |
---|
1119 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
1120 | -column 1 -row 1 |
---|
1121 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
1122 | -column 2 -row 1 |
---|
1123 | grid [button $expgui(diffBox).bDCdifc -text "Set Wave Globally" \ |
---|
1124 | -command "editglobalparm histinfo lam1 Wavelength"] \ |
---|
1125 | -column 3 -row 1 |
---|
1126 | # |
---|
1127 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
1128 | -column 1 -row 3 -sticky w |
---|
1129 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
1130 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1131 | grid [button $expgui(diffBox).bDCzero -text "Set Zero Globally" \ |
---|
1132 | -command "editglobalparm histinfo zero Zero"] -column 3 -row 3 |
---|
1133 | } elseif {$expgui(globalmode) == 4} { |
---|
1134 | #---------------------- |
---|
1135 | # Global CW mono xray | |
---|
1136 | #---------------------- |
---|
1137 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
1138 | -column 1 -row 1 |
---|
1139 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
1140 | -column 2 -row 1 |
---|
1141 | grid [button $expgui(diffBox).bDCdifc -text "Set Wave Globally" \ |
---|
1142 | -command "editglobalparm histinfo lam1 Wavelength"] \ |
---|
1143 | -column 3 -row 1 |
---|
1144 | # |
---|
1145 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
1146 | -column 1 -row 3 -sticky w |
---|
1147 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
1148 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1149 | grid [button $expgui(diffBox).bDCzero -text "Set Zero Globally" \ |
---|
1150 | -command "editglobalparm histinfo zero Zero"] -column 3 -row 3 |
---|
1151 | # |
---|
1152 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
1153 | -column 1 -row 4 -sticky w |
---|
1154 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
1155 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
1156 | grid [button $expgui(diffBox).bDCpola -text "Set POLA Globally" \ |
---|
1157 | -command "editglobalparm histinfo pola POLA"] -column 3 -row 4 |
---|
1158 | grid [button $expgui(diffBox).bDCipola -text "Set IPOLA Globally" \ |
---|
1159 | -command "editglobalparm histinfo ipola IPOLA"] -column 4 -row 4 |
---|
1160 | } elseif {$expgui(globalmode) == 3} { |
---|
1161 | #------------------------ |
---|
1162 | # Global alpha 1,2 xray | |
---|
1163 | #------------------------ |
---|
1164 | grid [button $expgui(diffBox).bDCl1 -text "Set Wave1 Globally" \ |
---|
1165 | -command "editglobalparm histinfo lam1 {Wavelength 1}"] \ |
---|
1166 | -column 3 -row 1 |
---|
1167 | grid [button $expgui(diffBox).bDCl2 -text "Set Wave2 Globally" \ |
---|
1168 | -command "editglobalparm histinfo lam2 {Wavelength 2}"] \ |
---|
1169 | -column 4 -row 1 |
---|
1170 | # |
---|
1171 | grid [ label $expgui(diffBox).lDCratref -text "Refine Ratio" ] \ |
---|
1172 | -column 1 -row 3 -sticky w |
---|
1173 | grid [ checkbutton $expgui(diffBox).rfDCratref \ |
---|
1174 | -variable entryvar(ratref) ] -column 2 -row 3 |
---|
1175 | grid [button $expgui(diffBox).bDCrrat -text "Set Ratio Globally" \ |
---|
1176 | -command "editglobalparm histinfo ratio {Wavelength Ratio}"] \ |
---|
1177 | -column 3 -row 3 |
---|
1178 | # |
---|
1179 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
1180 | -column 1 -row 3 -sticky w |
---|
1181 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
1182 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
1183 | grid [button $expgui(diffBox).bDCzero -text "Set Zero Globally" \ |
---|
1184 | -command "editglobalparm histinfo zero Zero"] -column 3 -row 3 |
---|
1185 | # |
---|
1186 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
1187 | -column 1 -row 4 -sticky w |
---|
1188 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
1189 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
1190 | grid [button $expgui(diffBox).bDCpola -text "Set POLA Globally" \ |
---|
1191 | -command "editglobalparm histinfo pola POLA"] -column 3 -row 4 |
---|
1192 | grid [button $expgui(diffBox).bDCipola -text "Set IPOLA Globally" \ |
---|
1193 | -command "editglobalparm histinfo ipola IPOLA"] -column 4 -row 4 |
---|
1194 | } elseif {$expgui(globalmode) == 5} { |
---|
1195 | #----------------- |
---|
1196 | # Global ED xray | |
---|
1197 | #----------------- |
---|
1198 | grid [ label $expgui(diffBox).lDC1 -text "Refine 2theta" ] \ |
---|
1199 | -column 1 -row 1 |
---|
1200 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(ttref) ] \ |
---|
1201 | -column 2 -row 1 |
---|
1202 | grid [button $expgui(diffBox).bDCdifc -text "Set 2Theta Globally" \ |
---|
1203 | -command "editglobalparm histinfo ratio {Fixed 2Theta}"] \ |
---|
1204 | -column 3 -row 1 |
---|
1205 | # |
---|
1206 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
1207 | -column 1 -row 4 -sticky w |
---|
1208 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
1209 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
1210 | grid [button $expgui(diffBox).bDCpola -text "Set POLA Globally" \ |
---|
1211 | -command "editglobalparm histinfo pola POLA"] -column 3 -row 4 |
---|
1212 | grid [button $expgui(diffBox).bDCipola -text "Set IPOLA Globally" \ |
---|
1213 | -command "editglobalparm histinfo ipola IPOLA"] -column 4 -row 4 |
---|
1214 | } |
---|
1215 | if {$expgui(globalmode) == 0} { |
---|
1216 | grid [frame $expgui(diffBox).d] -column 5 -row 5 \ |
---|
1217 | -columnspan 2 -sticky e |
---|
1218 | } else { |
---|
1219 | grid [frame $expgui(diffBox).d] -column 4 -row 5 \ |
---|
1220 | -columnspan 2 -sticky e |
---|
1221 | } |
---|
1222 | grid [label $expgui(diffBox).d.lDamp -text "Damping "] \ |
---|
1223 | -column 1 -row 1 |
---|
1224 | tk_optionMenu $expgui(diffBox).d.om entryvar(ddamp) 0 1 2 3 4 5 6 7 8 9 |
---|
1225 | grid $expgui(diffBox).d.om -column 2 -row 1 |
---|
1226 | grid columnconfigure $expgui(diffBox) 9 -weight 1 |
---|
1227 | grid columnconfigure $expgui(diffBox) 0 -weight 1 |
---|
1228 | update idletasks |
---|
1229 | # enable traces on entryvar now |
---|
1230 | set entrycmd(trace) 1 |
---|
1231 | } |
---|
1232 | |
---|
1233 | #----------------------------------------------------------------------- |
---|
1234 | # populate the Phase Fraction page |
---|
1235 | #----------------------------------------------------------------------- |
---|
1236 | proc DisplayFrac {} { |
---|
1237 | global expgui entrycmd entryvar expmap |
---|
1238 | |
---|
1239 | # display the selected histograms |
---|
1240 | $expgui(fracFrame).hs.lbox selection clear 0 end |
---|
1241 | foreach h $expgui(curhist) { |
---|
1242 | $expgui(fracFrame).hs.lbox selection set $h |
---|
1243 | } |
---|
1244 | |
---|
1245 | # disable traces on entryvar |
---|
1246 | set entrycmd(trace) 0 |
---|
1247 | |
---|
1248 | # get histogram list |
---|
1249 | set histlist {} |
---|
1250 | foreach item $expgui(curhist) { |
---|
1251 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
1252 | } |
---|
1253 | |
---|
1254 | set phaseFractf1 $expgui(fracFrame).f1 |
---|
1255 | # destroy the contents of the frame |
---|
1256 | eval destroy [pack slaves $phaseFractf1] |
---|
1257 | if {$expgui(globalmode) != 0} { |
---|
1258 | pack [frame $expgui(fracFrame).f1.top] \ |
---|
1259 | -side top -anchor center |
---|
1260 | pack [label $expgui(fracFrame).f1.top.txt \ |
---|
1261 | -text "Selected Histograms: [CompressList $histlist]"] -side left |
---|
1262 | } |
---|
1263 | # Create the frame inside the canvas, One frame for each Phase. |
---|
1264 | foreach i {1 2 3 4 5 6 7 8 9} {set phasehistlist($i) ""} |
---|
1265 | foreach hist $histlist { |
---|
1266 | foreach i $expmap(phaselist_$hist) { |
---|
1267 | lappend phasehistlist($i) $hist |
---|
1268 | } |
---|
1269 | } |
---|
1270 | foreach i {1 2 3 4 5 6 7 8 9} { |
---|
1271 | if {[llength $phasehistlist($i)] == 0} continue |
---|
1272 | set framePF [frame $phaseFractf1.pF$i -relief groove -bd 4] |
---|
1273 | pack $framePF -pady 1 -side top -anchor w |
---|
1274 | |
---|
1275 | # Label Heading for each phase. |
---|
1276 | if {$expgui(globalmode) != 0} { |
---|
1277 | grid [label $framePF.l1 \ |
---|
1278 | -text "Phase $i Hist: [CompressList $phasehistlist($i)] Phase Fraction"] \ |
---|
1279 | -column 0 -row 0 -sticky nws |
---|
1280 | grid [button $framePF.but1 -text "Set Globally" \ |
---|
1281 | -command "editglobalparm hapinfo frac \"Phase $i Fraction\" \ |
---|
1282 | [list $phasehistlist($i)] $i" \ |
---|
1283 | ] -column 1 -row 0 |
---|
1284 | } else { |
---|
1285 | grid [label $framePF.l1 -text "Phase $i Phase fraction"] \ |
---|
1286 | -column 0 -row 0 -sticky nws |
---|
1287 | grid [entry $framePF.ent -textvariable entryvar(frac$i) -width 15]\ |
---|
1288 | -column 1 -row 0 |
---|
1289 | } |
---|
1290 | set entrycmd(frac$i) "hapinfo $hist $i frac" |
---|
1291 | set entryvar(frac$i) [hapinfo $hist $i frac] |
---|
1292 | grid [label $framePF.l2 -text " Refine"] \ |
---|
1293 | -column 2 -row 0 -sticky nws |
---|
1294 | grid [checkbutton $framePF.cb -variable entryvar(frref$i)] \ |
---|
1295 | -column 3 -row 0 -sticky nws |
---|
1296 | set entrycmd(frref$i) "hapinfo $hist $i frref" |
---|
1297 | set entryvar(frref$i) [hapinfo $hist $i frref] |
---|
1298 | grid [label $framePF.l3 -text " Damping"] \ |
---|
1299 | -column 4 -row 0 -sticky nws |
---|
1300 | tk_optionMenu $framePF.tkOptDamp entryvar(frdamp$i) \ |
---|
1301 | 0 1 2 3 4 5 6 7 8 9 |
---|
1302 | set entrycmd(frdamp$i) "hapinfo $hist $i frdamp" |
---|
1303 | set entryvar(frdamp$i) [hapinfo $hist $i frdamp] |
---|
1304 | grid $framePF.tkOptDamp -row 0 -sticky nsw -column 5 |
---|
1305 | } |
---|
1306 | update idletasks |
---|
1307 | # enable traces on entryvar now |
---|
1308 | set entrycmd(trace) 1 |
---|
1309 | } |
---|
1310 | |
---|
1311 | #----------------------------------------------------------------------- |
---|
1312 | # display the profile page |
---|
1313 | #----------------------------------------------------------------------- |
---|
1314 | proc DisplayProfile {} { |
---|
1315 | global expgui entrycmd entryvar expmap |
---|
1316 | $expgui(profFrame).hs.lbox selection clear 0 end |
---|
1317 | foreach h $expgui(curhist) { |
---|
1318 | $expgui(profFrame).hs.lbox selection set $h |
---|
1319 | } |
---|
1320 | |
---|
1321 | # disable traces on entryvar for right now |
---|
1322 | set entrycmd(trace) 0 |
---|
1323 | # destroy the contents of the frame |
---|
1324 | eval destroy [grid slaves $expgui(ProfileBox).f] |
---|
1325 | |
---|
1326 | if {$expgui(globalmode) == 0} { |
---|
1327 | set hist [lindex $expmap(powderlist) $expgui(curhist)] |
---|
1328 | # Create one frame for each Phase. |
---|
1329 | set ind -1 |
---|
1330 | set htype [string range $expmap(htype_$hist) 2 2] |
---|
1331 | foreach i $expmap(phaselist_$hist) { |
---|
1332 | incr ind |
---|
1333 | grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \ |
---|
1334 | -column 0 -row $ind -sticky ew |
---|
1335 | grid [frame $expgui(ProfileBox).f.$i.1] \ |
---|
1336 | -column 0 -row 0 -columnspan 10 -sticky ew |
---|
1337 | # Label Heading for each phase. |
---|
1338 | set ptype [string trim [hapinfo $hist $i proftype]] |
---|
1339 | pack [label $expgui(ProfileBox).f.$i.1.l \ |
---|
1340 | -text "Phase $i -- type $ptype Damping"]\ |
---|
1341 | -side left |
---|
1342 | tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp entryvar(pdamp_$i) \ |
---|
1343 | 0 1 2 3 4 5 6 7 8 9 |
---|
1344 | set entrycmd(pdamp_$i) "hapinfo $hist $i pdamp" |
---|
1345 | set entryvar(pdamp_$i) [hapinfo $hist $i pdamp] |
---|
1346 | pack $expgui(ProfileBox).f.$i.1.tkOptDamp -side left |
---|
1347 | pack [label $expgui(ProfileBox).f.$i.1.l1 \ |
---|
1348 | -text " Peak cutoff"]\ |
---|
1349 | -side left |
---|
1350 | pack [entry $expgui(ProfileBox).f.$i.1.e1 \ |
---|
1351 | -width 10 -textvariable entryvar(pcut_$i)]\ |
---|
1352 | -side left |
---|
1353 | set entrycmd(pcut_$i) "hapinfo $hist $i pcut" |
---|
1354 | set entryvar(pcut_$i) [hapinfo $hist $i pcut] |
---|
1355 | |
---|
1356 | set col -1 |
---|
1357 | set row 1 |
---|
1358 | set nterms [hapinfo $hist $i profterms] |
---|
1359 | set lbls $expgui(prof-$htype-$ptype) |
---|
1360 | # for type 4, add extra terms depending on the cell type |
---|
1361 | if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $i]} |
---|
1362 | for { set num 1 } { $num <= $nterms } { incr num } { |
---|
1363 | set term {} |
---|
1364 | catch {set term [lindex $lbls $num]} |
---|
1365 | if {$term == ""} {set term $num} |
---|
1366 | incr col |
---|
1367 | grid [label $expgui(ProfileBox).f.$i.l${num}_${i} -text "$term"] \ |
---|
1368 | -row $row -column $col |
---|
1369 | incr col |
---|
1370 | grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \ |
---|
1371 | -variable entryvar(pref${num}_$i)] -row $row -column $col |
---|
1372 | set entrycmd(pref${num}_$i) "hapinfo $hist $i pref$num" |
---|
1373 | set entryvar(pref${num}_$i) [hapinfo $hist $i pref$num] |
---|
1374 | incr col |
---|
1375 | grid [entry $expgui(ProfileBox).f.$i.ent${num}_${i} \ |
---|
1376 | -textvariable entryvar(pterm${num}_$i)\ |
---|
1377 | -width 14] -row $row -column $col |
---|
1378 | set entrycmd(pterm${num}_$i) "hapinfo $hist $i pterm$num" |
---|
1379 | set entryvar(pterm${num}_$i) [hapinfo $hist $i pterm$num] |
---|
1380 | if {$col > 6} {set col -1; incr row} |
---|
1381 | } |
---|
1382 | } |
---|
1383 | grid columnconfigure $expgui(ProfileBox).f 0 -weight 1 |
---|
1384 | } else { |
---|
1385 | # get histogram list |
---|
1386 | set histlist {} |
---|
1387 | foreach item $expgui(curhist) { |
---|
1388 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
1389 | } |
---|
1390 | # loop through histograms & phases, set up an array by type |
---|
1391 | catch {unset ptypearray histarray phasearray} |
---|
1392 | foreach hist $histlist { |
---|
1393 | foreach i $expmap(phaselist_$hist) { |
---|
1394 | set ptype [string trim [hapinfo $hist $i proftype]] |
---|
1395 | lappend ptypearray(${ptype}_$i) $hist |
---|
1396 | lappend histarray($ptype) $hist |
---|
1397 | lappend phasearray($ptype) $i |
---|
1398 | } |
---|
1399 | } |
---|
1400 | |
---|
1401 | set ptype "" |
---|
1402 | set title "" |
---|
1403 | set ind -1 |
---|
1404 | foreach key "[lsort [array names ptypearray]] 0_0" { |
---|
1405 | # split key |
---|
1406 | scan $key %d_%d type p |
---|
1407 | # 1st time through |
---|
1408 | if {$ptype == ""} {set ptype $type} |
---|
1409 | if {$ptype == $type} { |
---|
1410 | # we've seen this one before |
---|
1411 | if {$title != ""} {append title "\n"} |
---|
1412 | append title "Phase $p, hist [CompressList $ptypearray($key)]" |
---|
1413 | } else { |
---|
1414 | set hist [lindex $histarray($ptype) 0] |
---|
1415 | set phase [lindex $phasearray($ptype) 0] |
---|
1416 | set nterms [hapinfo $hist $phase profterms] |
---|
1417 | set htype [string range $expmap(htype_$hist) 2 2] |
---|
1418 | set lbls $expgui(prof-$htype-$ptype) |
---|
1419 | set i $ptype |
---|
1420 | # Create one frame for this type |
---|
1421 | incr ind |
---|
1422 | grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \ |
---|
1423 | -column 0 -row $ind -sticky ew |
---|
1424 | grid [frame $expgui(ProfileBox).f.$i.0] \ |
---|
1425 | -column 0 -row 0 -columnspan 20 -sticky ew |
---|
1426 | grid [label $expgui(ProfileBox).f.$i.0.0 \ |
---|
1427 | -text "Profile Type $ptype "] -row 0 -column 0 |
---|
1428 | grid [label $expgui(ProfileBox).f.$i.0.1 \ |
---|
1429 | -text $title -anchor w] -row 0 -column 1 |
---|
1430 | grid [frame $expgui(ProfileBox).f.$i.1] \ |
---|
1431 | -column 0 -row 1 -columnspan 20 -sticky ew |
---|
1432 | grid [label $expgui(ProfileBox).f.$i.1.2 \ |
---|
1433 | -text "Damping"] -row 0 -column 2 |
---|
1434 | tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp \ |
---|
1435 | entryvar(pdamp_$ptype) 0 1 2 3 4 5 6 7 8 9 |
---|
1436 | set entrycmd(pdamp_$ptype) "hapinfo \ |
---|
1437 | [list $histarray($ptype)] \ |
---|
1438 | [list $phasearray($ptype)] pdamp" |
---|
1439 | set entryvar(pdamp_$ptype) [hapinfo $hist $phase pdamp] |
---|
1440 | grid $expgui(ProfileBox).f.$i.1.tkOptDamp -row 0 -column 3 |
---|
1441 | grid [button $expgui(ProfileBox).f.$i.1.edit \ |
---|
1442 | -text "Global Edit" \ |
---|
1443 | -command "EditProfile [list $title] \ |
---|
1444 | [list $histarray($ptype)] [list $phasearray($ptype)] " \ |
---|
1445 | ] -row 0 -column 4 -sticky w |
---|
1446 | # for type 4, add extra terms depending on the cell type |
---|
1447 | if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $phase]} |
---|
1448 | set col -1 |
---|
1449 | set row 2 |
---|
1450 | for { set num 1 } { $num <= $nterms } { incr num } { |
---|
1451 | set term {} |
---|
1452 | catch {set term [lindex $lbls $num]} |
---|
1453 | if {$term == ""} {set term $num} |
---|
1454 | incr col |
---|
1455 | grid [label $expgui(ProfileBox).f.$i.l${num}_${i} -text "$term"] \ |
---|
1456 | -row $row -column $col |
---|
1457 | incr col |
---|
1458 | grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \ |
---|
1459 | -variable entryvar(pref${num}_$i)] \ |
---|
1460 | -row $row -column $col |
---|
1461 | set entrycmd(pref${num}_$i) "hapinfo \ |
---|
1462 | [list $histarray($ptype)] \ |
---|
1463 | [list $phasearray($ptype)] pref$num" |
---|
1464 | set entryvar(pref${num}_$i) [hapinfo $hist $phase pref$num] |
---|
1465 | if {$col > 10} {set col -1; incr row} |
---|
1466 | } |
---|
1467 | grid columnconfigure $expgui(ProfileBox).f 0 -weight 1 |
---|
1468 | set ptype "" |
---|
1469 | } |
---|
1470 | } |
---|
1471 | } |
---|
1472 | |
---|
1473 | # resize the scroll window to match the actual |
---|
1474 | update idletasks |
---|
1475 | $expgui(ProfileBox) config -scrollregion [grid bbox $expgui(ProfileBox).f] |
---|
1476 | $expgui(ProfileBox) config -width [lindex [grid bbox $expgui(ProfileBox).f] 2] |
---|
1477 | update idletasks |
---|
1478 | # enable traces on entryvar now |
---|
1479 | set entrycmd(trace) 1 |
---|
1480 | } |
---|
1481 | |
---|
1482 | # profile labels for type 4 profile |
---|
1483 | proc type4lbls {lbls nterms phase} { |
---|
1484 | if {$nterms == 14} { |
---|
1485 | # cubic |
---|
1486 | lappend lbls S400 S220 |
---|
1487 | } elseif {$nterms == 15} { |
---|
1488 | # hexagonal |
---|
1489 | lappend lbls S400 S004 S202 |
---|
1490 | } elseif {$nterms == 16} { |
---|
1491 | # tetragonal or rhombohedral |
---|
1492 | if {[phaseinfo $phase a] == [phaseinfo $phase c]} { |
---|
1493 | # rhombohedral |
---|
1494 | lappend lbls S400 S220 S310 S211 |
---|
1495 | } else { |
---|
1496 | lappend lbls S400 S004 S220 S202 |
---|
1497 | } |
---|
1498 | } elseif {$nterms == 18} { |
---|
1499 | # orthorhombic |
---|
1500 | lappend lbls S400 S040 S004 S220 S202 S022 |
---|
1501 | } elseif {$nterms == 21} { |
---|
1502 | # monoclinic |
---|
1503 | lappend lbls S400 S040 S004 S220 S202 S022 S301 S103 S121 |
---|
1504 | } elseif {$nterms == 25} { |
---|
1505 | # triclinic |
---|
1506 | lappend lbls S400 S040 S004 S220 S202 S022 S310 S103 S031 \ |
---|
1507 | S130 S301 S013 S211 S121 S112 |
---|
1508 | } |
---|
1509 | return $lbls |
---|
1510 | } |
---|
1511 | |
---|
1512 | # process the bit settings in the print options |
---|
1513 | # bitnum -- the number of the bit to be tested/set starting at 0 for the LSBit |
---|
1514 | proc printsetting {bitnum "action get" "value {}"} { |
---|
1515 | global entryvar expgui |
---|
1516 | if {$action == "get"} { |
---|
1517 | return [expr ([expinfo print] & int(pow(2,$bitnum))) != 0] |
---|
1518 | } elseif $value { |
---|
1519 | set newval [expr ([expinfo print] | int(pow(2,$bitnum)))] |
---|
1520 | } else { |
---|
1521 | set newval [expr ([expinfo print] & ~int(pow(2,$bitnum)))] |
---|
1522 | } |
---|
1523 | expinfo print set $newval |
---|
1524 | set expgui(printopt) "Print Options ([expinfo print])" |
---|
1525 | } |
---|
1526 | #---------------------------- Global Edit Functions ------------------------ |
---|
1527 | proc editbackground {} { |
---|
1528 | global expgui expmap entrycmd |
---|
1529 | set w .back |
---|
1530 | catch {destroy $w} |
---|
1531 | toplevel $w -bg beige |
---|
1532 | set histlist {} |
---|
1533 | foreach n $expgui(curhist) { |
---|
1534 | lappend histlist [lindex $expmap(powderlist) $n] |
---|
1535 | } |
---|
1536 | if {$expgui(globalmode) != 0} { |
---|
1537 | wm title $w "Edit Background" |
---|
1538 | } else { |
---|
1539 | wm title $w "Global Edit Background" |
---|
1540 | } |
---|
1541 | |
---|
1542 | pack [frame $w.0 -bd 6 -relief groove -bg beige \ |
---|
1543 | ] -side top -expand yes -fill both |
---|
1544 | if {[llength $histlist] > 1} { |
---|
1545 | grid [label $w.0.a \ |
---|
1546 | -text "Setting background terms for histograms [CompressList $histlist]" \ |
---|
1547 | -bg beige] -row 0 -column 0 -columnspan 10 |
---|
1548 | } else { |
---|
1549 | grid [label $w.0.a \ |
---|
1550 | -text "Setting background terms for histogram $histlist" \ |
---|
1551 | -bg beige] -row 0 -column 0 -columnspan 10 |
---|
1552 | } |
---|
1553 | set hist [lindex $histlist 0] |
---|
1554 | grid [label $w.0.b -text "Function type" -bg beige] -row 1 -column 0 |
---|
1555 | |
---|
1556 | # disable traces on expgui(backtype) & expgui(backterms) now |
---|
1557 | set entrycmd(trace) 0 |
---|
1558 | |
---|
1559 | # number of terms |
---|
1560 | set expgui(backtype) [histinfo $hist backtype] |
---|
1561 | set expgui(orig_backtype) $expgui(backtype) |
---|
1562 | set expgui(prev_backtype) $expgui(backtype) |
---|
1563 | eval tk_optionMenu $w.0.type expgui(backtype) {1 2 3 4 5 6} |
---|
1564 | grid $w.0.type -row 1 -column 1 |
---|
1565 | grid [label $w.0.c -text " Number of terms" -bg beige] -row 1 -column 2 |
---|
1566 | |
---|
1567 | # function type |
---|
1568 | set expgui(backterms) [histinfo $hist backterms] |
---|
1569 | set expgui(orig_backterms) $expgui(backterms) |
---|
1570 | set list {}; for {set i 1} {$i <= 36} {incr i} {lappend list $i} |
---|
1571 | eval tk_optionMenu $w.0.terms expgui(backterms) $list |
---|
1572 | grid $w.0.terms -row 1 -column 3 |
---|
1573 | # enable traces on expgui(backtype) & expgui(backterms) now |
---|
1574 | set entrycmd(trace) 1 |
---|
1575 | |
---|
1576 | #set background terms |
---|
1577 | for {set num 1 } { $num <= 36 } { incr num } { |
---|
1578 | set var "bterm$num" |
---|
1579 | set expgui($var) {} |
---|
1580 | set expgui(orig_$var) {} |
---|
1581 | } |
---|
1582 | if {[llength $histlist] == 1} { |
---|
1583 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
1584 | set var "bterm$num" |
---|
1585 | set expgui($var) [histinfo $histlist $var] |
---|
1586 | set expgui(orig_$var) $expgui($var) |
---|
1587 | } |
---|
1588 | } |
---|
1589 | |
---|
1590 | pack [frame $w.1 -bd 6 -relief groove -bg beige] -side top \ |
---|
1591 | -expand yes -fill both |
---|
1592 | ShowBackTerms $w.1 |
---|
1593 | |
---|
1594 | set expgui(temp) {} |
---|
1595 | pack [frame $w.b] -side top |
---|
1596 | pack [button $w.b.2 -text Set -command "destroy $w"] -side left |
---|
1597 | pack [button $w.b.3 -text Quit \ |
---|
1598 | -command "QuitEditBackground $w"] -side left |
---|
1599 | # force the window to stay on top |
---|
1600 | wm transient $w [winfo toplevel [winfo parent $w]] |
---|
1601 | |
---|
1602 | bind $w <Return> "destroy $w" |
---|
1603 | wm withdraw $w |
---|
1604 | update idletasks |
---|
1605 | # center the new window in the middle of the parent |
---|
1606 | set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ |
---|
1607 | [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] |
---|
1608 | set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ |
---|
1609 | [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] |
---|
1610 | wm geom $w +$x+$y |
---|
1611 | wm deiconify $w |
---|
1612 | |
---|
1613 | set oldFocus [focus] |
---|
1614 | set oldGrab [grab current $w] |
---|
1615 | if {$oldGrab != ""} { |
---|
1616 | set grabStatus [grab status $oldGrab] |
---|
1617 | } |
---|
1618 | grab $w |
---|
1619 | focus $w.b.2 |
---|
1620 | tkwait window $w |
---|
1621 | |
---|
1622 | catch {focus $oldFocus} |
---|
1623 | if {$oldGrab != ""} { |
---|
1624 | if {$grabStatus == "global"} { |
---|
1625 | grab -global $oldGrab |
---|
1626 | } else { |
---|
1627 | grab $oldGrab |
---|
1628 | } |
---|
1629 | } |
---|
1630 | |
---|
1631 | if {$expgui(temp) != ""} return |
---|
1632 | |
---|
1633 | if {$expgui(orig_backtype) != $expgui(backtype)} { |
---|
1634 | histinfo $histlist backtype set $expgui(backtype) |
---|
1635 | } |
---|
1636 | if {$expgui(orig_backterms) != $expgui(backterms)} { |
---|
1637 | histinfo $histlist backterms set $expgui(backterms) |
---|
1638 | } |
---|
1639 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
1640 | set var "bterm$num" |
---|
1641 | if {$expgui(orig_$var) != $expgui($var)} { |
---|
1642 | histinfo $histlist $var set $expgui($var) |
---|
1643 | } |
---|
1644 | } |
---|
1645 | |
---|
1646 | if {$expgui(globalmode) == 0} { |
---|
1647 | set expgui(backtypelbl) "Function type [histinfo $hist backtype]" |
---|
1648 | set expgui(backtermlbl) "([histinfo $hist backterms] terms)" |
---|
1649 | } |
---|
1650 | } |
---|
1651 | |
---|
1652 | trace variable expgui(backterms) w ChangeBackTerms |
---|
1653 | proc ChangeBackTerms {a b c} { |
---|
1654 | global entrycmd expgui |
---|
1655 | if !$entrycmd(trace) return |
---|
1656 | ShowBackTerms .back.1 |
---|
1657 | } |
---|
1658 | |
---|
1659 | trace variable expgui(backtype) w ChangeBackType |
---|
1660 | # reset the terms to 1, 0, 0... when the number of terms increase |
---|
1661 | proc ChangeBackType {a b c} { |
---|
1662 | global entrycmd expgui |
---|
1663 | if !$entrycmd(trace) return |
---|
1664 | if {$expgui(prev_backtype) == $expgui(backtype)} return |
---|
1665 | set expgui(prev_backtype) $expgui(backtype) |
---|
1666 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
1667 | set var "bterm$num" |
---|
1668 | if {$num == 1} { |
---|
1669 | set expgui($var) 1.0 |
---|
1670 | } else { |
---|
1671 | set expgui($var) 0.0 |
---|
1672 | } |
---|
1673 | } |
---|
1674 | } |
---|
1675 | |
---|
1676 | proc ShowBackTerms {w } { |
---|
1677 | global expgui expmap |
---|
1678 | # destroy the contents of the frame |
---|
1679 | eval destroy [grid slaves $w] |
---|
1680 | set histlist {} |
---|
1681 | foreach n $expgui(curhist) { |
---|
1682 | lappend histlist [lindex $expmap(powderlist) $n] |
---|
1683 | } |
---|
1684 | set widgetsPerRow 4 |
---|
1685 | for {set rows 2; set num 1 } { $num <= $expgui(backterms) } { incr rows } { |
---|
1686 | for {set cols 0} { (2*$widgetsPerRow > $cols) && ($num <= $expgui(backterms)) } { incr num } { |
---|
1687 | set var "bterm$num" |
---|
1688 | grid [label $w.l$num -text $num -bg beige] \ |
---|
1689 | -row $rows -column $cols -sticky nes |
---|
1690 | incr cols |
---|
1691 | grid [entry $w.e$num -width 15 -textvariable expgui($var) \ |
---|
1692 | ] -row $rows -column $cols -sticky news |
---|
1693 | incr cols |
---|
1694 | } |
---|
1695 | } |
---|
1696 | } |
---|
1697 | |
---|
1698 | proc QuitEditBackground {w} { |
---|
1699 | global expgui |
---|
1700 | # lets find out if anything changed |
---|
1701 | set changed 0 |
---|
1702 | if {$expgui(orig_backtype) != $expgui(backtype)} { |
---|
1703 | set changed 1 |
---|
1704 | } |
---|
1705 | if {$expgui(orig_backterms) != $expgui(backterms)} { |
---|
1706 | set changed 1 |
---|
1707 | } |
---|
1708 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
1709 | set var "bterm$num" |
---|
1710 | if {$expgui(orig_$var) != $expgui($var)} { |
---|
1711 | set changed 1 |
---|
1712 | break |
---|
1713 | } |
---|
1714 | } |
---|
1715 | if $changed { |
---|
1716 | set decision [tk_dialog .changes "Abandon Changes" \ |
---|
1717 | "You have made changes to the background. Ok to abandon changes?" \ |
---|
1718 | warning 0 Abandon Keep] |
---|
1719 | if !$decision { |
---|
1720 | set expgui(temp) "Quit" |
---|
1721 | destroy $w |
---|
1722 | } |
---|
1723 | } else { |
---|
1724 | set expgui(temp) "Quit" |
---|
1725 | destroy $w |
---|
1726 | } |
---|
1727 | } |
---|
1728 | |
---|
1729 | # this probably needs work |
---|
1730 | proc editglobalparm {cmd variable title "histlist {}" "phase {}"} { |
---|
1731 | global expgui expmap |
---|
1732 | set w .global |
---|
1733 | catch {destroy $w} |
---|
1734 | toplevel $w -bg beige |
---|
1735 | wm title $w "Edit Global Parameter" |
---|
1736 | set expgui(temp) {} |
---|
1737 | if {[llength $histlist] == 0} { |
---|
1738 | set hist {} |
---|
1739 | foreach n $expgui(curhist) { |
---|
1740 | lappend hist [lindex $expmap(powderlist) $n] |
---|
1741 | } |
---|
1742 | } else { |
---|
1743 | set hist $histlist |
---|
1744 | } |
---|
1745 | pack [frame $w.0 -bd 6 -relief groove -bg beige] \ |
---|
1746 | -side top -expand yes -fill both |
---|
1747 | grid [label $w.0.a -text "Setting $title for histograms [CompressList $hist]"\ |
---|
1748 | -bg beige] \ |
---|
1749 | -row 0 -column 0 -columnspan 10 |
---|
1750 | grid [entry $w.0.b -textvariable expgui(temp)] \ |
---|
1751 | -row 1 -column 0 |
---|
1752 | |
---|
1753 | |
---|
1754 | pack [frame $w.b] -side top |
---|
1755 | pack [button $w.b.2 -text Set -command "destroy $w"] -side left |
---|
1756 | pack [button $w.b.3 -text Quit -command "set expgui(temp) {}; destroy $w"] -side left |
---|
1757 | # force the window to stay on top |
---|
1758 | wm transient $w [winfo toplevel [winfo parent $w]] |
---|
1759 | |
---|
1760 | bind $w <Return> "destroy $w" |
---|
1761 | wm withdraw $w |
---|
1762 | update idletasks |
---|
1763 | # center the new window in the middle of the parent |
---|
1764 | set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ |
---|
1765 | [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] |
---|
1766 | set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ |
---|
1767 | [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] |
---|
1768 | wm geom $w +$x+$y |
---|
1769 | wm deiconify $w |
---|
1770 | |
---|
1771 | set oldFocus [focus] |
---|
1772 | set oldGrab [grab current $w] |
---|
1773 | if {$oldGrab != ""} { |
---|
1774 | set grabStatus [grab status $oldGrab] |
---|
1775 | } |
---|
1776 | grab $w |
---|
1777 | focus $w.b.2 |
---|
1778 | tkwait window $w |
---|
1779 | if {$expgui(temp) != ""} { |
---|
1780 | foreach h $hist { |
---|
1781 | if {$cmd == "histinfo"} { |
---|
1782 | histinfo $h $variable set $expgui(temp) |
---|
1783 | if $expgui(debug) { |
---|
1784 | puts "histinfo $h $variable set $expgui(temp)" |
---|
1785 | } |
---|
1786 | } elseif {$cmd == "hapinfo"} { |
---|
1787 | hapinfo $h $phase $variable set $expgui(temp) |
---|
1788 | if $expgui(debug) { |
---|
1789 | puts "hapinfo $phase $h $variable set $expgui(temp)" |
---|
1790 | } |
---|
1791 | } else { |
---|
1792 | error "$cmd unimplemented" |
---|
1793 | } |
---|
1794 | } |
---|
1795 | } |
---|
1796 | catch {focus $oldFocus} |
---|
1797 | if {$oldGrab != ""} { |
---|
1798 | if {$grabStatus == "global"} { |
---|
1799 | grab -global $oldGrab |
---|
1800 | } else { |
---|
1801 | grab $oldGrab |
---|
1802 | } |
---|
1803 | } |
---|
1804 | } |
---|
1805 | |
---|
1806 | proc EditProfile {title histlist phaselist} { |
---|
1807 | global expgui expmap entrycmd |
---|
1808 | set w .back |
---|
1809 | catch {destroy $w} |
---|
1810 | toplevel $w -bg beige |
---|
1811 | wm title $w "Global Edit Profile" |
---|
1812 | set hist [lindex $histlist 0] |
---|
1813 | set phase [lindex $phaselist 0] |
---|
1814 | set ptype [string trim [hapinfo $hist $phase proftype]] |
---|
1815 | set htype [string range $expmap(htype_$hist) 2 2] |
---|
1816 | set nterms [hapinfo $hist $phase profterms] |
---|
1817 | |
---|
1818 | pack [frame $w.0 -bd 6 -relief groove -bg beige \ |
---|
1819 | ] -side top -expand yes -fill both |
---|
1820 | grid [label $w.0.a \ |
---|
1821 | -text "Setting profile terms: $title" \ |
---|
1822 | -bg beige] -row 0 -column 0 -columnspan 10 |
---|
1823 | grid [label $w.0.b -text "Function type $ptype" -bg beige] -row 1 -column 0 |
---|
1824 | |
---|
1825 | # number of terms |
---|
1826 | # set expgui(backtype) [histinfo $hist backtype] |
---|
1827 | # set expgui(orig_backtype) $expgui(backtype) |
---|
1828 | # set expgui(prev_backtype) $expgui(backtype) |
---|
1829 | # eval tk_optionMenu $w.0.type expgui(backtype) {1 2 3 4 5 6} |
---|
1830 | # grid $w.0.type -row 1 -column 1 |
---|
1831 | |
---|
1832 | grid [label $w.0.c -text " Peak cutoff" -bg beige] -row 1 -column 3 |
---|
1833 | grid [entry $w.0.d -width 10 ] -row 1 -column 4 |
---|
1834 | set entrylist {} |
---|
1835 | lappend entrylist "pcut $w.0.d" |
---|
1836 | |
---|
1837 | set col -1 |
---|
1838 | set row 1 |
---|
1839 | set lbls $expgui(prof-$htype-$ptype) |
---|
1840 | # for type 4, add extra terms depending on the cell type |
---|
1841 | if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $i]} |
---|
1842 | pack [frame $w.1 -bd 6 -relief groove -bg beige \ |
---|
1843 | ] -side top -expand yes -fill both |
---|
1844 | for { set num 1 } { $num <= $nterms } { incr num } { |
---|
1845 | set term {} |
---|
1846 | catch {set term [lindex $lbls $num]} |
---|
1847 | if {$term == ""} {set term $num} |
---|
1848 | incr col |
---|
1849 | grid [label $w.1.l${num} -text "$term" -bg beige] \ |
---|
1850 | -row $row -column $col |
---|
1851 | incr col |
---|
1852 | grid [entry $w.1.ent${num} \ |
---|
1853 | -width 14] -row $row -column $col |
---|
1854 | lappend entrylist "pterm$num $w.1.ent${num}" |
---|
1855 | if {$col > 6} {set col -1; incr row} |
---|
1856 | } |
---|
1857 | pack [frame $w.b] -side top |
---|
1858 | pack [button $w.b.2 -text Set \ |
---|
1859 | -command "SetEditProfile [list $entrylist] [list $phaselist] \ |
---|
1860 | [list $histlist] $w"] -side left |
---|
1861 | pack [button $w.b.3 -text Quit \ |
---|
1862 | -command "QuitEditProfile $w [list $entrylist]"] -side left |
---|
1863 | # force the window to stay on top |
---|
1864 | wm transient $w [winfo toplevel [winfo parent $w]] |
---|
1865 | |
---|
1866 | bind $w <Return> "destroy $w" |
---|
1867 | wm withdraw $w |
---|
1868 | update idletasks |
---|
1869 | # center the new window in the middle of the parent |
---|
1870 | set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ |
---|
1871 | [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] |
---|
1872 | set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ |
---|
1873 | [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] |
---|
1874 | wm geom $w +$x+$y |
---|
1875 | wm deiconify $w |
---|
1876 | |
---|
1877 | set oldFocus [focus] |
---|
1878 | set oldGrab [grab current $w] |
---|
1879 | if {$oldGrab != ""} { |
---|
1880 | set grabStatus [grab status $oldGrab] |
---|
1881 | } |
---|
1882 | grab $w |
---|
1883 | focus $w.b.2 |
---|
1884 | tkwait window $w |
---|
1885 | |
---|
1886 | catch {focus $oldFocus} |
---|
1887 | if {$oldGrab != ""} { |
---|
1888 | if {$grabStatus == "global"} { |
---|
1889 | grab -global $oldGrab |
---|
1890 | } else { |
---|
1891 | grab $oldGrab |
---|
1892 | } |
---|
1893 | } |
---|
1894 | } |
---|
1895 | |
---|
1896 | proc SetEditProfile {entrylist phaselist histlist w} { |
---|
1897 | global expgui |
---|
1898 | foreach item $entrylist { |
---|
1899 | set value [ [lindex $item 1] get ] |
---|
1900 | if {$value != ""} { |
---|
1901 | hapinfo $histlist $phaselist [lindex $item 0] set $value |
---|
1902 | if $expgui(debug) { |
---|
1903 | puts "hapinfo [list $phaselist] [list $histlist] [lindex $item 0] set $value" |
---|
1904 | } |
---|
1905 | } |
---|
1906 | } |
---|
1907 | destroy $w |
---|
1908 | } |
---|
1909 | |
---|
1910 | proc QuitEditProfile {w entrylist} { |
---|
1911 | global expgui |
---|
1912 | # lets find out if anything changed |
---|
1913 | set changed 0 |
---|
1914 | foreach item $entrylist { |
---|
1915 | if {[ [lindex $item 1] get ] != ""} {set changed 1; break} |
---|
1916 | } |
---|
1917 | if $changed { |
---|
1918 | set decision [tk_dialog .changes "Abandon Changes" \ |
---|
1919 | "You have made changes to the Profile. Ok to abandon changes?" \ |
---|
1920 | warning 0 Abandon Keep] |
---|
1921 | if !$decision {destroy $w} |
---|
1922 | } else { |
---|
1923 | destroy $w |
---|
1924 | } |
---|
1925 | } |
---|
1926 | |
---|
1927 | ############################################################################## |
---|
1928 | ## ############################################# |
---|
1929 | ## END OF THE PROCEDURES SECTION ############################################# |
---|
1930 | ## ############################################# |
---|
1931 | ############################################################################## |
---|
1932 | |
---|
1933 | # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
1934 | # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<< |
---|
1935 | # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< BEGIN: GUI SECTION >>>>>>>>>>>>>>>>>>> |
---|
1936 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> |
---|
1937 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
1938 | # A frame for menu items at top of display |
---|
1939 | set expgui(fm) [frame .fm -relief raised -borderwidth 2 -width 150 -height 40] |
---|
1940 | # Pack the menu frame. |
---|
1941 | pack $expgui(fm) -fill x -side top -anchor n |
---|
1942 | |
---|
1943 | # Creating the notebook with 5 panes: Phase, Histogram, Phase Fraction, Profile |
---|
1944 | # & LS controls |
---|
1945 | if $expgui(havetix) { |
---|
1946 | pack [tixNoteBook .n] -expand yes -fill both |
---|
1947 | .n add phasePane -label "Phase" -underline 0 |
---|
1948 | .n pageconfigure phasePane -raisecmd \ |
---|
1949 | "set expgui(pagenow) phaseFrame; DisplayAllAtoms noreset" |
---|
1950 | .n add histPane -label "Histogram" -underline 0 |
---|
1951 | .n pageconfigure histPane -raisecmd \ |
---|
1952 | "set expgui(pagenow) histFrame; DisplayHistogram" |
---|
1953 | lappend expgui(frameactionlist) "histFrame DisplayHistogram" |
---|
1954 | lappend expgui(GlobalModeAllDisable) "histFrame {.n pageconfigure histPane}" |
---|
1955 | .n add fracPane -label "Phase Fraction" -underline 6 |
---|
1956 | .n pageconfigure fracPane -raisecmd \ |
---|
1957 | "set expgui(pagenow) fracFrame; DisplayFrac" |
---|
1958 | lappend expgui(frameactionlist) "fracFrame DisplayFrac" |
---|
1959 | .n add profPane -label Profile -underline 1 |
---|
1960 | .n pageconfigure profPane -raisecmd \ |
---|
1961 | "set expgui(pagenow) profFrame; DisplayProfile" |
---|
1962 | lappend expgui(frameactionlist) "profFrame DisplayProfile" |
---|
1963 | lappend expgui(GlobalModeAllDisable) "profFrame {.n pageconfigure profPane}" |
---|
1964 | .n add lsPane -label "LS Controls" -underline 0 |
---|
1965 | .n pageconfigure lsPane -raisecmd \ |
---|
1966 | "set expgui(pagenow) lsFrame; SetupExtractHist" |
---|
1967 | lappend expgui(frameactionlist) "lsFrame SetupExtractHist" |
---|
1968 | # Finding the pathname to the subwidget frames. |
---|
1969 | set expgui(phaseFrame) [.n subwidget phasePane] |
---|
1970 | set expgui(histFrame) [.n subwidget histPane] |
---|
1971 | set expgui(fracFrame) [.n subwidget fracPane] |
---|
1972 | set expgui(profFrame) [.n subwidget profPane] |
---|
1973 | set expgui(lsFrame) [.n subwidget lsPane] |
---|
1974 | } else { |
---|
1975 | pack [frame .bar] -side top -anchor w |
---|
1976 | pack [frame .n] -anchor w -fill both -expand yes |
---|
1977 | foreach item {phaseFrame histFrame fracFrame profFrame lsFrame} \ |
---|
1978 | page {Phase Histogram "Phase Fraction" Profile "LS Controls"} { |
---|
1979 | pack [button .bar.$item -text $page -bd 2 \ |
---|
1980 | -command "RaisePage $item"] -side left |
---|
1981 | set expgui($item) [frame .n.$item -relief flat] |
---|
1982 | } |
---|
1983 | lappend expgui(frameactionlist) "histFrame DisplayHistogram" |
---|
1984 | lappend expgui(frameactionlist) "fracFrame DisplayFrac" |
---|
1985 | lappend expgui(frameactionlist) "profFrame DisplayProfile" |
---|
1986 | lappend expgui(frameactionlist) "lsFrame SetupExtractHist" |
---|
1987 | lappend expgui(GlobalModeAllDisable) "histFrame {.bar.histFrame config}" |
---|
1988 | lappend expgui(GlobalModeAllDisable) "profFrame {.bar.profFrame config}" |
---|
1989 | } |
---|
1990 | |
---|
1991 | # this is used in the non-tix notebook to bring up the selected frame |
---|
1992 | proc RaisePage {nextpage} { |
---|
1993 | global expgui |
---|
1994 | set expgui(pagenow) $nextpage |
---|
1995 | foreach item {phaseFrame histFrame fracFrame profFrame lsFrame} { |
---|
1996 | if {$item == $nextpage} { |
---|
1997 | .bar.$item config -relief flat |
---|
1998 | } else { |
---|
1999 | .bar.$item config -relief raised |
---|
2000 | } |
---|
2001 | } |
---|
2002 | # forget all other pages |
---|
2003 | foreach child [pack slaves .n] { |
---|
2004 | pack forget $child |
---|
2005 | } |
---|
2006 | pack .n.$nextpage -anchor w -fill both -expand yes |
---|
2007 | foreach set $expgui(frameactionlist) { |
---|
2008 | if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1] |
---|
2009 | } |
---|
2010 | } |
---|
2011 | #---------------------------------------------------------------------------- |
---|
2012 | #\/ \/ \/ \/ \/ \/ \/ BEGINNING OF PHASE PANE CODE \/ \/ \/ \/ \/ \/ \/ \/ \/ |
---|
2013 | # Setup major frames here |
---|
2014 | frame $expgui(phaseFrame).top |
---|
2015 | set frameLatt [frame $expgui(phaseFrame).frameLatt] |
---|
2016 | # This is a big frame in the Phase notebook pane to hold a list of CRS data. |
---|
2017 | set fbig [frame $expgui(phaseFrame).fbig -width 180 -relief raised -borderwidth 4 -bg beige] |
---|
2018 | # This is a frame just below the big frame: fbig to allow edit of CRS data, One record at a time. |
---|
2019 | set frame3 [frame $expgui(phaseFrame).frame3 -width 100 -relief raised -borderwidth 4 -bg beige] |
---|
2020 | |
---|
2021 | grid $expgui(phaseFrame).top -sticky nws -row 0 -column 0 |
---|
2022 | grid $frameLatt -sticky news -row 2 -column 0 |
---|
2023 | grid $fbig -sticky news -row 3 -column 0 |
---|
2024 | # give extra space to the atoms box |
---|
2025 | grid columnconfigure $expgui(phaseFrame) 0 -weight 1 |
---|
2026 | grid rowconfigure $expgui(phaseFrame) 3 -weight 1 |
---|
2027 | grid $frame3 -sticky news -row 4 -column 0 |
---|
2028 | grid columnconfigure $expgui(phaseFrame) 0 -weight 1 |
---|
2029 | grid rowconfigure $expgui(phaseFrame) 3 -weight 1 |
---|
2030 | grid [frame $expgui(phaseFrame).top.ps] -column 0 -row 0 |
---|
2031 | # this is where the buttons will go |
---|
2032 | pack [label $expgui(phaseFrame).top.ps.0 -text "Phases: "] -side left |
---|
2033 | |
---|
2034 | |
---|
2035 | grid [label $expgui(phaseFrame).top.lA -textvariable entryvar(phasename) \ |
---|
2036 | -fg blue -anchor center] -column 1 -row 0 |
---|
2037 | grid columnconfigure $expgui(phaseFrame).top 1 -weight 1 |
---|
2038 | # ------------- Lattice Parameter Box ------------------ |
---|
2039 | set e1 [entry $frameLatt.e1 -textvariable entryvar(a) -width 10] |
---|
2040 | set e2 [entry $frameLatt.e2 -textvariable entryvar(b) -width 10] |
---|
2041 | set e3 [entry $frameLatt.e3 -textvariable entryvar(c) -width 10] |
---|
2042 | set e4 [entry $frameLatt.e4 -textvariable entryvar(alpha) -width 10] |
---|
2043 | set e5 [entry $frameLatt.e5 -textvariable entryvar(beta) -width 10] |
---|
2044 | set e6 [entry $frameLatt.e6 -textvariable entryvar(gamma) -width 10] |
---|
2045 | set l1 [label $frameLatt.l1 -text "a"] |
---|
2046 | set l2 [label $frameLatt.l2 -text "b"] |
---|
2047 | set l3 [label $frameLatt.l3 -text "c"] |
---|
2048 | set l4 [label $frameLatt.l4 -text "alpha"] |
---|
2049 | set l5 [label $frameLatt.l5 -text "beta"] |
---|
2050 | set l6 [label $frameLatt.l6 -text "gamma"] |
---|
2051 | grid $e1 -column 1 -row 0 -padx 5 |
---|
2052 | grid $e2 -column 3 -row 0 -padx 5 |
---|
2053 | grid $e3 -column 5 -row 0 -padx 5 |
---|
2054 | grid $e4 -column 1 -row 1 -padx 5 |
---|
2055 | grid $e5 -column 3 -row 1 -padx 5 |
---|
2056 | grid $e6 -column 5 -row 1 -padx 5 |
---|
2057 | grid $l1 -column 0 -row 0 -padx 5 -sticky e |
---|
2058 | grid $l2 -column 2 -row 0 -padx 5 -sticky e |
---|
2059 | grid $l3 -column 4 -row 0 -padx 5 -sticky e |
---|
2060 | grid $l4 -column 0 -row 1 -padx 5 -sticky e |
---|
2061 | grid $l5 -column 2 -row 1 -padx 5 -sticky e |
---|
2062 | grid $l6 -column 4 -row 1 -padx 5 -sticky e |
---|
2063 | |
---|
2064 | grid [label $frameLatt.lr -text "Refine Cell"] -column 6 -row 0 -padx 5 -sticky e |
---|
2065 | grid [label $frameLatt.ld -text "Cell damping"] -column 6 -row 1 -padx 5 -sticky e |
---|
2066 | set cFlag [checkbutton $frameLatt.c -text "" -variable entryvar(cellref)] |
---|
2067 | grid $cFlag -column 7 -row 0 -padx 5 -sticky e |
---|
2068 | tk_optionMenu $frameLatt.om entryvar(celldamp) 0 1 2 3 4 5 6 7 8 9 |
---|
2069 | grid $frameLatt.om -column 7 -row 1 -padx 5 -sticky e |
---|
2070 | |
---|
2071 | #-------------- Begin Atom Coordinates Box --------------------------------- |
---|
2072 | grid [listbox $fbig.title -height 1 -relief flat] \ |
---|
2073 | -row 0 -column 0 -sticky ew |
---|
2074 | set expgui(atomtitle) $fbig.title |
---|
2075 | $expgui(atomtitle) configure -font $expgui(coordfont) -selectmode extended |
---|
2076 | grid [listbox $fbig.lbox -height 10 \ |
---|
2077 | -xscrollcommand " $fbig.bscr set"\ |
---|
2078 | -yscrollcommand " $fbig.rscr set"\ |
---|
2079 | ] -row 1 -column 0 -sticky news |
---|
2080 | set expgui(atomlistbox) $fbig.lbox |
---|
2081 | $expgui(atomlistbox) configure -font $expgui(coordfont) -selectmode extended |
---|
2082 | grid [scrollbar $fbig.bscr -orient horizontal \ |
---|
2083 | -command "move2boxes \" $fbig.title $fbig.lbox \" " |
---|
2084 | ] -row 2 -column 0 -sticky ew |
---|
2085 | grid [scrollbar $fbig.rscr -command "$fbig.lbox yview" \ |
---|
2086 | ] -row 1 -column 1 -sticky ns |
---|
2087 | # give extra space to the atoms box |
---|
2088 | grid columnconfigure $fbig 0 -weight 1 |
---|
2089 | grid rowconfigure $fbig 1 -weight 1 |
---|
2090 | |
---|
2091 | proc move2boxes {boxlist args} { |
---|
2092 | foreach listbox $boxlist { |
---|
2093 | eval $listbox xview $args |
---|
2094 | } |
---|
2095 | } |
---|
2096 | # BIND mouse in editbox |
---|
2097 | bind $expgui(atomlistbox) <ButtonRelease-1> editRecord |
---|
2098 | bind $expgui(atomlistbox) <Button-3> SelectAllAtoms |
---|
2099 | |
---|
2100 | #-------------- End Atoms Section --------------------------------- |
---|
2101 | |
---|
2102 | # --------------------------- Begin Edit Box ------------------------------- |
---|
2103 | grid [set expgui(EditingAtoms) [label $frame3.top -bg beige -fg blue]] \ |
---|
2104 | -column 0 -row 0 -padx 2 -pady 3 -columnspan 12 -sticky w |
---|
2105 | |
---|
2106 | set f3l1 [label $frame3.l1 -text "Refinement Flags " -bg beige] |
---|
2107 | grid $f3l1 -column 0 -row 1 -padx 2 -sticky nsw -pady 3 |
---|
2108 | |
---|
2109 | set f3cFlag1 [checkbutton $frame3.cf1 -text "X" -variable entryvar(xref) -bg beige] |
---|
2110 | set f3cFlag2 [checkbutton $frame3.cf2 -text "U" -variable entryvar(uref) -bg beige] |
---|
2111 | set f3cFlag3 [checkbutton $frame3.cf3 -text "F" -variable entryvar(fref) -bg beige] |
---|
2112 | grid $f3cFlag1 -column 1 -row 1 -padx 2 -pady 3 -sticky w |
---|
2113 | grid $f3cFlag2 -column 2 -row 1 -padx 2 -pady 3 -sticky w |
---|
2114 | grid $f3cFlag3 -column 3 -row 1 -padx 2 -pady 3 -sticky w |
---|
2115 | |
---|
2116 | set f3l4 [label $frame3.l4 -text "Damping Factors " -bg beige] |
---|
2117 | grid $f3l4 -column 4 -row 1 -padx 2 -sticky nsw -pady 3 |
---|
2118 | |
---|
2119 | tk_optionMenu $frame3.om2 entryvar(xdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
2120 | tk_optionMenu $frame3.om3 entryvar(udamp) 0 1 2 3 4 5 6 7 8 9 |
---|
2121 | tk_optionMenu $frame3.om4 entryvar(fdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
2122 | grid [label $frame3.lom2 -text X -bg beige] -column 5 -row 1 -padx 2 -pady 3 -sticky w |
---|
2123 | grid $frame3.om2 -column 6 -row 1 -padx 2 -pady 3 -sticky w |
---|
2124 | grid [label $frame3.lom3 -text U -bg beige] -column 7 -row 1 -padx 2 -pady 3 -sticky w |
---|
2125 | grid $frame3.om3 -column 8 -row 1 -padx 2 -pady 3 -sticky w |
---|
2126 | grid [label $frame3.lom4 -text F -bg beige] -column 9 -row 1 -padx 2 -pady 3 -sticky w |
---|
2127 | grid $frame3.om4 -column 10 -row 1 -padx 2 -pady 3 -sticky w |
---|
2128 | |
---|
2129 | set expgui(atomreflbl) "$frame3.l1 $frame3.l4 $frame3.lom2 $frame3.lom3 $frame3.lom4 " |
---|
2130 | set expgui(atomref) "$frame3.cf1 $frame3.cf2 $frame3.cf3 $frame3.om2 $frame3.om3 $frame3.om4" |
---|
2131 | |
---|
2132 | set coords [frame $frame3.coords -width 100 -borderwidth 0 -bg beige] |
---|
2133 | grid $coords -column 0 -row 6 -columnspan 12 -sticky nsew |
---|
2134 | |
---|
2135 | set f3l1 [label $frame3.coords.l1 -text "Label" -bg beige] |
---|
2136 | set f3e1 [entry $frame3.coords.e1 -textvariable entryvar(label) -width 6] |
---|
2137 | set f3l8 [label $frame3.coords.l8 -text "Coordinates" -bg beige] |
---|
2138 | set f3e8 [entry $frame3.coords.e8 -textvariable entryvar(x) -width 10] |
---|
2139 | set f3e9 [entry $frame3.coords.e9 -textvariable entryvar(y) -width 10] |
---|
2140 | set f3e10 [entry $frame3.coords.e10 -textvariable entryvar(z) -width 10] |
---|
2141 | set f3l11 [label $frame3.coords.l11 -text "Occupancy" -bg beige] |
---|
2142 | set f3e11 [entry $frame3.coords.e11 -textvariable entryvar(frac) -width 10] |
---|
2143 | set expgui(atomlabels) "$frame3.coords.l1 $frame3.coords.l8 $frame3.coords.l11" |
---|
2144 | set expgui(atomentry) "$frame3.coords.e1 $frame3.coords.e8 $frame3.coords.e9 $frame3.coords.e10 $frame3.coords.e11" |
---|
2145 | |
---|
2146 | grid $f3l1 -column 0 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2147 | grid $f3e1 -column 1 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2148 | grid $f3l8 -column 2 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2149 | grid $f3e8 -column 3 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2150 | grid $f3e9 -column 4 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2151 | grid $f3e10 -column 5 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2152 | grid $f3l11 -column 6 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2153 | grid $f3e11 -column 7 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
2154 | |
---|
2155 | |
---|
2156 | set f3f31 [frame $frame3.f3f31 -width 100 -borderwidth 0 -bg beige] |
---|
2157 | grid $f3f31 -column 0 -row 7 -columnspan 12 |
---|
2158 | set expgui(anisolabels) {} |
---|
2159 | lappend expgui(anisolabels) [label $f3f31.l13 -text "Uiso" -bg beige] |
---|
2160 | lappend expgui(anisolabels) [label $f3f31.l14 -text "U22" -bg beige] |
---|
2161 | lappend expgui(anisolabels) [label $f3f31.l15 -text "U33" -bg beige] |
---|
2162 | lappend expgui(anisolabels) [label $f3f31.l16 -text "U12" -bg beige] |
---|
2163 | lappend expgui(anisolabels) [label $f3f31.l17 -text "U13" -bg beige] |
---|
2164 | lappend expgui(anisolabels) [label $f3f31.l18 -text "U23" -bg beige] |
---|
2165 | |
---|
2166 | set expgui(anisoentry) {} |
---|
2167 | lappend expgui(anisoentry) [entry $f3f31.e13 -textvariable entryvar(U11) -width 10] |
---|
2168 | lappend expgui(anisoentry) [entry $f3f31.e14 -textvariable entryvar(U22) -width 10] |
---|
2169 | lappend expgui(anisoentry) [entry $f3f31.e15 -textvariable entryvar(U33) -width 10] |
---|
2170 | lappend expgui(anisoentry) [entry $f3f31.e16 -textvariable entryvar(U12) -width 10] |
---|
2171 | lappend expgui(anisoentry) [entry $f3f31.e17 -textvariable entryvar(U13) -width 10] |
---|
2172 | lappend expgui(anisoentry) [entry $f3f31.e18 -textvariable entryvar(U23) -width 10] |
---|
2173 | |
---|
2174 | set col 0 |
---|
2175 | foreach item1 $expgui(anisolabels) item2 $expgui(anisoentry) { |
---|
2176 | grid $item1 -column $col -row 0 -sticky nsw -pady 3 |
---|
2177 | incr col |
---|
2178 | grid $item2 -column $col -row 0 -sticky nsw -pady 3 |
---|
2179 | incr col |
---|
2180 | } |
---|
2181 | # --------------------------- End Edit Box -------------------------------- |
---|
2182 | |
---|
2183 | #/\ /\ /\ /\ /\ /\ /\ END OF PHASE PANE CODE /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ |
---|
2184 | #----------------------------------------------------------------------------- |
---|
2185 | #v v v v v v v v v v BEGINNING OF HISTOGRAM PANE CODE v v v v v v v v v v v v |
---|
2186 | grid [frame $expgui(histFrame).hs] \ |
---|
2187 | -column 0 -row 0 -rowspan 10 -sticky nsew |
---|
2188 | grid columnconfigure $expgui(histFrame) 0 -weight 1 |
---|
2189 | grid rowconfigure $expgui(histFrame) 1 -weight 1 |
---|
2190 | grid rowconfigure $expgui(histFrame) 2 -weight 1 |
---|
2191 | grid rowconfigure $expgui(histFrame) 3 -weight 1 |
---|
2192 | grid [listbox $expgui(histFrame).hs.title -height 1 -relief flat \ |
---|
2193 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
2194 | grid [listbox $expgui(histFrame).hs.lbox -height 10 -width 25 \ |
---|
2195 | -font $expgui(histfont) \ |
---|
2196 | -xscrollcommand "$expgui(histFrame).hs.x set" \ |
---|
2197 | -yscrollcommand "$expgui(histFrame).hs.y set" \ |
---|
2198 | ] -row 1 -column 0 -sticky news |
---|
2199 | lappend expgui(HistSelectList) $expgui(histFrame).hs |
---|
2200 | grid [scrollbar $expgui(histFrame).hs.x -orient horizontal \ |
---|
2201 | -command "move2boxes \" $expgui(histFrame).hs.title $expgui(histFrame).hs.lbox \" " |
---|
2202 | ] -row 2 -column 0 -sticky ew |
---|
2203 | grid [scrollbar $expgui(histFrame).hs.y \ |
---|
2204 | -command "$expgui(histFrame).hs.lbox yview"] \ |
---|
2205 | -row 1 -column 1 -sticky ns |
---|
2206 | grid columnconfigure $expgui(histFrame).hs 0 -weight 1 |
---|
2207 | grid rowconfigure $expgui(histFrame).hs 1 -weight 1 |
---|
2208 | bind $expgui(histFrame).hs.lbox <ButtonRelease-1> { |
---|
2209 | set expgui(curhist) [$expgui(histFrame).hs.lbox curselection] |
---|
2210 | DisplayHistogram |
---|
2211 | } |
---|
2212 | bind $expgui(histFrame).hs.lbox <Button-3> { |
---|
2213 | if $expgui(globalmode) { |
---|
2214 | $expgui(histFrame).hs.lbox selection set 0 end |
---|
2215 | set expgui(curhist) [$expgui(histFrame).hs.lbox curselection] |
---|
2216 | DisplayHistogram |
---|
2217 | } |
---|
2218 | } |
---|
2219 | |
---|
2220 | |
---|
2221 | frame $expgui(histFrame).top -borderwidth 4 -relief groove |
---|
2222 | grid [label $expgui(histFrame).top.txt] -row 0 -column 0 |
---|
2223 | if $expgui(havetix) { |
---|
2224 | foreach item {scaleBox backBox diffBox} num {1 2 3} \ |
---|
2225 | title {"Scale Factor" Background "Diffractometer Constants"} { |
---|
2226 | tixLabelFrame $expgui(histFrame).$item \ |
---|
2227 | -borderwidth 4 -width 600 -height 100 -label $title |
---|
2228 | grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew |
---|
2229 | set expgui($item) [$expgui(histFrame).$item subwidget frame] |
---|
2230 | } |
---|
2231 | } else { |
---|
2232 | foreach item {scaleBox backBox diffBox} num {0 1 2} \ |
---|
2233 | title {"" Background "Diffractometer Constants"} { |
---|
2234 | frame $expgui(histFrame).$item -borderwidth 4 -relief groove |
---|
2235 | grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew |
---|
2236 | set expgui($item) $expgui(histFrame).$item |
---|
2237 | if {$title != ""} { |
---|
2238 | grid [label $expgui(histFrame).$item.title -text $title] \ |
---|
2239 | -row 0 -column 0 -columnspan 10 -sticky nw |
---|
2240 | } |
---|
2241 | } |
---|
2242 | } |
---|
2243 | grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \ |
---|
2244 | -row 1 -column 6 -sticky nws -padx 2 -pady 3 |
---|
2245 | grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \ |
---|
2246 | -row 1 -column 7 -sticky ew -padx 4 -pady 3 |
---|
2247 | button $expgui(scaleBox).but1 -text "Set Globally" \ |
---|
2248 | -command "editglobalparm histinfo scale {Scale Factor}" |
---|
2249 | |
---|
2250 | grid [label $expgui(scaleBox).histSFRLabel -text " Refine scale"] \ |
---|
2251 | -row 1 -column 2 -sticky nws -padx 2 -pady 3 |
---|
2252 | grid [checkbutton $expgui(scaleBox).rf -variable entryvar(sref)] \ |
---|
2253 | -row 1 -column 3 -sticky news -padx 4 -pady 3 |
---|
2254 | grid [label $expgui(scaleBox).lD1 -text "Damping"] \ |
---|
2255 | -row 1 -column 4 -sticky w -padx 2 -pady 3 |
---|
2256 | tk_optionMenu $expgui(scaleBox).om entryvar(sdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
2257 | grid $expgui(scaleBox).om \ |
---|
2258 | -row 1 -column 5 -sticky news -padx 4 -pady 3 |
---|
2259 | grid columnconfigure $expgui(scaleBox) 6 -weight 1 |
---|
2260 | |
---|
2261 | # BACKGROUND information. |
---|
2262 | # <<<<<<<<<<<<<<<<<<<<<<<<< BACKGROUND <<<<<<<<<<<<<<<<<<<<< |
---|
2263 | grid [ frame $expgui(backBox).f ] -row 0 -column 0 -columnspan 11 |
---|
2264 | grid [ label $expgui(backBox).f.lBGType -textvariable expgui(backtypelbl)] \ |
---|
2265 | -row 1 -column 0 -sticky nws -padx 2 -pady 3 |
---|
2266 | grid [ label $expgui(backBox).f.lBGTerms -textvariable expgui(backtermlbl)] \ |
---|
2267 | -row 1 -column 1 -sticky nws -padx 2 -pady 3 |
---|
2268 | grid [ button $expgui(backBox).f.edit -textvariable expgui(bkglbl) \ |
---|
2269 | -command editbackground] \ |
---|
2270 | -row 1 -column 2 -columnspan 3 -sticky w -padx 2 -pady 3 |
---|
2271 | grid [ frame $expgui(backBox).f1 ] -row 1 -column 0 -columnspan 11 -sticky e |
---|
2272 | grid [ label $expgui(backBox).f1.lfBG -text " Refine background" ] \ |
---|
2273 | -row 2 -column 1 -sticky news -padx 4 -pady 3 |
---|
2274 | grid [ checkbutton $expgui(backBox).f1.rfBG -text "" \ |
---|
2275 | -variable entryvar(bref) ] \ |
---|
2276 | -row 2 -column 2 -sticky news -padx 4 -pady 3 |
---|
2277 | grid [ label $expgui(backBox).f1.lBGDamp -text Damping ] \ |
---|
2278 | -row 2 -column 3 -sticky w -padx 2 -pady 3 |
---|
2279 | tk_optionMenu $expgui(backBox).f1.om entryvar(bdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
2280 | grid $expgui(backBox).f1.om \ |
---|
2281 | -row 2 -column 4 -sticky news -padx 4 -pady 3 -sticky e |
---|
2282 | |
---|
2283 | # DIFFRACTOMETER CONSTANTS SECTION |
---|
2284 | |
---|
2285 | #^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^END OF HISTOGRAM PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
2286 | ############################################################################### |
---|
2287 | #v v v v v v v v v v BEGINNING OF PHASE FRACTION PANE CODE v v v v v v v v v v |
---|
2288 | |
---|
2289 | pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both |
---|
2290 | grid [listbox $expgui(fracFrame).hs.title -height 1 -relief flat \ |
---|
2291 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
2292 | grid [listbox $expgui(fracFrame).hs.lbox -height 10 -width 25 \ |
---|
2293 | -font $expgui(histfont) \ |
---|
2294 | -xscrollcommand "$expgui(fracFrame).hs.x set" \ |
---|
2295 | -yscrollcommand "$expgui(fracFrame).hs.y set" \ |
---|
2296 | ] -row 1 -column 0 -sticky news |
---|
2297 | lappend expgui(HistSelectList) $expgui(fracFrame).hs |
---|
2298 | grid [scrollbar $expgui(fracFrame).hs.x -orient horizontal \ |
---|
2299 | -command "move2boxes \" $expgui(fracFrame).hs.title $expgui(fracFrame).hs.lbox \" " |
---|
2300 | ] -row 2 -column 0 -sticky ew |
---|
2301 | grid [scrollbar $expgui(fracFrame).hs.y \ |
---|
2302 | -command "$expgui(fracFrame).hs.lbox yview"] \ |
---|
2303 | -row 1 -column 1 -sticky ns |
---|
2304 | grid columnconfigure $expgui(fracFrame).hs 0 -weight 1 |
---|
2305 | grid rowconfigure $expgui(fracFrame).hs 1 -weight 1 |
---|
2306 | bind $expgui(fracFrame).hs.lbox <ButtonRelease-1> { |
---|
2307 | set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection] |
---|
2308 | DisplayFrac |
---|
2309 | } |
---|
2310 | bind $expgui(fracFrame).hs.lbox <Button-3> { |
---|
2311 | if $expgui(globalmode) { |
---|
2312 | $expgui(fracFrame).hs.lbox selection set 0 end |
---|
2313 | set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection] |
---|
2314 | DisplayFrac |
---|
2315 | } |
---|
2316 | } |
---|
2317 | pack [frame $expgui(fracFrame).f1] -fill both -expand true |
---|
2318 | |
---|
2319 | # the rest of the page is created in DisplayFrac |
---|
2320 | # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF PHASE FRACTION PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
2321 | ############################################################################### |
---|
2322 | # v v v v v v v v v v BEGINNING OF PROFILE PANE CODE v v v v v v v v v v v v v |
---|
2323 | pack [frame $expgui(profFrame).hs] -side left -expand y -fill both |
---|
2324 | grid [listbox $expgui(profFrame).hs.title -height 1 -relief flat \ |
---|
2325 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
2326 | grid [listbox $expgui(profFrame).hs.lbox -height 10 -width 25 \ |
---|
2327 | -font $expgui(histfont) \ |
---|
2328 | -xscrollcommand "$expgui(profFrame).hs.x set" \ |
---|
2329 | -yscrollcommand "$expgui(profFrame).hs.y set" \ |
---|
2330 | ] -row 1 -column 0 -sticky news |
---|
2331 | lappend expgui(HistSelectList) $expgui(profFrame).hs |
---|
2332 | grid [scrollbar $expgui(profFrame).hs.x -orient horizontal \ |
---|
2333 | -command "move2boxes \" $expgui(profFrame).hs.title $expgui(profFrame).hs.lbox \" " |
---|
2334 | ] -row 2 -column 0 -sticky ew |
---|
2335 | grid [scrollbar $expgui(profFrame).hs.y \ |
---|
2336 | -command "$expgui(profFrame).hs.lbox yview"] \ |
---|
2337 | -row 1 -column 1 -sticky ns |
---|
2338 | grid columnconfigure $expgui(profFrame).hs 0 -weight 1 |
---|
2339 | grid rowconfigure $expgui(profFrame).hs 1 -weight 1 |
---|
2340 | bind $expgui(profFrame).hs.lbox <ButtonRelease-1> { |
---|
2341 | set expgui(curhist) [$expgui(profFrame).hs.lbox curselection] |
---|
2342 | DisplayProfile |
---|
2343 | } |
---|
2344 | bind $expgui(profFrame).hs.lbox <Button-3> { |
---|
2345 | if $expgui(globalmode) { |
---|
2346 | $expgui(profFrame).hs.lbox selection set 0 end |
---|
2347 | set expgui(curhist) [$expgui(profFrame).hs.lbox curselection] |
---|
2348 | DisplayProfile |
---|
2349 | } |
---|
2350 | } |
---|
2351 | |
---|
2352 | # Create a large canvas area containing a frame for each phase in the data set. |
---|
2353 | # The canvas and vertical scrollbar are inside a frame called f1 |
---|
2354 | pack [frame $expgui(profFrame).f1] -fill both -expand true |
---|
2355 | grid [set expgui(ProfileBox) [canvas $expgui(profFrame).f1.profileBox \ |
---|
2356 | -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \ |
---|
2357 | -sticky news -row 0 -column 0 |
---|
2358 | grid [scrollbar $expgui(profFrame).f1.yscroll -orient vertical] \ |
---|
2359 | -sticky ns -row 0 -column 1 |
---|
2360 | |
---|
2361 | $expgui(ProfileBox) config -yscrollcommand "$expgui(profFrame).f1.yscroll set" |
---|
2362 | $expgui(profFrame).f1.yscroll config -command { $expgui(ProfileBox) yview } |
---|
2363 | |
---|
2364 | grid columnconfigure $expgui(profFrame).f1 1 -weight 1 |
---|
2365 | grid rowconfigure $expgui(profFrame).f1 0 -weight 1 |
---|
2366 | frame $expgui(ProfileBox).f -bd 0 |
---|
2367 | $expgui(ProfileBox) create window 0 0 -anchor nw -window $expgui(ProfileBox).f |
---|
2368 | |
---|
2369 | # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF PROFILE PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
2370 | ############################################################################## |
---|
2371 | # v v v v v v v v v v BEGINNING OF LS PANE CODE v v v v v v v v v v v v v |
---|
2372 | array set printopts { |
---|
2373 | 0 "Print the reciprocal metric tensor changes" |
---|
2374 | 1 "Print the correlation matrix" |
---|
2375 | 2 "Print the Least-Squares matrices and vectors" |
---|
2376 | 4 "Print the linear constraint matrices" |
---|
2377 | 5 "Print the applied shifts and shift factors" |
---|
2378 | 6 "Print the reciprocal metric tensor Var-Covar terms" |
---|
2379 | 7 "Print all parameters for each cycle" |
---|
2380 | 8 "Print summary shift/esd data after last cycle" |
---|
2381 | 9 "Print zero/unit pole figure constraint terms" |
---|
2382 | } |
---|
2383 | pack [frame $expgui(lsFrame).hs] -side left -expand y -fill both |
---|
2384 | grid [listbox $expgui(lsFrame).hs.title -height 1 -relief flat \ |
---|
2385 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
2386 | grid [listbox $expgui(lsFrame).hs.lbox -height 10 -width 25 \ |
---|
2387 | -font $expgui(histfont) \ |
---|
2388 | -xscrollcommand "$expgui(lsFrame).hs.x set" \ |
---|
2389 | -yscrollcommand "$expgui(lsFrame).hs.y set" \ |
---|
2390 | ] -row 1 -column 0 -sticky news |
---|
2391 | lappend expgui(HistSelectList) $expgui(lsFrame).hs |
---|
2392 | grid [scrollbar $expgui(lsFrame).hs.x -orient horizontal \ |
---|
2393 | -command "move2boxes \" $expgui(lsFrame).hs.title $expgui(lsFrame).hs.lbox \" " |
---|
2394 | ] -row 2 -column 0 -sticky ew |
---|
2395 | grid [scrollbar $expgui(lsFrame).hs.y \ |
---|
2396 | -command "$expgui(lsFrame).hs.lbox yview"] \ |
---|
2397 | -row 1 -column 1 -sticky ns |
---|
2398 | grid columnconfigure $expgui(lsFrame).hs 0 -weight 1 |
---|
2399 | grid rowconfigure $expgui(lsFrame).hs 1 -weight 1 |
---|
2400 | bind $expgui(lsFrame).hs.lbox <ButtonRelease-1> { |
---|
2401 | set expgui(curhist) [$expgui(lsFrame).hs.lbox curselection] |
---|
2402 | SetupExtractHist |
---|
2403 | } |
---|
2404 | bind $expgui(lsFrame).hs.lbox <Button-3> { |
---|
2405 | if $expgui(globalmode) { |
---|
2406 | $expgui(lsFrame).hs.lbox selection set 0 end |
---|
2407 | set expgui(curhist) [$expgui(lsFrame).hs.lbox curselection] |
---|
2408 | SetupExtractHist |
---|
2409 | } |
---|
2410 | } |
---|
2411 | # need to respond to mouse presses -- control variable associated with extract Fobs |
---|
2412 | # and set the LeBail extraction flags |
---|
2413 | proc SetupExtractHist {} { |
---|
2414 | global expgui entrycmd entryvar expmap |
---|
2415 | |
---|
2416 | # display the selected histograms |
---|
2417 | $expgui(lsFrame).hs.lbox selection clear 0 end |
---|
2418 | foreach h $expgui(curhist) { |
---|
2419 | $expgui(lsFrame).hs.lbox selection set $h |
---|
2420 | } |
---|
2421 | # disable traces on entryvar for right now |
---|
2422 | set entrycmd(trace) 0 |
---|
2423 | |
---|
2424 | # get histogram list |
---|
2425 | set histlist {} |
---|
2426 | foreach item $expgui(curhist) { |
---|
2427 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
2428 | } |
---|
2429 | set entrycmd(fobsextract) "histinfo [list $histlist] foextract" |
---|
2430 | if {[llength $histlist] == 1} { |
---|
2431 | set entryvar(fobsextract) [histinfo $histlist foextract] |
---|
2432 | foreach phase {1 2 3 4 5 6 7 8 9} { |
---|
2433 | # is the phase present? |
---|
2434 | if {[lsearch -exact $expmap(phaselist_$histlist) $phase] == -1} { |
---|
2435 | $expgui(lsFrame).f1.a.l$phase config -fg grey |
---|
2436 | set expgui(Fextract$phase) {} |
---|
2437 | foreach item "a.ca$phase a.cb$phase a.cc$phase" { |
---|
2438 | $expgui(lsFrame).f1.$item config -state disabled -bd 1 |
---|
2439 | } |
---|
2440 | } else { |
---|
2441 | $expgui(lsFrame).f1.a.l$phase config -fg black |
---|
2442 | foreach item "a.ca$phase a.cb$phase a.cc$phase" { |
---|
2443 | $expgui(lsFrame).f1.$item config -state normal -bd 2 |
---|
2444 | } |
---|
2445 | set expgui(Fextract$phase) [hapinfo $histlist $phase extmeth] |
---|
2446 | } |
---|
2447 | } |
---|
2448 | } else { |
---|
2449 | # multiple histograms need phases in any histogram |
---|
2450 | foreach phase {1 2 3 4 5 6 7 8 9} { |
---|
2451 | set gotphase($phase) 0 |
---|
2452 | } |
---|
2453 | foreach hist $histlist { |
---|
2454 | foreach phase $expmap(phaselist_$hist) { |
---|
2455 | set gotphase($phase) 1 |
---|
2456 | } |
---|
2457 | } |
---|
2458 | foreach phase {1 2 3 4 5 6 7 8 9} { |
---|
2459 | set expgui(Fextract$phase) {} |
---|
2460 | if $gotphase($phase) { |
---|
2461 | $expgui(lsFrame).f1.a.l$phase config -fg black |
---|
2462 | foreach item "a.ca$phase a.cb$phase a.cc$phase" { |
---|
2463 | $expgui(lsFrame).f1.$item config -state normal -bd 2 |
---|
2464 | } |
---|
2465 | } else { |
---|
2466 | $expgui(lsFrame).f1.a.l$phase config -fg grey |
---|
2467 | foreach item "a.ca$phase a.cb$phase a.cc$phase" { |
---|
2468 | $expgui(lsFrame).f1.$item config -state disabled -bd 1 |
---|
2469 | } |
---|
2470 | } |
---|
2471 | } |
---|
2472 | } |
---|
2473 | # reenable traces |
---|
2474 | set entrycmd(trace) 1 |
---|
2475 | } |
---|
2476 | # respond to a change in the fobs extraction method for a phase |
---|
2477 | # force the main extraction flag on, if fobs extraction is selected for any phase |
---|
2478 | proc HistExtractSet {phase} { |
---|
2479 | global expgui entryvar expmap |
---|
2480 | foreach item $expgui(curhist) { |
---|
2481 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
2482 | } |
---|
2483 | hapinfo $histlist $phase extmeth set $expgui(Fextract$phase) |
---|
2484 | if {$expgui(Fextract$phase) != 0} {set entryvar(fobsextract) 1} |
---|
2485 | } |
---|
2486 | |
---|
2487 | pack [frame $expgui(lsFrame).f1] -fill both -expand true |
---|
2488 | grid rowconfigure $expgui(lsFrame).f1 4 -weight 1 |
---|
2489 | grid [frame $expgui(lsFrame).f1.b -bd 4 -relief groove] -row 0 -column 0 |
---|
2490 | grid [label $expgui(lsFrame).f1.b.lcyc -text "Number of Cycles"] -row 0 -column 0 |
---|
2491 | grid [entry $expgui(lsFrame).f1.b.ecyc -width 3 \ |
---|
2492 | -textvariable entryvar(cycles)] -row 0 -column 1 |
---|
2493 | grid [menubutton $expgui(lsFrame).f1.lprint -textvariable expgui(printopt) \ |
---|
2494 | -menu $expgui(lsFrame).f1.lprint.menu -bd 4 -relief raised \ |
---|
2495 | ] -row 0 -column 1 |
---|
2496 | menu $expgui(lsFrame).f1.lprint.menu |
---|
2497 | foreach num [lsort [array names printopts]] { |
---|
2498 | $expgui(lsFrame).f1.lprint.menu add checkbutton \ |
---|
2499 | -label "$printopts($num) ([expr int(pow(2,$num))])"\ |
---|
2500 | -variable entryvar(printopt$num) |
---|
2501 | } |
---|
2502 | grid [frame $expgui(lsFrame).f1.c -bd 4 -relief groove] -row 0 -column 2 |
---|
2503 | grid [label $expgui(lsFrame).f1.c.fol -text "Extract Fobs"] -row 0 -column 2 |
---|
2504 | grid [checkbutton $expgui(lsFrame).f1.c.foc -variable entryvar(fobsextract)] -row 0 -column 3 |
---|
2505 | |
---|
2506 | grid [frame $expgui(lsFrame).f1.a -bd 4 -relief groove] -row 3 -column 0 -columnspan 6 |
---|
2507 | foreach num {1 2 3 4 5 6 7 8 9} { |
---|
2508 | grid [label $expgui(lsFrame).f1.a.l$num -text $num] -row 1 -column $num |
---|
2509 | grid [radiobutton $expgui(lsFrame).f1.a.cc$num \ |
---|
2510 | -command "HistExtractSet $num" \ |
---|
2511 | -variable expgui(Fextract$num) -value 0] \ |
---|
2512 | -row 2 -column $num |
---|
2513 | grid [radiobutton $expgui(lsFrame).f1.a.ca$num \ |
---|
2514 | -command "HistExtractSet $num" \ |
---|
2515 | -variable expgui(Fextract$num) -value 1] \ |
---|
2516 | -row 3 -column $num |
---|
2517 | grid [radiobutton $expgui(lsFrame).f1.a.cb$num \ |
---|
2518 | -command "HistExtractSet $num" \ |
---|
2519 | -variable expgui(Fextract$num) -value 2] \ |
---|
2520 | -row 4 -column $num |
---|
2521 | } |
---|
2522 | grid [label $expgui(lsFrame).f1.a.t -text "Intensity Extraction Method" -anchor c] \ |
---|
2523 | -column 0 -columnspan 11 -row 0 |
---|
2524 | grid [label $expgui(lsFrame).f1.a.t0 -text "Histogram #" -anchor c] -column 0 -row 1 |
---|
2525 | grid [label $expgui(lsFrame).f1.a.t1 -text "Rietveld" -anchor c] -column 0 -row 2 |
---|
2526 | grid [label $expgui(lsFrame).f1.a.t2 -text "F(calc) Weighted" -anchor c] -column 0 -row 3 |
---|
2527 | grid [label $expgui(lsFrame).f1.a.t3 -text "Equally Weighted" -anchor c] -column 0 -row 4 |
---|
2528 | grid [label $expgui(lsFrame).f1.a.t2a -text "(Model biased)" -anchor c] -column 10 -row 3 |
---|
2529 | grid [label $expgui(lsFrame).f1.a.t3a -text "(Le Bail method)" -anchor c] -column 10 -row 4 |
---|
2530 | # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF LS PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
2531 | #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv THE MENU BAR vvvvvvvvvvvvvvvvvvvvvv |
---|
2532 | |
---|
2533 | #---- file menu button |
---|
2534 | menubutton $expgui(fm).file -text File -underline 0 -menu $expgui(fm).file.menu |
---|
2535 | menu $expgui(fm).file.menu |
---|
2536 | if $expgui(debug) { |
---|
2537 | $expgui(fm).file.menu add command -label "Reset" -underline 0 \ |
---|
2538 | -command "reset" |
---|
2539 | } |
---|
2540 | $expgui(fm).file.menu add checkbutton -label "Archive EXP" -variable expgui(archive) -underline 0 |
---|
2541 | $expgui(fm).file.menu add command -label "Save" -underline 0 \ |
---|
2542 | -command " archiveexp $expfile; set expgui(changed) 0" |
---|
2543 | $expgui(fm).file.menu add command -label "Save As" -underline 1 \ |
---|
2544 | -command "SaveAsFile" |
---|
2545 | $expgui(fm).file.menu add command -label "Reread .EXP file" -underline 0 \ |
---|
2546 | -command {rereadexp $expfile} |
---|
2547 | $expgui(fm).file.menu add command -label "Other .EXP file" -underline 0 \ |
---|
2548 | -command {readnewexp} |
---|
2549 | #$expgui(fm).file.menu add command -label "Close" -underline 0 |
---|
2550 | $expgui(fm).file.menu add command -label "Exit" -underline 1 -command catchQuit |
---|
2551 | |
---|
2552 | #---- help menu button |
---|
2553 | menubutton $expgui(fm).help -text Help -underline 0 -menu $expgui(fm).help.menu |
---|
2554 | menu $expgui(fm).help.menu |
---|
2555 | $expgui(fm).help.menu add command -label "About..." -underline 0 -command { About } |
---|
2556 | #$expgui(fm).help.menu add command -label "GSAStk" -underline 0 -command { GSAStkHelp } |
---|
2557 | |
---|
2558 | #---- Global mode menu button |
---|
2559 | menubutton $expgui(fm).edit -text "Global mode" -underline 0 \ |
---|
2560 | -menu $expgui(fm).edit.menu |
---|
2561 | menu $expgui(fm).edit.menu |
---|
2562 | $expgui(fm).edit.menu add radiobutton -label "Off" \ |
---|
2563 | -variable expgui(globalmode) -underline 0 -value 0\ |
---|
2564 | -command sethistlist |
---|
2565 | $expgui(fm).edit.menu add radiobutton -label "All" \ |
---|
2566 | -variable expgui(globalmode) -underline 0 -value 6 \ |
---|
2567 | -command sethistlist |
---|
2568 | $expgui(fm).edit.menu add radiobutton -label "TOF" \ |
---|
2569 | -variable expgui(globalmode) -underline 0 -value 1 \ |
---|
2570 | -command sethistlist |
---|
2571 | $expgui(fm).edit.menu add radiobutton -label "CW Neutron" \ |
---|
2572 | -variable expgui(globalmode) -underline 0 -value 2 \ |
---|
2573 | -command sethistlist |
---|
2574 | $expgui(fm).edit.menu add radiobutton -label "Alpha12 Xray" \ |
---|
2575 | -variable expgui(globalmode) -underline 0 -value 3 \ |
---|
2576 | -command sethistlist |
---|
2577 | $expgui(fm).edit.menu add radiobutton -label "Monochromatic Xray" \ |
---|
2578 | -variable expgui(globalmode) -underline 0 -value 4 \ |
---|
2579 | -command sethistlist |
---|
2580 | $expgui(fm).edit.menu add radiobutton -label "Energy Disp Xray" \ |
---|
2581 | -variable expgui(globalmode) -underline 0 -value 5 \ |
---|
2582 | -command sethistlist |
---|
2583 | set expgui(globalmode) 0 |
---|
2584 | #---- options menu button |
---|
2585 | menubutton $expgui(fm).atom -text Options -underline 0 \ |
---|
2586 | -menu $expgui(fm).atom.menu |
---|
2587 | menu $expgui(fm).atom.menu |
---|
2588 | $expgui(fm).atom.menu add cascade -menu $expgui(fm).atom.menu.asort \ |
---|
2589 | -label "Sort atoms by" |
---|
2590 | |
---|
2591 | set expgui(asorttype) number |
---|
2592 | menu $expgui(fm).atom.menu.asort |
---|
2593 | $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
2594 | -label number -value number -variable expgui(asorttype) |
---|
2595 | $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
2596 | -label type -value type -variable expgui(asorttype) |
---|
2597 | $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
2598 | -label x -value x -variable expgui(asorttype) |
---|
2599 | $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
2600 | -label y -value y -variable expgui(asorttype) |
---|
2601 | $expgui(fm).atom.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
2602 | -label z -value z -variable expgui(asorttype) |
---|
2603 | |
---|
2604 | |
---|
2605 | $expgui(fm).atom.menu add cascade -menu $expgui(fm).atom.menu.hsort \ |
---|
2606 | -label "Sort histograms by" |
---|
2607 | |
---|
2608 | set expgui(hsorttype) number |
---|
2609 | menu $expgui(fm).atom.menu.hsort |
---|
2610 | $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ |
---|
2611 | -label number -value number -variable expgui(hsorttype) |
---|
2612 | $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ |
---|
2613 | -label "Histogram type" -value type -variable expgui(hsorttype) |
---|
2614 | $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ |
---|
2615 | -label "Bank #" -value bank -variable expgui(hsorttype) |
---|
2616 | $expgui(fm).atom.menu.hsort add radiobutton -command sethistlist \ |
---|
2617 | -label "Angle/Wavelength" -value angle -variable expgui(hsorttype) |
---|
2618 | |
---|
2619 | pack $expgui(fm).file $expgui(fm).edit $expgui(fm).atom \ |
---|
2620 | -side left -in $expgui(fm) |
---|
2621 | pack $expgui(fm).help -side right -in $expgui(fm) |
---|
2622 | |
---|
2623 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF MENU DEFINITION ^^^^^^^^^^^^^^^^^^^ |
---|
2624 | |
---|
2625 | # handle indirect exits |
---|
2626 | wm protocol . WM_DELETE_WINDOW catchQuit |
---|
2627 | bind . <Control-c> catchQuit |
---|
2628 | |
---|
2629 | loadexp $expfile |
---|