source: trunk/doc/liveplot.html @ 493

Last change on this file since 493 was 482, checked in by toby, 12 years ago

# on 2001/10/31 20:13:17, toby did:
new shortcuts: next histogram and manual zoom

  • Property rcs:author set to toby
  • Property rcs:date set to 2001/10/31 20:13:17
  • Property rcs:lines set to +20 -2
  • Property rcs:rev set to 1.6
  • 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>
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."
241<img SRC="mzoom.gif" align=RIGHT alt="LIVEPLOT manual zoom">
242<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
243Zoom settings can also be entered manually by pressing the "Z" key. This
244opens a dialog, as is shown to the right, where the x- or y-axis range
245can be specified. Any value that is not specified is set to the maximum
246or minimum for the entire dataset. It is possible to zoom further in using
247the mouse, but to zoom out beyond the manual zoom limits, the "reset" button
248on the manual zoom menu must be used.
250<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
251If more than one histogram is available to plot, it is possible to cycle
252between the histograms by pressing the "n" or "N" (for next) key.
254<br clear=all>
255<h2>Features in LIVEPLOT only</h2>
256<img SRC="lz.gif" BORDER=3 align=RIGHT alt="LIVEPLOT Screen snapshot">
257<a name="Cchi2"></a>
258<B>The cumulative chi<sup>2</sup></B>
259function was first suggested by
260Bill David as a way to see which reflections have the greatest influence on
261chi<sup>2</sup> [W.I.F. David, <I>Accuracy in Powder Diffraction-III</I>, 2001].
262It is defined for point j as
263<IMG SRC="cchi2.gif" alt="equation for cumulative chi2 function" ALIGN=TOP>
264where y<sub>obs,i</sub> and y<sub>calc,i</sub> are the observed and computed
265data points and sigma<sub>i</sub> is the expected error. Thus, the statistically
266expected value for
267[(y<sub>obs,i</sub>-y<sub>calc,i</sub>)/sigma<sub>i</sub>]<sup>2</sup> is 1
268and this function should rise in a smooth line if all points are fitted as
269statistically expected.
271In the plot to the right, the cumulative chi<sup>2</sup> function is shown in
272purple. Note that first peak is not well fit, but the low angle "shoulder" is
273as important as the peak misfitting, with respect to the chi<sup>2</sup>.
274<br clear=all>
276<img SRC="lind.gif" BORDER=3 align=RIGHT alt="LIVEPLOT Screen snapshot">
277<B>Reflection indices</B>
278are be displayed by pressing "H" or "h" while the
279mouse is near a reflection (holding the shift key while
280pressing the left mouse button also works, but sometimes interferes with the
281zoom feature).
282Pressing "A" or "a" shows all reflections in the displayed region.
283The indices are shown
284on the screen for phases with tickmarks (as shown to the right).
285Indices are listed in the "Separate window for <I>hkl</I> labels"
286(as seen below) for all phases, regardless of the tickmark settings.
287Displayed indices will remain on the screen for a preset time and
288then will be deleted; alternately, pressing "D" or "d" deletes the hkl labels.
289Several aspects of reflection labeling can be customized,
290see the <a href="#hklOpts">HKL labeling options</a> for further information.
292<img SRC="lind1.gif" align=LEFT alt="LIVEPLOT Screen snapshot">
294<br clear=all>
296<hr><h2>LIVEPLOT/BKGEDIT Menu Contents</h2>
297A few of these options are omitted from BKGEDIT.
298<img SRC="lm1.gif" align=RIGHT alt="LIVEPLOT Menu">
299<H3>File Menu</H3>
302<DD>Checkbuttons are provided for each phase to determine if tick marks
303are shown. See the Options/"Configure Tickmarks"menu item for information
304on tickmarks
306<DD>This allows a histogram to be selected to be loaded
308<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
309It is also possible to advance
310between the histograms by pressing the "n" or "N" (for next) key.
312<DT>Update Plot
313<DD>The causes LIVEPLOT to read read the current histogram again from
314the datafile
315<DT>Make PostScript
316<DD>Creates a low quality PostScript file containing the LIVEPLOT
317output. See the Options/"Set PS output" button for where the file is created.
321<br clear=all>
322<img SRC="lm2.gif" align=RIGHT alt="LIVEPLOT Menu">
323<H3>Options Menu</H3>
325<DT>Configure Tickmarks
326<DD>Tickmarks can be placed automatically, similar to their
327 placement in POWPLOT or can be drawn one height to another. The default
328is for lines to be draw from "-Inf" to "Inf", which creates lines from the
329bottom 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
330the vertical placement of the tickmarks can be specified. The "show" flag,
331set in the File/Tickmarks menu can also be changed here.
332<DT>Obs Symbol (Symbol Type)
333<DD>This brings up a menu where the symbol type and size for the
334observed data points (and for BKGEDIT, the fixed background points)
335can be selected.
336<DT>Symbol Color
337<DD>The colors for all the displayed lines and symbols can be changed here.
338<DT>X units
339<DD>The x units can be selected here. The choices are
340"as collected" (2Theta/TOF/KeV), d-space (A) or Q (A<sup>-1</sup>)
341<DT>Y units
342<DD>The intensity values can be normalized by the incident spectrum
343(for energy dispersive methods).
345<br clear=all>
346<img SRC="lm3.gif" align=RIGHT alt="LIVEPLOT menu">
347<a name="hklOpts"></a>
349<DT>HKL labeling
350<DD>This brings up a menu that selects
351<UL><LI>Erase time:
352how long in seconds that <I>hkl</I> values are shown
353before they are erased (0 means that they are not erased),
354<LI>Label size: the size of the
355labels in pixels,
356<LI>Search Region: only reflections within this number of pixels of the mouse,
357when the "h" key is pressed (if any) are labeled,
358<LI>Separate window: when this
359option is selected, reflection labels are shown in a text window
361<DT>Subtract background
362<DD>The background is always shown, even when subtracted
363<DT>Include legend
364<DD>The legend is the optional box in the upper left that defines the
365plot entries
366<DT>Set PS output
367<DD>For UNIX this allows the file to be sent directly to a printer
368or can be saved in a file. For Windows, a file must be written.
369<DT>Set screen font
370<DD>This option is used to control the font used for menus, graphics and
371other aspects of windows.
372<DT>Raise on update
373<DD>This causes the plot to be placed on top of other windows, if partially
374obscured, when the plot is updated. At this time, this option does not
375work in Windows-NT and -2000.
376<DT>Cumulative Chi2
377<DD>The causes the Cumulative chi<sup>2</sup> function to be displayed
378(as <a href="#Cchi2">presented above</a>).
379<DT>Save Options
380<DD>Causes many of the options set in this menu to be saved in the <TT>.gsas_config</TT> file.
382<br clear=all>
385<hr><H2>Customization of LIVEPLOT & BKGEDIT</H2><A NAME="customize"></A>
386The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present.
387The following variables control how LIVEPLOT, and in most cases BKGEDIT,
388function and can be
389customized by changing their values in the
390<TT>localconfig</TT> and <TT>.gsas_config</TT> files.
391Note that some of these options are relevant only if the tcldump program is
395These variables define if peak positions will be shown
396for reflections in phase "<i>n</i>". Reflections will be shown if
397the value is non-zero.
400These variables define the default colors for
401reflections in phase "<i>n</i>"
404These variables define if peaks will be dashed for
405reflections in phase "<i>n</i>" (UNIX only). Lines will be dashed if
406the value is non-zero.
408<DT><TT>peakinfo(min<i>n</i>) and peakinfo(max<i>n</i>)</TT><DD>
409These variables dictate the placement vertical position for reflection
410markers, when manually placed (see expgui(autotick), below). To draw
411to the edge of the screen, use -Inf and Inf.
414The following variables are written to <tt>.gsas_config</tt> when
415"Save Options" is used. These variables are all set from the GUI and therefore
416do not need to be edited manually.
420This is set to 1 if PostScript files
421will be printed and 0 if they will be written to disk (for Windows all
422files should be written to disk).
425This is the default for the file name used
426when PostScript files will be written to disk.
429This is the default for the command used
430to print PostScript files (Unix only).
433Sets the default value for display of the legend in LIVEPLOT and WIDPLT.
436This option shows up in the options menu item as "Raise on update."
437When set to non-zero, the LIVEPLOT window is raised
438(placed on top of any other overlapping) windows
439each time it is updated.
440This option does not seem to work in Windows-NT, but this may depend on
441the version of Tcl/Tk.
444Symbol for observed data points. Valid choices are square, circle, diamond,
445plus, cross, splus and scross.
448Size for the symbol for observed data points. A value of 1 corresponds to about 1/8 inch
449(about 3 mm).
452When hkl values are loaded (using tcldump) and reflections are labeled, reflections
453can be labeled using a Shift-Left-Mouse click. All labeled reflections within expgui(pixelregion)
454pixels of the mouse position are assumed to be overlapped and are labeled.
457The time in seconds before reflection labels are removed. A value of zero means that reflections
458must be deleted manually (Shift-Right-Mouse).
461A size for reflections labels in pixels.
464If this variable is non-zero, reflection indices are shown in a box.
467If this variable is non-zero, reflection markers positions are
468set automatically.
471<hr><H2>Installation details/External Programs</H2>
472<B>Using TCLDUMP with LIVEPLOT.</B>
473LIVEPLOT works with the standard GSAS program HSTDMP, but it works faster and is more
474powerful when used with the TCLDUMP program.
475Note that as of the April 2000 releases, GSAS is now distributed with TCLDUMP
476included. For older versions of GSAS, note the
477instructions for downloading this file can in the installation notes for
478<A HREF="expgui_Win_readme.html">
479Windows</A> and
480<A HREF="expgui_Unix_readme.html">
484<B>Combining CMPR and LIVEPLOT.</B>
485If you have <A HREF="">CMPR</A>
486installed on your computer, you can use superimpose on the GSAS results
487the peaks for an arbitrary unit cell. If desired, space group extinctions
488can even be shown.
489This is pretty neat! To enable this feature, you must have a version
490of CMPR downloaded after 4 May 1998
491<A HREF="">
492(see the CMPR installation instructions.)</A>
494For UNIX, create a link from in the EXPGUI
495directory to file cellgen.tcl in the CMPR directory. For example:
497   ln -s /usr/local/cmpr/cellgen.tcl /usr/local/gsas/expgui/cellgen.tcl
499<LI>For Windows, copy all the .tcl and .exe files from the CMPR directory
500into the EXPGUI directory.
504<B>Combining LOGIC and LIVEPLOT.</B>
505If you have <A HREF="">LOGIC</A>
506installed on your computer, you can superimpose peaks
507for a entry from the ICDD/JCPDS database on a pattern in LIVEPLOT.
508This is also pretty neat!
509To enable this feature, you must have
510a version of LOGIC downloaded after 4 May 1998
511<A HREF="">
512(see the LOGIC installation instructions.)</A>
514For UNIX, create a link from in the GSAS GUI
515directory to file icddcmd.tcl in the LOGIC directory. For example:
517   ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/expgui/icddcmd.tcl
519<LI>For Windows, copy all the LOGIC files into the EXPGUI directory.
523<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
524</TH><TH><A Href="excledt.html">Next page (EXCLEDT)</A>
525</TH><TH><A Href="expguic.html">Previous page</A>
528<a href="">Brian Toby</a> (<a href="">Brian.Toby@NIST.GOV</a>)
530$Revision: 482 $ $Date: 2009-12-04 23:06:54 +0000 (Fri, 04 Dec 2009) $
Note: See TracBrowser for help on using the repository browser.