Changeset 1178 for branches/sandbox


Ignore:
Timestamp:
Oct 25, 2011 8:13:56 PM (9 years ago)
Author:
toby
Message:

add log(I) option to liveplot: request from Ling Yang

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/liveplot

    r1162 r1178  
    572572    global expnam hst peakinfo xunits yunits cycle reflns modtime
    573573    global lasthst graph expgui box
    574     global obsvec calcvec diffvec
     574    global obsvec calcvec diffvec bckvec
    575575
    576576    if {$graph(yunits) == 2} {
     
    584584        wifdvec set {}
    585585        $box element config 1 -label {} -line 0 -hide 1
     586        $box element config 4 -label diff  -line 1 -hide 0
     587    } elseif {$graph(yunits) == 3} {
     588        bckvec expr 0*bckvec
     589        set msg {}
     590        if {[set calcvec(min)] <= 0} {
     591            if {$msg != ""} {append msg ", "}
     592            append msg "calculated"
     593        }
     594        if {[set obsvec(min)] <= 0} {
     595            if {$msg != ""} {append msg " & "}
     596            append msg "observed"
     597        }
     598        if {$msg != ""} {
     599            MyMessageBox -parent . -title "Invalid Range" \
     600                -message "Log computation impossible due to zero or negative $msg intensity values" \
     601                -icon warning -type Continue -default continue
     602        } else {
     603            set yunits {log(Intensity)}
     604            obsvec expr log10(obsvec)
     605            calcvec expr log10(calcvec)
     606            if {[set bckvec(min)] <= 0} {
     607                bckvec set {}
     608                $box element config 1 -label {} -line 0 -hide 1
     609            } else {
     610                bckvec expr log10(bckvec)
     611                $box element config 1 -label bckgr -line 1 -hide 0
     612            }
     613            diffvec set {}
     614            $box element config 4 -label {} -line 0 -hide 1
     615        }
    586616    } else {
    587617        $box element config 1 -label bckgr -line 1 -hide 0
     618        $box element config 4 -label diff  -line 1 -hide 0
    588619    }
    589620
     
    691722        }
    692723    }
    693     # offset the difference pattern
    694     set maxdiff  [set diffvec(max)]
    695     if {$expgui(autotick)} {
    696         diffvec set [diffvec + [expr {$cmin - $maxdiff}]]
    697     } else {
    698         diffvec set [diffvec + [expr {$cmin - 1.1*$maxdiff}]]
    699     }
    700     diffvec notify now
    701 
     724    catch {
     725        # offset the difference pattern
     726        set maxdiff  [set diffvec(max)]
     727        if {$expgui(autotick)} {
     728            diffvec set [diffvec + [expr {$cmin - $maxdiff}]]
     729        } else {
     730            diffvec set [diffvec + [expr {$cmin - 1.1*$maxdiff}]]
     731        }
     732        diffvec notify now
     733    }
    702734    # force an update of the plot as BLT may not
    703735    $box config -title [$box cget -title]
     
    25232555            -variable graph(yunits) -value 2 \
    25242556            -command {set cycle [getcycle];readdata .g}
     2557    .a.options.menu.yunits add radiobutton -label "log(I)" \
     2558            -variable graph(yunits) -value 3 \
     2559            -command {set cycle [getcycle];readdata .g}
    25252560    .a.options.menu add command -label "HKL labeling" -command setlblopts
    25262561    .a.options.menu add checkbutton -label "Subtract background" \
Note: See TracChangeset for help on using the changeset viewer.