Changeset 878


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

# on 2006/03/29 03:54:37, toby did:
support profile editing (& grab from .EXP) in instedit (IPNS request)
don't hard-code profile names here (grab from gsascmds.tcl)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/instedit.tcl

    • Property rcs:date changed from 2006/02/22 00:29:58 to 2006/03/29 03:54:37
    • Property rcs:lines changed from +13 -8 to +98 -15
    • Property rcs:rev changed from 1.6 to 1.7
    r868 r878  
    131131proc instNewBank {box} {
    132132    global instdat instparms
     133    # don't allow this for TOF
    133134    set i [incr instdat(lastbank)]
    134135    instMakeBankSel $box
     
    149150proc instShowBank {box} {
    150151    global instdat instparms
     152    set topfr $box.a
    151153    if {$instparms(bank) == 0} return
    152154    switch [string range $instdat(banktype) 0 2] {
     
    170172            -column 1 -row 2 -sticky w -columnspan 99
    171173
    172     if {$instparms(banklabel) == "TOF"} return
    173     if {$instparms(banklabel) == "ED X-ray"} return
    174 
     174    if {$instparms(banklabel) == "TOF"} {
     175        $topfr.n config -state disabled
     176        set col 0
     177        grid [label $bnkfr.l4 -text "DIFC:"] \
     178            -column [incr col] -row 4 -sticky e -rowspan 2
     179        grid [entry $bnkfr.e4d -textvariable instdat(difc$b) -width 10] \
     180            -column [incr col] -row 4 -sticky ew
     181        grid [label $bnkfr.l5 -text "DIFA:"] \
     182            -column [incr col] -row 4 -sticky e -rowspan 2
     183        grid [entry $bnkfr.e4e -textvariable instdat(difa$b) -width 10] \
     184            -column [incr col] -row 4 -sticky ew
     185        grid [label $bnkfr.l6 -text "Zero\nCorrection:" \
     186                  -anchor e -justify r] \
     187            -column [incr col] -row 4 -sticky e
     188        grid [entry $bnkfr.e6 -textvariable instdat(zero$b) -width 10] \
     189            -column [incr col] -row 4 -sticky ew
     190
     191        grid [frame [set prfrm $bnkfr.prof] -bd 2 -relief groove] \
     192            -column 0 -columnspan 99 -row 8
     193        grid [label $prfrm.l1 -text "Select profile: "] -column 0 -row 0
     194        grid [frame $prfrm.fr] -column 1 -columnspan 99 -row 0 -sticky w
     195        grid [frame $prfrm.fr1] -column 0 -columnspan 99 -row 2
     196        set instparms(profileframe) $prfrm.fr1
     197        for {set j 1} {$j <= $instparms(proftypes${b})} {incr j} {
     198            grid [radiobutton $prfrm.fr.$j -text $j -value $j \
     199                -command "ShowInstProfile $b" \
     200                -variable instparms(profilenum)] -row 1 -column $j
     201        }
     202        grid [button $prfrm.fr.a -text "Add profile" \
     203            -command "AddInstProfile $box $b"] -row 1 -column 98
     204        grid [button $prfrm.fr.n -text "Import profile" \
     205            -command "ImportInstProfile $box $prfrm.fr1 $b"] -row 1 -column 99
     206        set instparms(profilenum) 1
     207        ShowInstProfile $b
     208        return
     209    }
     210    if {$instparms(banklabel) == "ED X-ray"} {
     211        $topfr.n config -state disabled
     212        set col 0
     213        grid [label $bnkfr.l4 -text "2Theta:"] \
     214            -column [incr col] -row 4 -sticky e -rowspan 2
     215        grid [entry $bnkfr.e4d -textvariable instdat(difc$b) -width 10] \
     216            -column [incr col] -row 4 -sticky ew
     217        grid [label $bnkfr.l5 -text "POLA:"] \
     218            -column [incr col] -row 4 -sticky e -rowspan 2
     219        grid [entry $bnkfr.e4e -textvariable instdat(pola$b) -width 10] \
     220            -column [incr col] -row 4 -sticky ew
     221
     222        grid [frame [set prfrm $bnkfr.prof] -bd 2 -relief groove] \
     223            -column 0 -columnspan 99 -row 8
     224        grid [label $prfrm.l1 -text "Select profile: "] -column 0 -row 0
     225        grid [frame $prfrm.fr] -column 1 -columnspan 99 -row 0 -sticky w
     226        grid [frame $prfrm.fr1] -column 0 -columnspan 99 -row 2
     227        set instparms(profileframe) $prfrm.fr1
     228        for {set j 1} {$j <= $instparms(proftypes${b})} {incr j} {
     229            grid [radiobutton $prfrm.fr.$j -text $j -value $j \
     230                -command "ShowInstProfile $b" \
     231                -variable instparms(profilenum)] -row 1 -column $j
     232        }
     233        grid [button $prfrm.fr.a -text "Add profile" \
     234            -command "AddInstProfile $box $b"] -row 1 -column 98
     235        #grid [button $prfrm.fr.n -text "Import profile" \
     236        #    -command "ImportInstProfile $box $prfrm.fr1 $b"] -row 1 -column 99
     237        set instparms(profilenum) 1
     238        ShowInstProfile $b
     239        return
     240    }
     241
     242    $topfr.n config -state normal
    175243    set col 0
    176244    grid [label $bnkfr.l4a -text "Radiation\ntype:" -anchor e -justify r] \
     
    287355        set result [exec $wishshell \
    288356                [file join $expgui(scriptdir) dumpprof.tcl] $filename]
    289     }
     357    } errmsg
    290358    if {[set nhist [llength $result]] == 0} {
    291359        set msg "No profile information was read from file $filename"
     
    301369        incr i
    302370        set h [lindex $histrec 0]
    303         set type [lindex $histrec 1]
     371        set type [string range [lindex $histrec 1] 0 3]
     372        # instrument parameters
     373        set instparms(hstcons$h) [string range [lindex $histrec 1] 4 end]
    304374        if {[string range $type 0 2] == \
    305375                [string range $instdat(banktype) 0 2]} {
     
    395465
    396466proc instSelectPhase {proflist} {
    397     global instparms instdat
     467    global instparms instdat expgui
    398468    set top $instparms(top).sel
    399469    eval destroy [winfo children [set frame $top.prof]]
     
    401471    set col 0
    402472    set num [lindex $proflist 1]
    403     set lbl [lindex \
    404             {"" "1: Gaussian only" "2: Pseudo-Voigt" \
    405             "3: Pseudo-Voigt/FCJ Asym" "4: P-V/FCJ/Stephens Aniso Brdg"} $num]
     473    set T [string range $instdat(banktype) 2 2]
     474    set lbllst ""
     475    catch {set lbllst $expgui(prof-${T}-names)}
     476    set lbl [lindex "{} $lbllst" $num]
    406477    grid [label $frame.${col}_$row -justify left -anchor w \
    407             -text "Profile type $lbl"] \
     478            -text "Profile type $num: $lbl"] \
    408479            -column $col -row $row -columnspan 99 -sticky w
    409480    incr row
     
    452523        set instdat(prof${b}_${j}_$i) $val
    453524    }
     525    # TOF grab Difc, difA & zero
     526    if {$T == "T"} {
     527        set h $instparms(histimport)
     528        set difcons [lindex $instparms(hstcons$h) 0]
     529        set instdat(difc$b) [lindex $difcons 0]
     530        set instdat(difa$b) [lindex $difcons 1]
     531        set instdat(zero$b) [lindex $difcons 2]
     532    }
    454533    ShowInstProfile $b
    455534}
     
    466545
    467546proc ShowInstProfile {b} {
    468     global instparms instdat
     547    global instparms instdat expgui
    469548    set frame $instparms(profileframe)
     549    if {![winfo exists $frame]} return
    470550    set j $instparms(profilenum)
    471551    eval destroy [winfo children $frame]
     
    478558    grid $frame.${col}_$row -column $col -row $row -sticky ew
    479559    $menu delete 0 end
    480     foreach val { 1  2  3  4} \
    481             lbl {"1) Gaussian only" "2) Pseudo-Voigt" \
    482             "3) Pseudo-Voigt/FCJ Asym" "4) P-V/FCJ/Stephens Aniso Brdg"} {
    483         $menu add radiobutton -value $val -label $lbl \
     560    set T [string range $instdat(banktype) 2 2]
     561    set lbllst ""
     562    catch {set lbllst $expgui(prof-${T}-names)}
     563    set val 0
     564    foreach lbl $lbllst {
     565        incr val
     566        $menu add radiobutton -value $val -label "$val) $lbl" \
    484567                -command "instInitProf; ShowInstProfile $b" \
    485568                -variable instdat(proftype${b}_$j)
Note: See TracChangeset for help on using the changeset viewer.