Changeset 406

Dec 4, 2009 5:05:38 PM (11 years ago)

# on 2001/06/29 18:34:32, toby did:
document bkgedit
add cumulative chi2 description (nice idea Bill!)

1 edited


  • trunk/doc/liveplot.html

    • Property rcs:date changed from 2001/05/11 04:15:34 to 2001/06/29 18:34:32
    • Property rcs:rev changed from 1.1 to 1.2
    • Property rcs:lines set to +234 -45
    r386 r406  
    33   <META NAME="Author" CONTENT="Brian H. Toby">
    4    <title>EXPGUI -- LIVEPLOT</title>
     4   <title>EXPGUI -- LIVEPLOT/BKGEDIT</title>
    30 This page documents the LIVEPLOT utility in the EXPGUI package.
    31 <P>
    32 LIVEPLOT gets the current diffraction information by running the TCLDUMP program, if installed, or
     30This page documents the LIVEPLOT and BKGEDIT utility programs
     31in the EXPGUI package.
     32LIVEPLOT and BKGEDIT are actually the same program, but perform
     33different functions, depending on how they are invoked.
     34LIVEPLOT is used to display the quality of the diffraction fit, while
     35BKGEDIT is used to fit a background function to fixed background points
     36that have been input by the user.
     38Both LIVEPLOT and BKGEDIT get the current diffraction information
     39by running the TCLDUMP program, if installed, or
    3340HSTDUMP otherwise. The TCLDUMP program has been optimized for use
    3441with LIVEPLOT and offers a number of extra
    3643included in GSAS since April of 2000, it is assumed that this is now the case.
     45<a name="liveplot"></a>
     47LIVEPLOT is started by pressing the LIVEPLOT button on the toolbar
     48or via the Graphs/liveplot menu item.
    3850Some of the features available in LIVEPLOT are:
    4557native units (2Theta/TOF/KeV); d-space (A) or Q (A<sup>-1</sup>)
    47 The background (fixed plus fitted) can be plotted or can be subracted.
     59The background (fixed plus fitted) can be plotted or can be subtracted.
    4961Reflection tickmarks can be displayed in a variety of formats
    62 <hr><h2>LIVEPLOT Menu Contents</h2>
    63 <DL><DL>
     74<a name="bkgedit"></a>
     76<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
     77For most refinements, it is possible to simply select a background
     78function (I find that the type 1 function,
     79shifted Chebyschev polynomials, work well)
     80and then refine, adding terms until a good fit is obtained.
     81On occasion, poor initial fits are obtained in this manner. This is
     82most common in cases where large numbers of peaks are poorly fit. Since
     83significant sections of the data are not well fit, the refinement results in
     84an unreasonable background function, because this yields better agreement
     85with the observed data.
     86In these cases,
     87it may be best to fix the background to follow a "reasonable" curve in the
     88initial stages and then refine the background in the final stages of
     89refinement, when a good model has been obtained.
     91The BKGEDIT program, as shown below, is used to input a set a background
     92points via the mouse. The points are then used to determine a type 1
     93(Chebyschev) background function that fits the input background points. These
     94terms can then be saved in the experiment file creating a background that
     95is good enough for the initial stages of refinement and that can be
     96refined once the model is adequate for the task.
     98<IMG SRC="b1.gif" align=TEXTOP alt="BKGEDIT screen image">
     99<H4>Steps in fitting a background function</H4>
     100The BKGEDIT program is started from
     101via the Powder/bkgedit menu item or by pressing the
     102"Fit Background Graphically" button on the
     103<A href="http:expgui3.html#EditBackground">"Edit Background"</A>
     104dialog box (invoked from the "Edit Background" button on the
     105<A href="http:expgui3.html">Histogram pane</A>.)
     109<LI><a href="http:#zoom">Zoom in</a> on the lower intensity section of the
     110plot, so that the background is clearly discernible. In some cases, the
     111data will need to be handled in sections.
     112<LI>Press the "Add" button to add background points.
     113Note the cursor changes from cross-hairs to an arrow,
     114when the "Add" button is pressed.
     115<LI>Move the mouse to the first location
     116where a background point will be added and click with the left
     117mouse button. A magenta triangle will appear at the location.
     118Points can be added in any order. It is best to make sure that the fixed points
     119are placed over the entire range of the data, e.g. near the maximum and minimum
     120data points in TOF, 2theta, etc.
     122Note that it is advisable to place many background points in areas where
     123the background varies greatly.
     125As background points are entered, they are saved in a file named
     126<I>EXPNAM</I><tt>.bkg</tt><I>N</I>, where
     127<I>EXPNAM</I> is the experiment name and <I>N</I> is the histogram number.
     128If BKGEDIT is restarted at some later time, these points are reread.
     129<LI>If any points are placed in incorrect positions, they can be deleted by
     130pressing the "Delete" button. The mouse cursor changes to a circle. When
     131the mouse left clicked, the fixed background point closest to the mouse
     132position (which may be outside the zoom range) is deleted.
     133<LI>Background points can also be edited by entering numbers into the
     134"Background points" area.
     135<LI>After enough background points have been entered, the
     136"Start Fit" button turns from gray to black. When pressed, the Chebyschev
     137polynomial is fitted and the resulting curve is shown as a blue dashed line.
     139It is suggested that you start with relatively few
     140terms and add terms and background points as needed.
     141Note that the maximum number of Chebyschev terms increases as
     142more background points are entered.
     144The "Improve Fit" button is black when the fit did not
     145converge or the number of terms has been changed. "Improve Fit" causes the
     146fit to be refined starting from the previous values.
     147<LI>Editing the Chebyschev terms is possible. The curve is reevaluated as
     148changes are made.
     149<LI>Once a good background function is determined, it can be saved in the
     150experiment file by pressing the "Save in EXP file & Exit" button. This will
     151set the background type to 1, and save the Chebyschev terms.
     152It will also turn off
     153the background refinement flag for the appropriate histogram so that the
     154terms are not refined inadvertently.
     158Note that POWPREF must be run at least once before BKGEDIT can be used,
     159however, use of
     160GENLES before BKGEDIT is optional. If the data range is changed, for example
     161by excluding a section of the data at the lower end, or changing tmax (dmin),
     162the Chebyschev polynomial terms must change to generate the same
     163background values, so both POWPREF and BKGEDIT should be rerun to
     164regenerate the Chebyschev terms.
     166<H4>Why not use fixed background points?</H4>
     167I personally feel that
     168a refined background function is preferrable to use of a fixed model,
     169if at all possible.
     170One reason for this is that Rietveld refinements usually achieve better fits
     171when the background is optimized. A second reason refining the background
     172provides a
     173feel for the interaction between background values and displacement
     174(thermal) parameters.
     175Usually, background and displacement parameters are fairly independent, but
     176for some materials, where the high Q (high 2theta) portion of the pattern
     177has many completely overlapped peaks, it is impossible to uniquely
     178determine where the
     179background should be placed, either by refinement or by manual placement.
     180Under these circumstances, the background should be refined with the
     181displacement parameters fixed at an appropriate value for the material. The
     182background should then be fixed for all future refinements
     183and the displacement parameters can then be refined. <I>Of course this
     184means you have predjudiced the refinement to result in the expected
     185average displacement parameter and this </I><B>must</B><I> be noted
     186any publication. However, if this is necessary, the data simply do not
     187contain sufficient information to independently determine
     188background and displacement parameters. Use of fixed background points
     189would not demonstrate this and would lead the researcher to a false
     190sense of security (or fear, if the values are unreasonable)
     191that the displacement parameters actually mean something.</I>
     193If you still want to use fixed background points, despite this tirade,
     194be sure to set the estimated
     195error on those points to be 0.0. Use of non-zero estimated errors, can
     196result in artificially lowered R-factors and chi-squared values.
     197In one test, I was able to lower the R<sub>wp</sub> and
     198reduced chi<sup>2</sup> values,
     199from the correct values of 0.042 and 3.0, respectively, to misleading
     200values of 0.036 and 0.8,
     201respectively. [As expected, the R(F<sup>2</sup>) stayed constant at 0.045;
     202FYI, refining the background caused R(F<sup>2</sup>) to drop to 0.036.]
     204If the background is so truly irregular that only use of fixed background
     205points will do,
     206BKGEDIT can be used to generate these fixed background points.
     207The file used by BKGEDIT to save these points,
     209can be read into EXPEDT by typing "@R" at the initial prompt
     210in EXPEDT:
     212   Is this the file you wish to use? (<?>,D,K,Q,R,Y) ><u>@r</u>
     214prompt and then supplying the name of the file, in response to the next prompt:
     216   Enter the name of your macro file: <u>GARNET.bkg1</u>
     218And this will enter the background points entered into BKGEDIT as GSAS
     219fixed background points. If you do this you do not want to fit and enter
     220Note that you are allowed to use both fixed and a refined background together,
     221though this is seldom done.
     223<hr><h2>LIVEPLOT/BKGEDIT Features</h2>
     224<a name="zoom"></a>
     225<B>Plot zooming</B>
     226When the left (usual) mouse button is pressed, this defines one corner
     227of a region to be magnified, as is shown to the right.
     228If the mouse is then moved, the diagonal
     229corner of this magnification region is defined. When the left mouse button
     230is pressed a second time, the selected section of the plot is magnified to
     231fill the entire plot.
     233Zoom settings are saved.
     234If the right mouse button is pressed, the previous zoom setting is used,
     235so that the left mouse button is used to "zoom in" and the right mouse
     236button is used to "zoom out."
     239<h2>Features in LIVEPLOT only</h2>
     240<img SRC="lz.gif" BORDER=3 align=RIGHT alt="EXPGUI Screen snapshot">
     241<B>The cumulative chi<sup>2</sup></B>
     242function was first suggested by
     243Bill David as a way to see which reflections have the greatest influence on
     244chi<sup>2</sup> [W.I.F. David, <I>Accuracy in Powder Diffraction-III</I>, 2001].
     245It is defined for point j as
     246<IMG SRC="cchi2.gif" alt="equation for cumulative chi2 function" ALIGN=TOP>
     247where y<sub>obs,i</sub> and y<sub>calc,i</sub> are the observed and computed
     248data points and sigma<sub>i</sub> is the expected error. Thus, the statistically
     249expected value for
     250[(y<sub>obs,i</sub>-y<sub>calc,i</sub>)/sigma<sub>i</sub>]<sup>2</sup> is 1
     251and this function should rise in a smooth line if all points are fitted as
     252statistically expected.
     254In the plot to the right, the cumulative chi<sup>2</sup> function is shown in
     255purple. Note that first peak is not well fit, but the low angle "shoulder" is
     256as important as the peak misfitting, with respect to the chi<sup>2</sup>.
     257<br clear=all>
     259<img SRC="lind.gif" BORDER=3 align=RIGHT alt="EXPGUI Screen snapshot">
     260<B>Reflection indices</B>
     261are be displayed by pressing "H" or "h" while the
     262mouse is near a reflection (holding the shift key while
     263pressing the left mouse button also works). The indices are shown
     264on the screen for phases with tick marks (as shown to the right).
     265Indices are listed in the "Separate window for <I>hkl</I> labels"
     266(as seen below) for all phases, regardless of the tickmark settings.
     267Displayed indices will remain on the screen for a preset time and
     268then will be deleted, unless the labeling options are changed.
     269<img SRC="lind1.gif" align=LEFT alt="EXPGUI Screen snapshot">
     271<br clear=all>
     273<hr><h2>LIVEPLOT/BKGEDIT Menu Contents</h2>
     274A few of these options are omitted from BKGEDIT.
     276<img SRC="lm1.gif" align=RIGHT alt="EXPGUI Screen snapshot">
    64277<H3>File Menu</H3>
    79 <DL><DL>
     292<br clear=all>
     294<img SRC="lm2.gif" align=RIGHT alt="EXPGUI Screen snapshot">
    80295<H3>File Menu</H3>
    81296<DT>Configure Tickmarks
    119334<DD>Causes many of the options set in this menu to be saved in the <TT>.gsas_config</TT> file.
    122 <P>
    123 <hr><h2>LIVEPLOT Features</h2>
    124 <B>Plot zooming</B>
    125 When the left (usual) mouse button is pressed, this defines one corner
    126 of a region to be magnified. If the mouse is then moved, the diagonal
    127 corner of this magnification region is defined. When the left mouse button
    128 is pressed a second time, the selected section of the plot is magnified to
    129 fill the entire plot.
    130 <P>
    131 Zoom settings are saved.
    132 If the right mouse button is pressed, the previous zoom setting is used,
    133 so that the left mouse button is used to "zoom in" and the right mouse
    134 button is used to "zoom out."
    136 <P>
    137 <B>Reflection indices</B>
    138 are be displayed by pressing "H" or "h" while the
    139 mouse is near a reflection (holding the shift key while
    140 pressing the left mouse button also works).
    141 <P>
    142 <B>The cumulative chi<sup>2</sup></B>
    143 function was first suggested by
    144 Bill (W.I.F.) David [Accuracy in Powder Diffraction-III, 2001]
    145 as a way to see which reflections have the greatest influence on
    146 chi<sup>2</sup>. It is defined for point j as
    147 <IMG SRC="cchi2.gif" alt="equation for cumulative chi2 function" ALIGN=TOP>.
    150 <hr><H2>Customization of LIVEPLOT</H2><A NAME="customize"></A>
     336<br clear=all>
     339<hr><H2>Customization of LIVEPLOT & BKGEDIT</H2><A NAME="customize"></A>
    151340The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present.
     341The following variables control how LIVEPLOT, and in most cases BKGEDIT,
     342function and can be
     343customized by changing their values in the
     344<TT>localconfig</TT> and <TT>.gsas_config</TT> files.
    152345Note that some of these options are relevant only if the tcldump program is
    153 present.
    154 <P>
    155 The following variables control how LIVEPLOT functions and can be
    156 customized by changing their values in the
    157 <TT>localconfig</TT> and <TT>.gsas_config</TT> files:
    198 Sets the default value for display of the legend in liveplot and widplt.
     387Sets the default value for display of the legend in LIVEPLOT and widplt.
    201390This option shows up in the options menu item as "Raise on update."
    202 When set to non-zero, the liveplot window is raised
     391When set to non-zero, the LIVEPLOT window is raised
    203392(placed on top of any other overlapping) windows
    204393each time it is updated.
    257446(see the CMPR installation instructions.)</A>
    259 For UNIX, create a link from in the expgui
     448For UNIX, create a link from in the EXPGUI
    260449directory to file cellgen.tcl in the CMPR directory. For example:
    264453<LI>For Windows, copy all the .tcl and .exe files from the CMPR directory
    265 into the expgui directory.
     454into the EXPGUI directory.
    282471   ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/expgui/icddcmd.tcl
    284 <LI>For Windows, copy all the LOGIC files into the expgui directory.
     473<LI>For Windows, copy all the LOGIC files into the EXPGUI directory.
Note: See TracChangeset for help on using the changeset viewer.