Changeset 668
- Timestamp:
- Dec 4, 2009 5:10:01 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/addcmds.tcl
- Property rcs:date changed from 2002/09/05 18:16:00 to 2003/04/10 21:59:03
- Property rcs:lines changed from +9 -6 to +141 -38
- Property rcs:rev changed from 1.29 to 1.30
r641 r668 215 215 } 216 216 file delete exptool.in exptool.out 217 # set the powpref warning (2 = required) 218 set expgui(needpowpref) 2 219 set msg "A phase was added" 220 if {[string first $msg $expgui(needpowpref_why)] == -1} { 221 append expgui(needpowpref_why) "\t$msg\n" 222 } 217 223 # now select the new phase 218 224 SelectOnePhase [lindex $expmap(phaselist) end] … … 220 226 221 227 #----------- Add Histogram routines -------------------------------------- 228 proc LabelInstParm {args} { 229 global newhist 230 switch $newhist(insttype) { 231 TOF { 232 set newhist(instfiletext) "Neutron Time of Flight" 233 catch { 234 set b $newhist(setnum) 235 append newhist(instfiletext) ", 2theta = $newhist(inst${b}Angle)" 236 } 237 } 238 ED {set newhist(instfiletext) "X-ray Energy Dispersive"} 239 "CW X" {set newhist(instfiletext) "CW X-ray"} 240 "CW N" {set newhist(instfiletext) "CW Neutron"} 241 } 242 } 243 trace variable newhist(setnum) w LabelInstParm 222 244 proc MakeAddHistBox {} { 223 245 global expmap newhist … … 255 277 grid [label $np.lset -text "Select set" -anchor w] -column 1 -row 6 -sticky w 256 278 grid [frame $np.set] -column 2 -row 6 -columnspan 7 -sticky ew 257 258 grid [button $np.f6a -text "Run\nRAWPLOT" -command RunRawplot] \ 259 -column 4 -row 8 -rowspan 2 260 grid [label $np.l3 -text "Usable data limit:"] -column 0 -row 8 -rowspan 2 279 grid [label $np.t2a -textvariable newhist(instfiletext) \ 280 -justify center -anchor center -fg blue] \ 281 -column 0 -row 8 -columnspan 99 -sticky ew 282 283 grid [button $np.f6a -text "Run\nRAWPLOT" -command "RunRawplot $np"] \ 284 -column 4 -row 18 -rowspan 2 285 grid [label $np.l3 -text "Usable data limit:"] -column 0 -row 18 -rowspan 3 261 286 grid [entry $np.e3 -width 12 -textvariable newhist(2tLimit) \ 262 ] -column 1 -row 8 -rowspan 2287 ] -column 1 -row 18 -rowspan 3 263 288 grid [radiobutton $np.cb3 -text "D-min" -variable newhist(LimitMode) \ 264 -value 0] -column 2 -row 8 -sticky w289 -value 0] -column 2 -row 18 -sticky w 265 290 grid [radiobutton $np.cb4 -textvariable newhist(limitLbl) \ 266 291 -variable newhist(LimitMode) -anchor w -justify l \ 267 -value 1] -column 2 -row 9 -sticky w 292 -value 1] -column 2 -row 20 -sticky w 293 grid [radiobutton $np.cb5 -text "Q-max" -variable newhist(LimitMode) \ 294 -value 2] -column 2 -row 19 -sticky w 268 295 set newhist(limitLbl) "TOF-min\n2-Theta Max" 269 296 # spacers … … 273 300 -columnspan 20 -column 0 -row 4 -sticky nsew -ipady 2 274 301 grid [frame $np.sp2 -bg white] \ 275 -columnspan 20 -column 0 -row 7 -sticky nsew -ipady 2302 -columnspan 20 -column 0 -row 17 -sticky nsew -ipady 2 276 303 grid [frame $np.sp3 -bg white] \ 277 304 -columnspan 20 -column 0 -row 98 -sticky nsew -ipady 2 … … 349 376 set len [gets $in line] 350 377 if {$len > 160} { 351 # this is a UNIX file. Hope there are no control characters378 # this is an old-style UNIX file. Hope there are no control characters 352 379 set i 0 353 380 set j 79 … … 490 517 set num $newhist(banknum) 491 518 if {$newhist(insttype) == "TOF"} { 492 set newhist(2tLimit) $newhist(tmin$num)519 set newhist(2tLimit) [expr {$newhist(tmin$num) / 10.}] 493 520 if {[llength $newhist(banklist)] == $newhist(instbanks)} { 494 521 set newhist(setnum) $newhist(banknum) … … 557 584 [string trim [string range $line 12 end]] 558 585 } 559 # scan for the INS BANKline586 # scan for the INS HTYPE line 560 587 if {[string first "INS HTYPE" $line] == 0} { 561 588 if {[string index [lindex $line 2] 2] == "T"} { … … 563 590 } elseif {[string index [lindex $line 2] 2] == "E"} { 564 591 set newhist(insttype) ED 592 } elseif {[string index [lindex $line 2] 1] == "X"} { 593 set newhist(insttype) "CW X" 565 594 } else { 566 set newhist(insttype) CW595 set newhist(insttype) "CW N" 567 596 } 568 597 } … … 575 604 set b [string trim $b] 576 605 set newhist(inst${b}ITYP) [string trim $c] 606 } 607 if {[regexp {INS ([ 1-9][0-9])BNKPAR(.*)} $line a b c]} { 608 set b [string trim $b] 609 set newhist(inst${b}Angle) [string trim [lindex $c 1]] 577 610 } 578 611 } … … 604 637 } 605 638 if {$newhist(dummy)} {PostDummyOpts $np; ValidateDummyHist $np} 639 LabelInstParm 606 640 } 607 641 … … 634 668 } elseif {[catch {expr $newhist(2tLimit)}]} { 635 669 append err " The 2Theta/d-space limit is not valid\n" 670 } elseif {$newhist(2tLimit) <= 0} { 671 append err " The 2Theta/d-space limit is not valid\n" 636 672 } 637 673 if {[string trim $newhist(LimitMode)] == ""} { 638 append err " Please choose between either a 2Theta or d-space limit\n"674 append err " Please choose between either a 2Theta, Q or d-space limit\n" 639 675 } 640 676 … … 659 695 puts $fp $newhist(banknum) 660 696 puts $fp $newhist(setnum) 661 if {$newhist(LimitMode) } {697 if {$newhist(LimitMode) == 1} { 662 698 puts $fp "T" 663 } else { 699 puts $fp "$newhist(2tLimit)" 700 } elseif {$newhist(LimitMode) == 2} { 664 701 puts $fp "D" 665 } 666 puts $fp "$newhist(2tLimit)" 702 set Q 100 703 catch {set Q [expr {4*acos(0)/$newhist(2tLimit)}]} 704 puts $fp "$Q" 705 } else { 706 puts $fp "D" 707 puts $fp "$newhist(2tLimit)" 708 } 667 709 puts $fp "/" 668 710 puts $fp "X" … … 705 747 } 706 748 file delete exptool.in exptool.out 707 } 708 709 proc RunRawplot {} { 749 # set the powpref warning (2 = required) 750 set expgui(needpowpref) 2 751 set msg "A histogram was added" 752 if {[string first $msg $expgui(needpowpref_why)] == -1} { 753 append expgui(needpowpref_why) "\t$msg\n" 754 } 755 # select the most recently added histogram 756 if {!$err} { 757 set i [llength $expmap(histlistboxcontents)] 758 if {$i > 0} { 759 incr i -1 760 set expgui(curhist) $i 761 sethistlist 762 } 763 } 764 } 765 766 proc RunRawplot {parent} { 710 767 global newhist tcl_platform 768 set f1 $newhist(rawfile) 769 set f2 $newhist(instfile) 711 770 # for Windows put a message on top, in case file names must be shortened 712 771 if {$tcl_platform(platform) == "windows"} { 713 set f1 {}714 772 catch {set f1 [file nativename \ 715 773 [file attributes $newhist(rawfile) -shortname]]} 716 set f2 {}717 774 catch {set f2 [file nativename \ 718 775 [file attributes $newhist(instfile) -shortname]]} 719 if {$f1 != "" || $f2 != ""} { 720 set msg "Note: input to RAWPLOT\n" 721 if {$f1 != ""} {append msg "data file: $f1\n"} 722 if {$f2 != ""} {append msg "instrument file: $f2"} 723 MyMessageBox -icon info -message $msg -parent . 724 } 776 } 777 if {$f1 != "" || $f2 != ""} { 778 #set msg "Note: input to RAWPLOT\n" 779 #if {$f1 != ""} {append msg "data file: $f1\n"} 780 #if {$f2 != ""} {append msg "instrument file: $f2"} 781 catch {toplevel $parent.msg} 782 catch {eval destroy [winfo children $parent.msg]} 783 wm title $parent.msg "File names" 784 grid [label $parent.msg.1 \ 785 -text "File names to be input to RAWPLOT" \ 786 -justify center -anchor center] \ 787 -col 0 -row 0 -columnspan 2 788 if {$f1 != ""} { 789 grid [label $parent.msg.2a \ 790 -text "Raw histogram: $f1" \ 791 -justify center -anchor e] \ 792 -col 0 -row 1 793 grid [button $parent.msg.2b \ 794 -command "clipboard clear; clipboard append $f1" \ 795 -text "put name\nin clipboard"] \ 796 -col 1 -row 1 797 } 798 if {$f2 != ""} { 799 grid [label $parent.msg.3a \ 800 -text "Raw histogram: $f2" \ 801 -justify center -anchor e] \ 802 -col 0 -row 2 803 grid [button $parent.msg.3b \ 804 -command "clipboard clear; clipboard append $f2" \ 805 -text "put name\nin clipboard"] \ 806 -col 1 -row 2 807 } 808 grid [button $parent.msg.4 \ 809 -command "destroy $parent.msg" \ 810 -text "Close"] \ 811 -col 0 -columnspan 2 -row 9 725 812 } 726 813 # start RAWPLOT 727 814 runGSASprog rawplot 1 815 if {[winfo exists $parent.msg]} {raise $parent.msg} 816 update 728 817 } 729 818 #--- Dummy histogram stuff … … 740 829 $np.d1.m2 config -text {} 741 830 $np.b1 config -state disabled 742 grid forget $np.l3 $np.e3 $np.cb3 $np.cb4 $np.bank $np.f6a743 grid $np.dl1 -column 0 -row 8744 grid $np.d1 -column 1 -row 8 -rowspan 2 -columnspan 4 -sticky e745 grid $np.dl3 -column 0 -columnspan 99 -row 10 -sticky ew831 grid forget $np.l3 $np.e3 $np.cb3 $np.cb4 $np.cb5 $np.bank $np.f6a 832 grid $np.dl1 -column 0 -row 18 833 grid $np.d1 -column 1 -row 18 -rowspan 2 -columnspan 4 -sticky e 834 grid $np.dl3 -column 0 -columnspan 99 -row 20 -sticky ew 746 835 if {$newhist(insttype) == "TOF"} { 747 836 $np.dl1 config -text "Data range:\n(TOF)" 748 837 $np.d1.lu config -text millisec 749 grid $np.dl2 -column 0 -row 9838 grid $np.dl2 -column 0 -row 19 750 839 catch { 751 840 set s $newhist(setnum) … … 754 843 $np.d1.m2 config -text $tmax 755 844 } 756 } elseif { $newhist(insttype)== "CW"} {845 } elseif {[lindex $newhist(insttype) 0] == "CW"} { 757 846 $np.dl1 config -text "Data range:\n(2Theta)" 758 847 $np.d1.lu config -text degrees … … 765 854 $np.d1.m1 config -text 1. 766 855 $np.d1.m2 config -text 200. 767 grid $np.dl2 -column 0 -row 9856 grid $np.dl2 -column 0 -row 19 768 857 } else { 769 858 $np.dl1 config -text "No file\nselected" … … 782 871 $np.b1 config -state normal 783 872 grid $np.bank -column 2 -row 3 -columnspan 7 -sticky ew 784 grid $np.f6a -column 4 -row 8 -rowspan 2 785 grid $np.l3 -column 0 -row 8 -rowspan 2 786 grid $np.e3 -column 1 -row 8 -rowspan 2 787 grid $np.cb3 -column 2 -row 8 -sticky w 788 grid $np.cb4 -column 2 -row 9 -sticky w 873 grid $np.f6a -column 4 -row 18 -rowspan 3 874 grid $np.l3 -column 0 -row 18 -rowspan 3 875 grid $np.e3 -column 1 -row 18 -rowspan 3 876 grid $np.cb3 -column 2 -row 18 -sticky w 877 grid $np.cb4 -column 2 -row 20 -sticky w 878 grid $np.cb5 -column 2 -row 19 -sticky w 789 879 } 790 880 } … … 839 929 [lindex $newhist(inst${s}ICONS) 0]}] 840 930 } 841 } elseif { $newhist(insttype)== "CW"} {931 } elseif {[lindex $newhist(insttype) 0] == "CW"} { 842 932 if {$newhist(tmin) <= 0 } { 843 933 $np.d1.e1 config -fg red … … 968 1058 } 969 1059 file delete exptool.in exptool.out 1060 # set the powpref warning (2 = required) 1061 set expgui(needpowpref) 2 1062 set msg "A histogram was added" 1063 if {[string first $msg $expgui(needpowpref_why)] == -1} { 1064 append expgui(needpowpref_why) "\t$msg\n" 1065 } 970 1066 } 971 1067 … … 1943 2039 } 1944 2040 file delete exptool.in exptool.out 2041 # set the powpref warning (2 = required) 2042 set expgui(needpowpref) 2 2043 set msg "A phase was replaced" 2044 if {[string first $msg $expgui(needpowpref_why)] == -1} { 2045 append expgui(needpowpref_why) "\t$msg\n" 2046 } 1945 2047 destroy $top 1946 2048 } … … 1997 2099 set newhist(insttype) {} 1998 2100 set newhist(dummy) 0 2101 set newhist(instfiletext) {}
Note: See TracChangeset
for help on using the changeset viewer.