source: trunk/doc/liveplot.html @ 518

Last change on this file since 518 was 518, checked in by toby, 11 years ago

# on 2001/12/19 18:55:42, toby did:
reformat to match NCNR style

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