source: trunk/doc/liveplot.html @ 439

Last change on this file since 439 was 439, checked in by toby, 14 years ago

# on 2001/09/25 23:16:11, toby did:
better integrate into progression of pages

  • Property rcs:author set to toby
  • Property rcs:date set to 2001/09/25 23:16:11
  • Property rcs:lines set to +8 -3
  • Property rcs:rev set to 1.4
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 21.2 KB
3   <META NAME="Author" CONTENT="Brian H. Toby">
4   <title>EXPGUI -- LIVEPLOT/BKGEDIT</title>
8<A HREF=>
9<IMG SRC="" 
10alt="Link to NIST Center for Neutron Research home page"
12<A HREF="">
13<IMG SRC="" 
14alt="Link to National Institute of Standards & Technology home page"
17<A Href="">
18<IMG SRC="tcltklogo100.gif" 
19alt="Link to Tcl/Tk information">
21<br clear=all><hr>
24<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
25</TH><TH><A Href="excledt.html">Next page (EXCLEDT)</A>
26</TH><TH><A Href="expguic.html">Previous page</A>
31EXPGUI Utilities (1), LIVEPLOT and BKGEDIT
33This page documents the LIVEPLOT and BKGEDIT utility programs
34in the EXPGUI package.
35LIVEPLOT and BKGEDIT are actually the same program, but perform
36different functions, depending on how they are invoked.
37LIVEPLOT is used to display the quality of the diffraction fit, while
38BKGEDIT is used to fit a background function to fixed background points
39that have been input by the user.
41Both LIVEPLOT and BKGEDIT get the current diffraction information
42by running the TCLDUMP program, if installed, or
43HSTDUMP otherwise. The TCLDUMP program has been optimized for use
44with LIVEPLOT and offers a number of extra
45options that are not available when HSTDUMP is used. Since TCLDUMP has been
46included in GSAS since April of 2000, it is assumed that this is now the case.
48<a name="liveplot"></a>
50LIVEPLOT is started by pressing the LIVEPLOT button on the toolbar
51or via the Graphs/liveplot menu item.
53Some of the features available in LIVEPLOT are:
55<LI>The plot is updated automatically after each refinement run
56<LI>The plot can be zoomed, by clicking on the corners of the
57area to be magnified.
59The units used for plotting histograms can be selected. Choices are:
60native units (2Theta/TOF/KeV); d-space (A) or Q (A<sup>-1</sup>)
62The background (fixed plus fitted) can be plotted or can be subtracted.
64Reflection tickmarks can be displayed in a variety of formats
66LIVEPLOT can be coupled to the LOGIC or CMPR programs, so that
67peak positions from an ICDD entry or for an arbitrary unit cell and
68spacegroup can be shown superimposed on the "Rietveld plot."
70<IMG SRC="note.gif" alt="Note!">
71Reflection indices (<I>hkl</I> values) can be shown for tickmarks
73<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
74The cumulative chi<sup>2</sup> function can be plotted.
77<a name="bkgedit"></a>
79<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
80For most refinements, it is possible to simply select a background
81function (I find that the type 1 function,
82shifted Chebyschev polynomials, work well)
83and then refine, adding terms until a good fit is obtained.
84On occasion, poor initial fits are obtained in this manner. This is
85most common in cases where large numbers of peaks are poorly fit. Since
86significant sections of the data are not well fit, the refinement results in
87an unreasonable background function, because this yields better agreement
88with the observed data.
89In these cases,
90it may be best to fix the background to follow a "reasonable" curve in the
91initial stages and then refine the background in the final stages of
92refinement, when a good model has been obtained.
94The BKGEDIT program, as shown below, is used to input a set a background
95points via the mouse. The points are then used to determine a type 1
96(Chebyschev) background function that fits the input background points. These
97terms can then be saved in the experiment file creating a background that
98is good enough for the initial stages of refinement and that can be
99refined once the model is adequate for the task.
101<IMG SRC="b1.gif" align=TEXTOP alt="BKGEDIT screen image">
102<H4>Steps in fitting a background function</H4>
103The BKGEDIT program is started from
104via the Powder/bkgedit menu item or by pressing the
105"Fit Background Graphically" button on the
106<A href="expgui3.html#EditBackground">"Edit Background"</A>
107dialog box (invoked from the "Edit Background" button on the
108<A href="expgui3.html">Histogram pane</A>.)
112<LI><a href="#zoom">Zoom in</a> on the lower intensity section of the
113plot, so that the background is clearly discernible. In some cases, the
114data will need to be handled in sections.
115<LI>Press the "Add" button to add background points.
116Note the cursor changes from cross-hairs to an arrow,
117when the "Add" button is pressed.
118<LI>Move the mouse to the first location
119where a background point will be added and click with the left
120mouse button. A magenta triangle will appear at the location.
121Points can be added in any order. It is best to make sure that the fixed points
122are placed over the entire range of the data, e.g. near the maximum and minimum
123data points in TOF, 2theta, etc.
125Note that it is advisable to place many background points in areas where
126the background varies greatly.
128As background points are entered, they are saved in a file named
129<I>EXPNAM</I><tt>.bkg</tt><I>N</I>, where
130<I>EXPNAM</I> is the experiment name and <I>N</I> is the histogram number.
131If BKGEDIT is restarted at some later time, these points are reread.
132<LI>If any points are placed in incorrect positions, they can be deleted by
133pressing the "Delete" button. The mouse cursor changes to a circle. When
134the mouse left clicked, the fixed background point closest to the mouse
135position (which may be outside the zoom range) is deleted.
136<LI>Background points can also be edited by entering numbers into the
137"Background points" area.
138<LI>After enough background points have been entered, the
139"Start Fit" button turns from gray to black. When pressed, the Chebyschev
140polynomial is fitted and the resulting curve is shown as a blue dashed line.
142It is suggested that you start with relatively few
143terms and add terms and background points as needed.
144Note that the maximum number of Chebyschev terms increases as
145more background points are entered.
147The "Improve Fit" button is black when the fit did not
148converge or the number of terms has been changed. "Improve Fit" causes the
149fit to be refined starting from the previous values.
150<LI>Editing the Chebyschev terms is possible. The curve is reevaluated as
151changes are made.
152<LI>Once a good background function is determined, it can be saved in the
153experiment file by pressing the "Save in EXP file & Exit" button. This will
154set the background type to 1, and save the Chebyschev terms.
155It will also turn off
156the background refinement flag for the appropriate histogram so that the
157terms are not refined inadvertently.
161Note that POWPREF must be run at least once before BKGEDIT can be used,
162however, use of
163GENLES before BKGEDIT is optional. If the data range is changed, for example
164by excluding a section of the data at the lower end, or changing tmax (dmin),
165the Chebyschev polynomial terms must change to generate the same
166background values, so both POWPREF and BKGEDIT should be rerun to
167regenerate the Chebyschev terms.
169<H4>Why not use fixed background points?</H4>
170I personally feel that
171a refined background function is preferrable to use of a fixed model,
172if at all possible.
173One reason for this is that Rietveld refinements usually achieve better fits
174when the background is optimized. A second reason refining the background
175provides a
176feel for the interaction between background values and displacement
177(thermal) parameters.
178Usually, background and displacement parameters are fairly independent, but
179for some materials, where the high Q (high 2theta) portion of the pattern
180has many completely overlapped peaks, it is impossible to uniquely
181determine where the
182background should be placed, either by refinement or by manual placement.
183Under these circumstances, the background should be refined with the
184displacement parameters fixed at an appropriate value for the material. The
185background should then be fixed for all future refinements
186and the displacement parameters can then be refined. <I>Of course this
187means you have predjudiced the refinement to result in the expected
188average displacement parameter and this </I><B>must</B><I> be noted
189any publication. However, if this is necessary, the data simply do not
190contain sufficient information to independently determine
191background and displacement parameters. Use of fixed background points
192would not demonstrate this and would lead the researcher to a false
193sense of security (or fear, if the values are unreasonable)
194that the displacement parameters actually mean something.</I>
196If you still want to use fixed background points, despite this tirade,
197be sure to set the estimated
198error on those points to be 0.0. Use of non-zero estimated errors, can
199result in artificially lowered R-factors and chi-squared values.
200In one test, I was able to lower the R<sub>wp</sub> and
201reduced chi<sup>2</sup> values,
202from the correct values of 0.042 and 3.0, respectively, to misleading
203values of 0.036 and 0.8,
204respectively. [As expected, the R(F<sup>2</sup>) stayed constant at 0.045;
205FYI, refining the background caused R(F<sup>2</sup>) to drop to 0.036.]
207If the background is so truly irregular that only use of fixed background
208points will do,
209BKGEDIT can be used to generate these fixed background points.
210The file used by BKGEDIT to save these points,
212can be read into EXPEDT by typing "@R" at the initial prompt
213in EXPEDT:
215   Is this the file you wish to use? (<?>,D,K,Q,R,Y) ><u>@r</u>
217prompt and then supplying the name of the file, in response to the next prompt:
219   Enter the name of your macro file: <u>GARNET.bkg1</u>
221And this will enter the background points entered into BKGEDIT as GSAS
222fixed background points. If you do this you do not want to fit and enter
223Note that you are allowed to use both fixed and a refined background together,
224though this is seldom done.
226<hr><h2>LIVEPLOT/BKGEDIT Features</h2>
227<a name="zoom"></a>
228<B>Plot zooming</B>
229When the left (usual) mouse button is pressed, this defines one corner
230of a region to be magnified, as is shown to the right.
231If the mouse is then moved, the diagonal
232corner of this magnification region is defined. When the left mouse button
233is pressed a second time, the selected section of the plot is magnified to
234fill the entire plot.
236Zoom settings are saved.
237If the right mouse button is pressed, the previous zoom setting is used,
238so that the left mouse button is used to "zoom in" and the right mouse
239button is used to "zoom out."
242<h2>Features in LIVEPLOT only</h2>
243<img SRC="lz.gif" BORDER=3 align=RIGHT alt="EXPGUI Screen snapshot">
244<B>The cumulative chi<sup>2</sup></B>
245function was first suggested by
246Bill David as a way to see which reflections have the greatest influence on
247chi<sup>2</sup> [W.I.F. David, <I>Accuracy in Powder Diffraction-III</I>, 2001].
248It is defined for point j as
249<IMG SRC="cchi2.gif" alt="equation for cumulative chi2 function" ALIGN=TOP>
250where y<sub>obs,i</sub> and y<sub>calc,i</sub> are the observed and computed
251data points and sigma<sub>i</sub> is the expected error. Thus, the statistically
252expected value for
253[(y<sub>obs,i</sub>-y<sub>calc,i</sub>)/sigma<sub>i</sub>]<sup>2</sup> is 1
254and this function should rise in a smooth line if all points are fitted as
255statistically expected.
257In the plot to the right, the cumulative chi<sup>2</sup> function is shown in
258purple. Note that first peak is not well fit, but the low angle "shoulder" is
259as important as the peak misfitting, with respect to the chi<sup>2</sup>.
260<br clear=all>
262<img SRC="lind.gif" BORDER=3 align=RIGHT alt="EXPGUI Screen snapshot">
263<B>Reflection indices</B>
264are be displayed by pressing "H" or "h" while the
265mouse is near a reflection (holding the shift key while
266pressing the left mouse button also works). The indices are shown
267on the screen for phases with tickmarks (as shown to the right).
268Indices are listed in the "Separate window for <I>hkl</I> labels"
269(as seen below) for all phases, regardless of the tickmark settings.
270Displayed indices will remain on the screen for a preset time and
271then will be deleted, unless the labeling options are changed.
272<img SRC="lind1.gif" align=LEFT alt="EXPGUI Screen snapshot">
274<br clear=all>
276<hr><h2>LIVEPLOT/BKGEDIT Menu Contents</h2>
277A few of these options are omitted from BKGEDIT.
279<img SRC="lm1.gif" align=RIGHT alt="EXPGUI Screen snapshot">
280<H3>File Menu</H3>
282<DD>Checkbuttons are provided for each phase to determine if tick marks
283are shown. See the Options/"Configure Tickmarks"menu item for information
284on tickmarks
286<DD>This allows a histogram to be selected to be loaded
287<DT>Update Plot
288<DD>The causes LIVEPLOT to read read the current histogram again from
289the datafile
290<DT>Make PostScript
291<DD>Creates a low quality PostScript file containing the LIVEPLOT
292output. See the Options/"Set PS output" button for where the file is created.
296<br clear=all>
297<img SRC="lm2.gif" align=RIGHT alt="EXPGUI Screen snapshot">
298<H3>Options Menu</H3>
300<DT>Configure Tickmarks
301<DD>Tickmarks can be placed automatically, similar to their
302 placement in POWPLOT or can be drawn one height to another. The default
303is for lines to be draw from "-Inf" to "Inf", which creates lines from the
304bottom to the top of the plot. The options for each phase allow the line to be changed between solid and dashed, color of the line can be specified and
305the vertical placement of the tickmarks can be specified. The "show" flag,
306set in the File/Tickmarks menu can also be changed here.
307<DT>Obs Symbol (Symbol Type)
308<DD>This brings up a menu where the symbol type and size for the
309observed data points (and for BKGEDIT, the fixed background points)
310can be selected.
311<DT>Symbol Color
312<DD>The colors for all the displayed lines and symbols can be changed here.
313<DT>X units
314<DD>The x units can be selected here. The choices are
315"as collected" (2Theta/TOF/KeV), d-space (A) or Q (A<sup>-1</sup>)
316<DT>Y units
317<DD>The intensity values can be normalized by the incident spectrum
318(for energy dispersive methods).
319<DT>HKL labeling
320<DD>This brings up a menu that selects how long <I>hkl</I> values are shown
321before they are erased (0 means that they are not erased), the size of the
322labels and the width around the mouse that is searched for matching
323reflections. If requested using the "Separate window for <I>hkl</I> labels"
324option, labels are also show in a separate window.
325<DT>Subtract background
326<DD>The background is always shown, even when subtracted
327<DT>Include legend
328<DD>The legend is the optional box in the upper left that defines the
329plot entries
330<DT>Set PS output
331<DD>For UNIX this allows the file to be sent directly to a printer
332or can be saved in a file. For Windows, a file must be written.
333<DT>Set screen font
334<DD>This option is used to control the font used for menus, graphics and
335other aspects of windows.
336<DT>Raise on update
337<DD>This causes the plot to be placed on top of other windows, if partially
338obscured, when the plot is updated. At this time, this option does not
339work in Windows-NT and -2000.
340<DT>Cumulative Chi2
341<DD>The causes the Cumulative chi<sup>2</sup> function to be defined
342(see below).
343<DT>Save Options
344<DD>Causes many of the options set in this menu to be saved in the <TT>.gsas_config</TT> file.
346<br clear=all>
349<hr><H2>Customization of LIVEPLOT & BKGEDIT</H2><A NAME="customize"></A>
350The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present.
351The following variables control how LIVEPLOT, and in most cases BKGEDIT,
352function and can be
353customized by changing their values in the
354<TT>localconfig</TT> and <TT>.gsas_config</TT> files.
355Note that some of these options are relevant only if the tcldump program is
359These variables define if peak positions will be shown
360for reflections in phase "<i>n</i>". Reflections will be shown if
361the value is non-zero.
364These variables define the default colors for
365reflections in phase "<i>n</i>"
368These variables define if peaks will be dashed for
369reflections in phase "<i>n</i>" (UNIX only). Lines will be dashed if
370the value is non-zero.
372<DT><TT>peakinfo(min<i>n</i>) and peakinfo(max<i>n</i>)</TT><DD>
373These variables dictate the placement vertical position for reflection
374markers, when manually placed (see expgui(autotick), below). To draw
375to the edge of the screen, use -Inf and Inf.
378The following variables are written to <tt>.gsas_config</tt> when
379"Save Options" is used. These variables are all set from the GUI and therefore
380do not need to be edited manually.
384This is set to 1 if PostScript files
385will be printed and 0 if they will be written to disk (for Windows all
386files should be written to disk).
389This is the default for the file name used
390when PostScript files will be written to disk.
393This is the default for the command used
394to print PostScript files (Unix only).
397Sets the default value for display of the legend in LIVEPLOT and WIDPLT.
400This option shows up in the options menu item as "Raise on update."
401When set to non-zero, the LIVEPLOT window is raised
402(placed on top of any other overlapping) windows
403each time it is updated.
404This option does not seem to work in Windows-NT, but this may depend on
405the version of Tcl/Tk.
408Symbol for observed data points. Valid choices are square, circle, diamond,
409plus, cross, splus and scross.
412Size for the symbol for observed data points. A value of 1 corresponds to about 1/8 inch
413(about 3 mm).
416When hkl values are loaded (using tcldump) and reflections are labeled, reflections
417can be labeled using a Shift-Left-Mouse click. All labeled reflections within expgui(pixelregion)
418pixels of the mouse position are assumed to be overlapped and are labeled.
421The time in seconds before reflection labels are removed. A value of zero means that reflections
422must be deleted manually (Shift-Right-Mouse).
425A size for reflections labels in pixels.
428If this variable is non-zero, reflection indices are shown in a box.
431If this variable is non-zero, reflection markers positions are
432set automatically.
435<hr><H2>Installation details/External Programs</H2>
436<B>Using TCLDUMP with LIVEPLOT.</B>
437LIVEPLOT works with the standard GSAS program HSTDMP, but it works faster and is more
438powerful when used with the TCLDUMP program.
439Note that as of the April 2000 releases, GSAS is now distributed with TCLDUMP
440included. For older versions of GSAS, note the
441instructions for downloading this file can in the installation notes for
442<A HREF="expgui_Win_readme.html">
443Windows</A> and
444<A HREF="expgui_Unix_readme.html">
448<B>Combining CMPR and LIVEPLOT.</B>
449If you have <A HREF="">CMPR</A>
450installed on your computer, you can use superimpose on the GSAS results
451the peaks for an arbitrary unit cell. If desired, space group extinctions
452can even be shown.
453This is pretty neat! To enable this feature, you must have a version
454of CMPR downloaded after 4 May 1998
455<A HREF="">
456(see the CMPR installation instructions.)</A>
458For UNIX, create a link from in the EXPGUI
459directory to file cellgen.tcl in the CMPR directory. For example:
461   ln -s /usr/local/cmpr/cellgen.tcl /usr/local/gsas/expgui/cellgen.tcl
463<LI>For Windows, copy all the .tcl and .exe files from the CMPR directory
464into the EXPGUI directory.
468<B>Combining LOGIC and LIVEPLOT.</B>
469If you have <A HREF="">LOGIC</A>
470installed on your computer, you can superimpose peaks
471for a entry from the ICDD/JCPDS database on a pattern in LIVEPLOT.
472This is also pretty neat!
473To enable this feature, you must have
474a version of LOGIC downloaded after 4 May 1998
475<A HREF="">
476(see the LOGIC installation instructions.)</A>
478For UNIX, create a link from in the GSAS GUI
479directory to file icddcmd.tcl in the LOGIC directory. For example:
481   ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/expgui/icddcmd.tcl
483<LI>For Windows, copy all the LOGIC files into the EXPGUI directory.
487<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
488</TH><TH><A Href="excledt.html">Next page (EXCLEDT)</A>
489</TH><TH><A Href="expguic.html">Previous page</A>
492<a href="">Brian Toby</a> (<a href="">Brian.Toby@NIST.GOV</a>)
494$Revision: 439 $ $Date: 2009-12-04 23:06:11 +0000 (Fri, 04 Dec 2009) $
Note: See TracBrowser for help on using the repository browser.