Changeset 234 for trunk/expgui


Ignore:
Timestamp:
Dec 4, 2009 5:02:38 PM (13 years ago)
Author:
toby
Message:

# on 2000/07/06 22:43:40, toby did:
Change profile term labeling to use GetProfileTerms?
use file copy for archive (unix)
put site multiplity on atoms page
implement MakeHistBox? for histogram selection boxes
Add a heading for global mode to the histogram selection box
Implement changing profile type
add binding to select all atoms
click on atom box title rotates through atom sorting modes
new atom sort mode: mult

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2000/06/09 03:45:28 to 2000/07/06 22:43:40
    • Property rcs:lines changed from +51 -19 to +118 -158
    • Property rcs:rev changed from 1.27 to 1.28
    r199 r234  
    6767# use a separate window for DISAGL (default)
    6868set expgui(disaglSeparateBox) 1
     69set expgui(DefaultPeakType) 0
    6970#=============================================================================
    70 # Store names of profile terms.
    71 array set expgui {
    72     prof-T-1 {TOF-type1 alp-0 bet-0 sig-0 alp-1 bet-1 sig-1 rstr rsta \
    73             sig-2 rsca s1ec s2ec }
    74     prof-T-2 {TOF-type2 alp-0 sig-0 gam-0 alp-1 sig-1 gam-1 beta sig-2 \
    75             gam-2 switch ptec stec difc difa zero }
    76     prof-T-3 {TOF-type3 alp bet-0 bet-1 sig-0 sig-1 sig-2 gam-0 gam-1 \
    77             gam-2 gsf g1ec g2ec rstr rsta rsca L11 L22 L33 L12 L13 L23 }
    78     prof-T-4 {TOF-type4 alp bet-0 bet-1 sig-1 sig-2 gam-2 g2ec gsf \
    79             rstr rsta rsca eta}
    80     prof-C-1 {CW-type U V W asym F1 F2 }
    81     prof-C-2 {CW-type2 GU GV GW LX LY trns asym shft GP stec ptec sfec \
    82             L11 L22 L33 L12 L13 L23 }
    83     prof-C-3 {CW-type3 GU GV GW GP LX LY S/L H/L trns shft stec ptec sfec \
    84             L11 L22 L33 L12 L13 L23 }
    85     prof-C-4 {CW-type4 GU GV GW GP LX ptec trns shft sfec S/L H/L eta}
    86 }
    87 # >>>>>>>>>>>>>>>> End of Profile Terms  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    8871#----------------------------------------------------------------
    8972# where are we?
     
    230213    setphases
    231214
    232     # disable the "global options" that don't make sense based
    233     # on the histograms present
     215    # disable the "global options" that don't make sense based on
     216    # which histograms present
    234217    foreach num {1 2 3 4 5} {
    235218        set flag($num) 0
    236219    }
     220    # save a list of the allowed modes, too
     221    set expgui(AllowedHistSelectModes) {0 6}
    237222    foreach h $expmap(powderlist) {
    238223        if {[string range $expmap(htype_$h) 2 2] == "T"} {set flag(1) 1}
     
    249234        if $flag($num) {
    250235            $expgui(fm).option.menu.editmode entryconfigure $lbl -state normal
     236            lappend expgui(AllowedHistSelectModes) $num
    251237        } else {
    252238            $expgui(fm).option.menu.editmode entryconfigure $lbl -state disabled
     
    649635                set file $expnam.EXP.[format "%3.3d" $number]
    650636            }
    651             exec cp $expgui(expfile) $file
     637            file copy $expgui(expfile) $file
    652638            if [catch {exec gzip $file}] {
    653639                exec echo "\n----------------------------------------------" >> $expnam.LST
     
    792778    set phase $expgui(curPhase)
    793779    set atomlist {}
     780    set typehead "type  "
     781    set namehead "  name  "
     782    set multhead "Mult"
     783    set coordhead "   "
    794784    if  {$expgui(asorttype) == "type"} {
    795785        # sort on atom type
     786        set typehead "type* "
    796787        foreach atom $expmap(atomlist_$phase) {
    797788            lappend atomlist "$atom [atominfo $phase $atom type] $phase"
     
    800791    } elseif {$expgui(asorttype) == "number"} {
    801792        # sort on atom number
     793        set namehead "* name  "
    802794        foreach atom $expmap(atomlist_$phase) {
    803795            lappend atomlist "$atom $atom $phase"
    804796        }
    805797        set expmap(atomlistboxcontents) [lsort -integer -index 1 $atomlist]
     798    } elseif {$expgui(asorttype) == "mult"} {
     799        # sort on atom number
     800        set multhead "Mlt*"
     801        foreach atom $expmap(atomlist_$phase) {
     802            lappend atomlist "$atom [atominfo $phase $atom mult] $phase"
     803        }
     804        set expmap(atomlistboxcontents) [lsort -integer -decreasing -index 1 $atomlist]
    806805    } elseif {$expgui(asorttype) == "x"} {
    807806        # sort on x
     807        set coordhead "(x*)"
    808808        foreach atom $expmap(atomlist_$phase) {
    809809            lappend atomlist "$atom [atominfo $phase $atom x] $phase"
     
    812812    } elseif {$expgui(asorttype) == "y"} {
    813813        # sort on y
     814        set coordhead "(y*)"
    814815        foreach atom $expmap(atomlist_$phase) {
    815816            lappend atomlist "$atom [atominfo $phase $atom y] $phase"
     
    818819    } elseif {$expgui(asorttype) == "z"} {
    819820        # sort on z
     821        set coordhead "(z*)"
    820822        foreach atom $expmap(atomlist_$phase) {
    821823            lappend atomlist "$atom [atominfo $phase $atom z] $phase"
     
    823825        set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist]
    824826    } else {
    825         error "Bad expgui(asorttype = $expgui(asorttype)"
     827        error "Bad expgui(asorttype) = $expgui(asorttype)"
    826828    }
    827829
     
    837839            }   
    838840        }
    839         set line [format "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%9.4f" \
     841        set line [format "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%4d%9.4f" \
    840842                $atom \
    841843                [atominfo $phase $atom label] \
     
    845847                [atominfo $phase $atom y] \
    846848                [atominfo $phase $atom z] \
     849                [atominfo $phase $atom mult] \
    847850                [atominfo $phase $atom frac]
    848851        ]
     852
    849853        # add temperature factors (iso/anoiso)
    850854        if {[atominfo $phase $atom temptype] == "A"} {
     
    867871    $expgui(atomtitle) delete 0 end
    868872    if {$maxline == "A"} {
    869         $expgui(atomtitle) insert end [format "%10s %6s %8s %30s%9s  %s" \
    870                 " name  " "type  " "ref/damp  " "fractional coordinates    " \
    871                 " Occupancy" \
     873        $expgui(atomtitle) insert end [format "%10s %6s %8s%29s %9s  %s" \
     874                $namehead $typehead "ref/damp  " \
     875                "fractional coordinates$coordhead" \
     876                "$multhead Occupancy" \
    872877                "Uiso/Uij                                            "]
    873878    } else {
    874         $expgui(atomtitle) insert end [format "%10s %6s %8s %30s%9s  %s" \
    875                 " name  " "type  " "ref/damp  " "fractional coordinates    " \
    876                 " Occupancy" \
     879        $expgui(atomtitle) insert end [format "%10s %6s %8s%29s %9s  %s" \
     880                $namehead $typehead "ref/damp  " \
     881                "fractional coordinates$coordhead" \
     882                "$multhead Occupancy" \
    877883                "Uiso"]
    878884    }
     
    10821088}
    10831089
     1090# make a histogram box; used in MakeHistPane,
     1091proc MakeHistBox {frm} {
     1092    global expgui
     1093    grid [label $frm.mode -text "Select a Histogram" \
     1094            -bg beige -anchor center] \
     1095            -row 0 -column 0 -columnspan 2 -sticky ew
     1096    bind $frm.mode <Button-1> {
     1097        set i [lsearch $expgui(AllowedHistSelectModes) $expgui(globalmode)]
     1098        set expgui(globalmode) [lindex \
     1099                "$expgui(AllowedHistSelectModes) \
     1100                $expgui(AllowedHistSelectModes)" [incr i]]
     1101        sethistlist
     1102    }
     1103    bind $frm.mode <Button-3> {set expgui(globalmode) 0; sethistlist}
     1104    grid [listbox $frm.title -height 1 -relief flat \
     1105            -exportselection 0 \
     1106            -font $expgui(histfont) ] -row 1 -column 0 -sticky ew
     1107    grid [listbox $frm.lbox -height 10 -width 25 \
     1108            -exportselection 0 \
     1109            -font $expgui(histfont) \
     1110            -xscrollcommand "$frm.x set" \
     1111            -yscrollcommand "$frm.y set" \
     1112            ] -row 2 -column 0 -sticky news
     1113    lappend expgui(HistSelectList) $frm
     1114    grid [scrollbar $frm.x -orient horizontal \
     1115            -command "move2boxes \" $frm.title $frm.lbox \" "
     1116    ] -row 3 -column 0 -sticky ew
     1117    grid [scrollbar $frm.y \
     1118            -command "$frm.lbox yview"] \
     1119            -row 2 -column 1 -sticky ns
     1120    grid columnconfigure $frm 0 -weight 1
     1121    grid rowconfigure $frm 2 -weight 1
     1122}
     1123
    10841124# update the histogram list
    10851125# to do: show histogram ref flags?
    10861126proc sethistlist {} {
    10871127    global expgui expmap
     1128    array set lbl {
     1129        1 "Select 1 or more\nTOF Histograms"
     1130        2 "Select 1 or more\nCW Neutron Histograms"
     1131        3 "Select 1 or more\nAlpha 1,2 X-ray Histograms"
     1132        4 "Select 1 or more\nmonochromatic X-ray Histograms"
     1133        5 "Select 1 or more Energy\nDisperive X-ray Histograms"
     1134        6 "Select 1 or more of\n any type Histograms"
     1135    }
    10881136    foreach lbox $expgui(HistSelectList) {
    10891137        $lbox.title delete 0 end
     
    10911139        if {$expgui(globalmode) != 0} {
    10921140            $lbox.lbox config -selectmode extended
     1141            $lbox.mode config -text $lbl($expgui(globalmode)) -bg yellow
    10931142        } else {
    10941143            $lbox.lbox config -selectmode browse
     1144            $lbox.mode config -text "Select a histogram" -bg beige
    10951145        }
    10961146    }
     
    17751825            set entrycmd(pcut_$i) "hapinfo $hist $i pcut"
    17761826            set entryvar(pcut_$i) [hapinfo $hist $i pcut]
     1827
     1828            pack [button $ProfileFrame.1.b1  \
     1829                    -text "Change Type" \
     1830                    -command "ChangeProfileType $hist $i"]\
     1831                    -side left
    17771832           
    17781833            set col -1
    17791834            set row 1
    17801835            set nterms [hapinfo $hist $i profterms]
    1781             set lbls {}
    1782             catch {set lbls $expgui(prof-$htype-$ptype)}
    1783             # for type 4, add extra terms depending on the cell type
    1784             if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $i]}
     1836            set lbls "dummy [GetProfileTerms $i $hist $ptype]"
    17851837            for { set num 1 } { $num <= $nterms } { incr num } {
    17861838                set term {}
     
    18431895                set nterms [hapinfo $hist1 $phase1 profterms]
    18441896                set htype [string range $expmap(htype_$hist1) 2 2]
    1845                 set lbls $expgui(prof-$htype-$ptype)
    1846                 # for type 4, add extra terms depending on the cell type
    1847                 if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $phase1]}
     1897                set lbls "dummy [GetProfileTerms $phase1 $hist1 $ptype]"
    18481898                # Create a frame for this type
    18491899                incr i
     
    18511901                if {$expgui(haveBW)} {
    18521902                    grid [TitleFrame $expgui(ProfileBox).f.$i \
    1853                             -text "Histogram [CompressList $histarray($key)] (type $ptype)" \
     1903                            -text "(type $ptype)" \
    18541904                            -relief groove -bd 2] \
    18551905                            -column 0 -row $i -sticky ew
     
    18791929                        -text "Global Edit"] -row 0 -column 4 -sticky w
    18801930                set entryvar(pdamp_$i) [hapinfo $hist $phase pdamp]
     1931                grid [button $ProfileFrame.1.b1 -text "Change Type"] \
     1932                        -row 0 -column 5 -sticky w
    18811933                set col -1
    18821934                set row 2
     
    19071959                    [list $curhistlist] \
    19081960                    [list $curphaslist]"
     1961            $ProfileFrame.1.b1 config -command "ChangeProfileType \
     1962                    [list $curhistlist] [list $curphaslist]"
    19091963            set entrycmd(pdamp_$i) "hapinfo \
    19101964                    [list $curhistlist] \
     
    19261980    # enable traces on entryvar now
    19271981    set entrycmd(trace) 1
    1928 }
    1929 
    1930 # profile labels for type 4 profile
    1931 proc type4lbls {lbls nterms phase} {
    1932     if {$nterms == 14} {
    1933         # cubic
    1934         lappend lbls S400 S220
    1935     } elseif {$nterms == 15} {
    1936         # hexagonal
    1937         lappend lbls S400 S004 S202
    1938     } elseif {$nterms == 16} {
    1939         # tetragonal or rhombohedral
    1940         if {[phaseinfo $phase a] == [phaseinfo $phase c]} {
    1941             # rhombohedral
    1942             lappend lbls S400 S220 S310 S211
    1943         } else {
    1944             lappend lbls S400 S004 S220 S202
    1945         }
    1946     } elseif {$nterms == 18} {
    1947         # orthorhombic
    1948         lappend lbls S400 S040 S004 S220 S202 S022 
    1949     } elseif {$nterms == 21} {
    1950         # monoclinic 
    1951         lappend lbls S400 S040 S004 S220 S202 S022 S301 S103 S121
    1952     } elseif {$nterms == 25} {
    1953         # triclinic
    1954         lappend lbls S400 S040 S004 S220 S202 S022 S310 S103 S031 \
    1955                 S130 S301 S013 S211 S121 S112
    1956     }
    1957     return $lbls
    19581982}
    19591983
     
    23352359    set col -1
    23362360    set row 1
    2337     set lbls $expgui(prof-$htype-$ptype)
    2338     # for type 4, add extra terms depending on the cell type
    2339     if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $i]}
     2361    set lbls "dummy [GetProfileTerms $phase $hist $ptype]"
    23402362    pack [frame $w.1 -bd 6 -relief groove  -bg beige \
    23412363            ] -side top -expand yes -fill both
     
    25792601    #-------------- Begin Atom Coordinates Box  ------------------------------
    25802602    grid [listbox  $fbig.title -height 1 -relief flat \
    2581             -exportselection 0] \
     2603            -exportselection 0 -bg lightgrey -fg black \
     2604            -selectforeground black -selectbackground lightgrey] \
    25822605            -row 0 -column 0 -sticky ew
    25832606    set expgui(atomtitle) $fbig.title
     2607    bind $expgui(atomtitle) <Button-1> {
     2608        set i [lsearch {number type mult x y z} $expgui(asorttype)]
     2609        incr i
     2610        set expgui(asorttype) [lindex {number type mult x y z number} $i]
     2611        DisplayAllAtoms
     2612    }
     2613    bind $expgui(atomtitle) <Button-3> {set expgui(asorttype) number; DisplayAllAtoms}
     2614
    25842615    $expgui(atomtitle) configure -font $expgui(coordfont) -selectmode extended
    25852616    grid [listbox   $fbig.lbox -height 10 \
     
    27042735    #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
    27052736    global expgui
    2706     grid [frame $expgui(histFrame).hs] \
    2707             -column 0 -row 0 -rowspan 10 -sticky nsew
     2737   
    27082738    grid columnconfigure $expgui(histFrame) 0 -weight 1
    27092739    grid rowconfigure $expgui(histFrame) 1 -weight 1
    27102740    grid rowconfigure $expgui(histFrame) 2 -weight 1
    27112741    grid rowconfigure $expgui(histFrame) 3 -weight 1
    2712     grid [listbox $expgui(histFrame).hs.title -height 1 -relief flat \
    2713             -exportselection 0 \
    2714             -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2715     grid [listbox $expgui(histFrame).hs.lbox -height 10 -width 25 \
    2716             -exportselection 0 \
    2717             -font $expgui(histfont) \
    2718             -xscrollcommand "$expgui(histFrame).hs.x set" \
    2719             -yscrollcommand "$expgui(histFrame).hs.y set" \
    2720             ] -row 1 -column 0 -sticky news
    2721     lappend expgui(HistSelectList) $expgui(histFrame).hs
    2722     grid [scrollbar $expgui(histFrame).hs.x -orient horizontal \
    2723             -command "move2boxes \" $expgui(histFrame).hs.title $expgui(histFrame).hs.lbox \" "
    2724     ] -row 2 -column 0 -sticky ew
    2725     grid [scrollbar $expgui(histFrame).hs.y \
    2726             -command "$expgui(histFrame).hs.lbox yview"] \
    2727             -row 1 -column 1 -sticky ns
    2728     grid columnconfigure $expgui(histFrame).hs 0 -weight 1
    2729     grid rowconfigure $expgui(histFrame).hs 1 -weight 1
     2742
     2743    grid [frame $expgui(histFrame).hs] \
     2744            -column 0 -row 0 -rowspan 10 -sticky nsew
     2745    MakeHistBox $expgui(histFrame).hs
    27302746    bind $expgui(histFrame).hs.lbox <ButtonRelease-1>  {
    27312747        set expgui(curhist) [$expgui(histFrame).hs.lbox curselection]
     
    27992815    #v v v v v v v v v v  BEGINNING OF SCALING PANE CODE v v v v v v v v v v
    28002816    global expgui
     2817
    28012818    pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both
    2802     grid [listbox $expgui(fracFrame).hs.title -height 1 -relief flat \
    2803             -exportselection 0 \
    2804             -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2805     grid [listbox $expgui(fracFrame).hs.lbox -height 10 -width 25 \
    2806             -exportselection 0 \
    2807             -font $expgui(histfont) \
    2808             -xscrollcommand "$expgui(fracFrame).hs.x set" \
    2809             -yscrollcommand "$expgui(fracFrame).hs.y set" \
    2810             ] -row 1 -column 0 -sticky news
    2811     lappend expgui(HistSelectList) $expgui(fracFrame).hs
    2812     grid [scrollbar $expgui(fracFrame).hs.x -orient horizontal \
    2813             -command "move2boxes \" $expgui(fracFrame).hs.title $expgui(fracFrame).hs.lbox \" "
    2814     ] -row 2 -column 0 -sticky ew
    2815     grid [scrollbar $expgui(fracFrame).hs.y \
    2816             -command "$expgui(fracFrame).hs.lbox yview"] \
    2817             -row 1 -column 1 -sticky ns
    2818     grid columnconfigure $expgui(fracFrame).hs 0 -weight 1
    2819     grid rowconfigure $expgui(fracFrame).hs 1 -weight 1
     2819    MakeHistBox $expgui(fracFrame).hs
    28202820    bind $expgui(fracFrame).hs.lbox <ButtonRelease-1> {
    28212821        set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection]
     
    28292829        }
    28302830    }
     2831
    28312832    pack [frame $expgui(fracFrame).f1] -fill both -expand true
    28322833    # Create a large canvas area containing a frame for each phase in the data set.
     
    28982899    # 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
    28992900    pack [frame $expgui(profFrame).hs] -side left -expand y -fill both
    2900     grid [listbox $expgui(profFrame).hs.title -height 1 -relief flat \
    2901             -exportselection 0 \
    2902             -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2903     grid [listbox $expgui(profFrame).hs.lbox -height 10 -width 25 \
    2904             -exportselection 0 \
    2905             -font $expgui(histfont) \
    2906             -xscrollcommand "$expgui(profFrame).hs.x set" \
    2907             -yscrollcommand "$expgui(profFrame).hs.y set" \
    2908             ] -row 1 -column 0 -sticky news
    2909     lappend expgui(HistSelectList) $expgui(profFrame).hs
    2910     grid [scrollbar $expgui(profFrame).hs.x -orient horizontal \
    2911             -command "move2boxes \" $expgui(profFrame).hs.title $expgui(profFrame).hs.lbox \" "
    2912     ] -row 2 -column 0 -sticky ew
    2913     grid [scrollbar $expgui(profFrame).hs.y \
    2914             -command "$expgui(profFrame).hs.lbox yview"] \
    2915             -row 1 -column 1 -sticky ns
    2916     grid columnconfigure $expgui(profFrame).hs 0 -weight 1
    2917     grid rowconfigure $expgui(profFrame).hs 1 -weight 1
     2901    MakeHistBox $expgui(profFrame).hs
    29182902    bind $expgui(profFrame).hs.lbox <ButtonRelease-1> {
    29192903        set expgui(curhist) [$expgui(profFrame).hs.lbox curselection]
     
    29652949}
    29662950pack [frame $expgui(lsFrame).hs] -side left -expand y -fill both
    2967 grid [listbox $expgui(lsFrame).hs.title -height 1 -relief flat \
    2968         -exportselection 0 \
    2969         -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2970 grid [listbox $expgui(lsFrame).hs.lbox -height 10 -width 25 \
    2971         -exportselection 0 \
    2972         -font $expgui(histfont) \
    2973         -xscrollcommand "$expgui(lsFrame).hs.x set" \
    2974         -yscrollcommand "$expgui(lsFrame).hs.y set" \
    2975         ] -row 1 -column 0 -sticky news
    2976 lappend expgui(HistSelectList) $expgui(lsFrame).hs
    2977 grid [scrollbar $expgui(lsFrame).hs.x -orient horizontal \
    2978         -command "move2boxes \" $expgui(lsFrame).hs.title $expgui(lsFrame).hs.lbox \" "
    2979         ] -row 2 -column 0 -sticky ew
    2980 grid [scrollbar $expgui(lsFrame).hs.y \
    2981         -command "$expgui(lsFrame).hs.lbox yview"] \
    2982         -row 1 -column 1 -sticky ns
    2983 grid columnconfigure $expgui(lsFrame).hs 0 -weight 1
    2984 grid rowconfigure $expgui(lsFrame).hs 1 -weight 1
     2951MakeHistBox $expgui(lsFrame).hs
    29852952bind $expgui(lsFrame).hs.lbox <ButtonRelease-1> {
    29862953    set expgui(curhist) [$expgui(lsFrame).hs.lbox curselection]
     
    31173084set expgui(asorttype) number
    31183085menu $expgui(fm).option.menu.asort
    3119 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
    3120         -label number -value number -variable expgui(asorttype)
    3121 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
    3122         -label type -value type -variable expgui(asorttype)
    3123 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
    3124         -label x -value x -variable expgui(asorttype)
    3125 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
    3126         -label y -value y -variable expgui(asorttype)
    3127 $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
    3128         -label z -value z -variable expgui(asorttype)
    3129 
     3086foreach opt {number type mult x y z} {
     3087    $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \
     3088            -label $opt -value $opt -variable expgui(asorttype)
     3089}
    31303090
    31313091$expgui(fm).option.menu add cascade -menu  $expgui(fm).option.menu.hsort \
Note: See TracChangeset for help on using the changeset viewer.