Changeset 1144 for branches/sandbox


Ignore:
Timestamp:
Jun 2, 2011 9:42:48 PM (9 years ago)
Author:
toby
Message:

More improvements to magnification regions based on Vince's comments; document changes on web page

Location:
branches/sandbox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/doc/liveplot.html

    r971 r1144  
    6161The units used for plotting histograms can be selected. Choices are:
    6262native units (2Theta/TOF/KeV); d-space (A) or Q (A<sup>-1</sup>)
    63 <LI>
     63<LI><IMG SRC="new.gif" alt="New!">
     64Regions of the plot can be magnified to show more detail, for example
     65  in regions at high Q.
     66  <LI>
    6467The background (fixed plus fitted) can be plotted or can be subtracted.
    6568<LI>
     
    7376<LI>
    7477The cumulative chi<sup>2</sup> function or
    75 <IMG SRC="new.gif" alt="New!"> (obs-calc)/sigma can be plotted.
     78 (obs-calc)/sigma can be plotted.
    7679<LI>
    7780The cursor position can be displayed
     
    285288<P>
    286289<a name="zoomshift"></a>
    287 <IMG SRC="new.gif" alt="New!">
    288290To shift the zoom region around,
    289291the right and left arrow keys can be used to shift the
     
    362364
    363365<br clear=all>
     366<P>
     367<a name="magnification"></a>
     368<B>Plot Magnification</B>
     369Sections of the plot can be magnified through use of options in the
     370Magnification menu or by using control-1 through control-9.
     371<img SRC="magreg.png" align=RIGHT alt="LIVEPLOT Screen snapshot">
     372<UL>
     373<LI>The Magnification/Add region menu item requests a location in the
     374  pattern (2Theta/TOF/KeV/d-space/Q) and a multiplier. Data where the
     375  scan variable (2Theta...) is of that value or higher, up to the
     376  next region or end of the pattern are multiplied by that factor. The
     377  factor, must be >0.
     378<LI>Magnification/Edit regions brings up a menu (see below) where the previously
     379 defined regions can be changed. The region boundaries can be moved
     380  and the multiplier values can be changed. If a multiplier is set to
     381  zero (or negative) that region is removed.
     382<LI>Magnification/Clear deletes all previously defined regions
     383<LI>Pressing control plus a positive digit (1,2,3,...9) also adds a
     384  magnification region. The digit determines the magnification
     385  multiplier. Data where the
     386  scan variable (2Theta...) from the mouse position up to the
     387  next region or end of the pattern are multiplied by that factor.
     388<img SRC="editreg.png" align=RIGHT alt="LIVEPLOT menu">
     389</UL>
     390 <br clear=all>
    364391<P>
    365392<a name="export"></a>
     
    408435<DT><a href="#zoomshift">arrow keys</A>
    409436<DD>Moves zoom region around in plot
     437<DT><a href="#mag">Control+1, 2,...</a>
     438<DD>Defines a <a href="#magnification">magnification region</A> at the
     439  cursor location.
    410440</DL>
    411441
     
    650680<P>
    651681<hr><H2>Interfacing External Programs</H2>
    652 <IMG SRC="new.gif" alt="New!">
    653682<B>Combining LIVEPLOT with CMPR & LOGIC</B>
    654683If you have the
  • branches/sandbox/liveplot

    r1143 r1144  
    20962096menu .a.mag.menu
    20972097set maglist {}
     2098set mag0 1.0
     2099# display magnification routines -- not currently in use
    20982100proc ShowMag {} {
    20992101    global blt_version tcl_platform peakinfo expgui
     
    21102112        set lbl ""
    21112113        set xm $::xvec(min)
    2112         set ym 1.0
     2114        set ym $::mag0
    21132115        set ::maglist [lsort -real -index 0 $::maglist]
    21142116        foreach pair $::maglist {
     
    21272129}
    21282130
     2131# edit magnification regions
     2132proc EditMag {} {
     2133    set ::multrow 1
     2134    set bx .opt
     2135    catch {destroy $bx}
     2136    toplevel $bx
     2137    putontop $bx
     2138    wm iconname $bx "Mag Regs"
     2139    wm title $bx "Edit Magnification Regions"
     2140    pack [label $bx.0 -text "Vertical Magnification Regions:"] -side top
     2141    if {[llength $::maglist] == 0} {
     2142        set lbl "None"
     2143        pack [label $bx.1 -text $lbl -justify left] -side top
     2144        pack [button $bx.2 -text "Close" -command "destroy $bx"] -side top
     2145        tkwait window $bx
     2146        afterputontop
     2147        return
     2148    } else {
     2149        pack [frame $bx.1] -side top
     2150        set ::maglist [lsort -real -index 0 $::maglist]
     2151        set row 0
     2152        foreach pair $::maglist {
     2153            foreach {xh ymh} $pair {}
     2154            set row1 [expr {$row + 1}]
     2155            set ::xmag($row1) $xh
     2156            set ::mag($row1) $ymh
     2157            if {$row == 0} {
     2158                grid [label $bx.1.a$row -text "From "] -column 1 -row $row
     2159                grid [label $bx.1.b$row -text $::xvec(min)] -column 2 -row $row
     2160                grid [label $bx.1.c$row -text " to "] -column 3 -row $row
     2161                grid [entry $bx.1.d$row -textvariable xmag(1) -width 6] -column 4 -row $row
     2162                grid [label $bx.1.e$row -text " times "] -column 5 -row $row
     2163                grid [entry $bx.1.f$row -textvariable mag0 -width 4] -column 6 -row $row
     2164            } else {
     2165                grid [label $bx.1.a$row -text "From "] -column 1 -row $row
     2166                grid [entry $bx.1.b$row -textvariable xmag($row) -width 6] -column 2 -row $row
     2167                grid [label $bx.1.c$row -text " to "] -column 3 -row $row
     2168                grid [entry $bx.1.d$row -textvariable xmag($row1) -width 6] -column 4 -row $row
     2169                grid [label $bx.1.e$row -text " times "] -column 5 -row $row
     2170                grid [entry $bx.1.f$row -textvariable mag($row) -width 4] -column 6 -row $row
     2171            }
     2172            incr row
     2173        }
     2174        grid [label $bx.1.a$row -text "From "] -column 1 -row $row
     2175        grid [entry $bx.1.b$row -textvariable xmag($row) -width 6] -column 2 -row $row
     2176        grid [label $bx.1.c$row -text " to "] -column 3 -row $row
     2177        grid [label $bx.1.d$row -text $::xvec(max)] -column 4 -row $row
     2178        grid [label $bx.1.e$row -text " times "] -column 5 -row $row
     2179        grid [entry $bx.1.f$row -textvariable mag($row) -width 4] -column 6 -row $row
     2180        set ::multrow $row
     2181    }
     2182    pack [label $bx.l -text "\nSet the multiplier to zero to delete a region"] -side top
     2183    pack [frame $bx.2] -side top
     2184    pack [button $bx.2.a -text "Edit" -command "destroy $bx"] -side left
     2185    pack [button $bx.2.b -text "Cancel" -command "set multrow 0; destroy $bx"] -side left
     2186    tkwait window $bx
     2187    afterputontop
     2188    if {$::multrow == 0} return
     2189    set newmaglist {}
     2190    set xp $::xvec(min)
     2191    for {set i 1} {$i <= $::multrow} {incr i} {
     2192        if {$::mag($i) > 0} {
     2193            lappend newmaglist [list $::xmag($i) $::mag($i)]
     2194        }
     2195        set xp $::xmag($i)
     2196    }
     2197    set ::maglist $newmaglist
     2198    readdata .g
     2199}
     2200
     2201# show a menu to add a magnification region
    21292202proc AddMag {} {
    21302203    set bx .opt
     
    21592232    }
    21602233}
     2234proc AddCursorMag {p m} {
     2235    set x [.g xaxis invtransform $p]
     2236    if {$x < $::xvec(min) || $x > $::xvec(max) } {
     2237        bell
     2238        return
     2239    }
     2240    lappend ::maglist [list $x $m]
     2241    readdata .g
     2242}
     2243
     2244# scale the data with magnification regions
    21612245proc ApplyMag {} {
    21622246    foreach mrk [.g marker names mag*] {
     
    21672251    vector create ymult([xvec length])
    21682252    set xl $xvec(min)
    2169     set ym 1.0
     2253    set ym $::mag0
    21702254    set i 0
    21712255    set ::maglist [lsort -real -index 0 $::maglist]
     
    21982282if {$program == "liveplot"} {
    21992283    .a.mag.menu add command -label "Add region" -command "AddMag"
    2200     .a.mag.menu add command -label "Show" -command "ShowMag"
     2284    .a.mag.menu add command -label "Edit Regions" -command "EditMag"
    22012285    .a.mag.menu add separator
    22022286    .a.mag.menu add command -label "Clear" \
    22032287        -command "set maglist {}; readdata .g"
    22042288    .a.options.menu add command -label "Obs symbol" -command getsymopts
     2289    foreach i {1 2 3 4 5 6 7 8 9} {
     2290        bind . <Control-Key-$i> "AddCursorMag %x $i"
     2291    }
    22052292} else {
    22062293    .a.options.menu add cascade -label "Symbol Type" -menu .a.options.menu.sym
Note: See TracChangeset for help on using the changeset viewer.