Ignore:
Timestamp:
Sep 21, 2012 5:56:33 PM (11 years ago)
Author:
toby
Message:

more Fourier work; remove warning on R *3* H sg in CIF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/gsascmds.tcl

    r1216 r1221  
    39323932    exit
    39333933}
     3934
     3935# Fourier routines
     3936proc EditFourier {phase} {
     3937    #is this a valid phase #?
     3938    if {[lsearch $::expmap(phaselist) $phase] == -1} return
     3939    # check that all Fourier records are set to the current phase
     3940    foreach i [listFourier] {
     3941        set ph [Fourierinfo $i phase]
     3942        if {$ph != $phase} {Fourierinfo $i phase set $phase}
     3943    }
     3944    # for now we will not offer access to section, (dmin, dmax not supported)
     3945    set typelist {}
     3946    foreach i [listFourier] {
     3947        lappend typelist [Fourierinfo $i type]
     3948    }
     3949    set histlist [FourierHists $phase]
     3950    set limits  [getFourierLimits $phase]
     3951    if {[winfo exists .export]} {
     3952        set box .export.fourier
     3953    } else {
     3954        set box .fourier
     3955    }
     3956    catch {destroy $box}
     3957    toplevel $box
     3958    wm title $box "Set Fourier Options, phase $phase"
     3959    grid [frame $box.1] -row 1 -column 1 -rowspan 10
     3960    grid [frame $box.2] -row 1 -column 2 -rowspan 10
     3961    grid [frame $box.b] -sticky news -row 11 -column 1 -columnspan 2
     3962    grid columnconfigure $box.b 0 -weight 1
     3963    grid columnconfigure $box.b 3 -weight 1
     3964    grid [button $box.b.1 -text Continue \
     3965              -command "set ::DXTL(quit) 0; destroy $box" \
     3966             ] -row 1 -column 1
     3967    grid [button $box.b.2 -text Quit \
     3968              -command "set ::DXTL(quit) 1; destroy $box" \
     3969             ] -row 1 -column 2
     3970   
     3971    # map type selection
     3972    set row 0
     3973    grid [label $box.1.$row -text "Select map type(s)"] -column 1 -row $row
     3974    foreach typ {DELF FCLC FOBS 2FDF 3FDF 4FDF PTSN DPTS} lbl {
     3975        "Difference Fourier" "Fcalc Fourier" "Fobs Fourier"
     3976        "2*Fo-Fc Fourier" "3*Fo-2*Fc Fourier" "4*Fo-3*Fc Fourier" "Patterson map" "Delta-F Patterson"\
     3977        } {
     3978            incr row
     3979            grid [ \
     3980                       checkbutton $box.1.$row -variable ::DXTL($typ) \
     3981                       -text "$lbl ($typ)" \
     3982                      ] -column 1 -row $row -sticky w
     3983            if {[lsearch $typelist $typ] == -1} {
     3984                set ::DXTL($typ) 0
     3985            } else {
     3986                set ::DXTL($typ) 1
     3987            }
     3988        }
     3989    grid [label $box.2.a1 -text "Histogram(s) to be used:\n(last superceeds)"] -column 1 -row 1
     3990    grid [label $box.2.a2 -textvariable ::DXTL(histlist) -width 20] -column 2 -row 1 -columnspan 2
     3991    grid [button $box.2.a3 -text Set \
     3992              -command "SetFourierHists $box"] -column 5 -row 1
     3993    set ::DXTL(histlist) {}
     3994    foreach i $histlist {
     3995        if {$::DXTL(histlist) != ""} {append ::DXTL(histlist) ", "}
     3996        append ::DXTL(histlist) $i
     3997    }
     3998    grid [label $box.2.m1 -text min] -column 2 -row 2
     3999    grid [label $box.2.m2 -text max] -column 3 -row 2
     4000    grid [label $box.2.m3 -text "map step\n(A)"] -column 4 -row 2
     4001    set row 3
     4002    foreach axis {X Y Z} lim [lrange $limits 1 end] step [lindex $limits 0] {
     4003        incr row
     4004        grid [label $box.2.0$axis -text "$axis limits"] -column 1 -row $row -sticky e
     4005        grid [entry $box.2.min$axis -width 10 -textvariable ::DXTL(min$axis)] -column 2 -row $row
     4006        grid [entry $box.2.max$axis -width 10 -textvariable ::DXTL(max$axis)] -column 3 -row $row
     4007        grid [entry $box.2.step$axis -width 10 -textvariable ::DXTL(step$axis)] -column 4 -row $row
     4008        set ::DXTL(min$axis) [lindex $lim 0]
     4009        set ::DXTL(max$axis) [lindex $lim 1]
     4010        set ::DXTL(step$axis) [format "%.4f" [expr {$step + 0.0001}]]
     4011    }
     4012    putontop $box
     4013    tkwait window $box
     4014    afterputontop
     4015    if $::DXTL(quit) return
     4016    delFourier
     4017    foreach typ {DELF FCLC FOBS 2FDF 3FDF 4FDF PTSN DPTS} {
     4018        if {$::DXTL($typ)} {
     4019            addFourier $phase $typ
     4020        }
     4021    }
     4022    if {$::DXTL(histlist) != "<none>"} {
     4023        FourierHists $phase set [regsub -all "," $::DXTL(histlist) " "]
     4024    }
     4025    setFourierLimits $phase \
     4026        [list $::DXTL(stepX) $::DXTL(stepY) $::DXTL(stepZ)] \
     4027        [list $::DXTL(minX) $::DXTL(maxX)] \
     4028        [list $::DXTL(minY) $::DXTL(maxY)] \
     4029        [list $::DXTL(minZ) $::DXTL(maxZ)]
     4030    incr ::expgui(changed)
     4031}
     4032
     4033proc SetFourierHists {top} {
     4034    set box $top.hstsel
     4035    set ::DXTL(histbox) $box
     4036    catch {destroy $box}
     4037    toplevel $box
     4038    wm title $box "Select Histograms"
     4039    grid [frame $box.1 -class HistList] -column 1 -row 1 -sticky news
     4040    grid columnconfigure $box 1 -weight 1
     4041    grid [frame $box.2] -column 2 -row 1
     4042    grid [label $box.2.a -text {Select a histogram from the box
     4043to the left to add it to the
     4044histogram list below
     4045
     4046(note that reflection intensities
     4047from the last histograms in list
     4048override earlier ones)
     4049
     4050Histogram List:}] \
     4051    -column 1 -row 1
     4052    grid [label $box.2.b -textvariable ::DXTL(histlist)] -column 1 -row 2
     4053    grid [button $box.2.c -text Clear -command ClearFourierHist] \
     4054        -column 1 -row 3
     4055    grid [button $box.3 -text Close -command "destroy $box"] \
     4056        -column 1 -row 3 -columnspan 2
     4057    MakeHistBox $box.1
     4058    bind $box.1.lbox <ButtonRelease-1>  {
     4059        set selhist [$::DXTL(histbox).1.lbox curselection]
     4060        if {[llength $selhist] != 1} return
     4061        AddFourierHist [lindex $::expmap(powderlist) $selhist]
     4062        lappend ::DXTL(histlist)
     4063        set hist [lindex $::expmap(powderlist) $selhist]
     4064        $::DXTL(histbox).2.b config -text $hist
     4065    }
     4066    sethistlist
     4067    putontop $box
     4068    tkwait window $box
     4069    afterputontop
     4070}
     4071
     4072proc AddFourierHist {num} {
     4073    if {$::DXTL(histlist) == "<none>"} {
     4074        set ::DXTL(histlist) {}
     4075    }
     4076    if {$::DXTL(histlist) != ""} {append ::DXTL(histlist) ", "}
     4077    append ::DXTL(histlist) $num
     4078}
     4079
     4080proc ClearFourierHist {} {
     4081    set ::DXTL(histlist) "<none>"
     4082}
Note: See TracChangeset for help on using the changeset viewer.