source: trunk/doc/liveplot.html @ 434

Last change on this file since 434 was 433, checked in by toby, 12 years ago

# on 2001/09/04 23:04:23, toby did:
cleanup html
select symbol/color/font

  • Property rcs:author set to toby
  • Property rcs:date set to 2001/09/04 23:04:23
  • Property rcs:lines set to +17 -10
  • Property rcs:rev set to 1.3
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 21.0 KB
Line 
1<html>
2<head>
3   <META NAME="Author" CONTENT="Brian H. Toby">
4   <title>EXPGUI -- LIVEPLOT/BKGEDIT</title>
5</head>
6<BODY BGCOLOR="#FFFFFF">
7
8<A HREF=http://www.ncnr.nist.gov>
9<IMG SRC="http://www.ncnr.nist.gov/images/ncnrtrans.gif" 
10alt="Link to NIST Center for Neutron Research home page"
11ALIGN=RIGHT></A>
12<A HREF="http://www.nist.gov">
13<IMG SRC="http://www.ncnr.nist.gov/images/webidblue_2lineright.gif" 
14alt="Link to National Institute of Standards & Technology home page"
15ALIGN=LEFT></A>
16<CENTER>
17<A Href="http://www.ncnr.nist.gov/programs/crystallography/software/tclpkgs.html">
18<IMG SRC="tcltklogo100.gif" 
19alt="Link to Tcl/Tk information">
20</CENTER></A>
21<br clear=all><hr>
22
23<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
24<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
25</TH></TR></TABLE><BR CLEAR=ALL>
26
27<center><h1>
28LIVEPLOT and BKGEDIT
29</h1></center>
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.
37<P>
38Both LIVEPLOT and BKGEDIT get the current diffraction information
39by running the TCLDUMP program, if installed, or
40HSTDUMP otherwise. The TCLDUMP program has been optimized for use
41with LIVEPLOT and offers a number of extra
42options that are not available when HSTDUMP is used. Since TCLDUMP has been
43included in GSAS since April of 2000, it is assumed that this is now the case.
44
45<a name="liveplot"></a>
46<H3>LIVEPLOT</H3>
47LIVEPLOT is started by pressing the LIVEPLOT button on the toolbar
48or via the Graphs/liveplot menu item.
49<P>
50Some of the features available in LIVEPLOT are:
51<UL>
52<LI>The plot is updated automatically after each refinement run
53<LI>The plot can be zoomed, by clicking on the corners of the
54area to be magnified.
55<LI>
56The units used for plotting histograms can be selected. Choices are:
57native units (2Theta/TOF/KeV); d-space (A) or Q (A<sup>-1</sup>)
58<LI>
59The background (fixed plus fitted) can be plotted or can be subtracted.
60<LI>
61Reflection tickmarks can be displayed in a variety of formats
62<LI>
63LIVEPLOT can be coupled to the LOGIC or CMPR programs, so that
64peak positions from an ICDD entry or for an arbitrary unit cell and
65spacegroup can be shown superimposed on the "Rietveld plot."
66<LI>
67<IMG SRC="note.gif" alt="Note!">
68Reflection indices (<I>hkl</I> values) can be shown for tickmarks
69<LI>
70<IMG SRC="new.gif" HEIGHT=13 WIDTH=36 alt="New!">
71The cumulative chi<sup>2</sup> function can be plotted.
72</UL>
73
74<a name="bkgedit"></a>
75<H3>BKGEDIT</H3>
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.
90<P>
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.
97<P>
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="expgui3.html#EditBackground">"Edit Background"</A>
104dialog box (invoked from the "Edit Background" button on the
105<A href="expgui3.html">Histogram pane</A>.)
106toolbar
107or
108<OL>
109<LI><a href="#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.
121<DL><DL>
122Note that it is advisable to place many background points in areas where
123the background varies greatly.
124</DL></DL>
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.
138<DL><DL>
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.
143</DL></DL>
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.
155</OL>
156
157<P>
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.
165
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>
192<P>
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.]
203<P>
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,
208<I>EXPNAM</I><tt>.bkg</tt><I>N</I>,
209can be read into EXPEDT by typing "@R" at the initial prompt
210in EXPEDT:
211<PRE>
212   Is this the file you wish to use? (<?>,D,K,Q,R,Y) ><u>@r</u>
213</PRE>
214prompt and then supplying the name of the file, in response to the next prompt:
215<PRE>
216   Enter the name of your macro file: <u>GARNET.bkg1</u>
217</PRE>
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.
222
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.
232<P>
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."
237
238<P>
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.
253<P>
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>
258<P>
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 tickmarks (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">
270<P>
271<br clear=all>
272
273<hr><h2>LIVEPLOT/BKGEDIT Menu Contents</h2>
274A few of these options are omitted from BKGEDIT.
275<DL><DL>
276<img SRC="lm1.gif" align=RIGHT alt="EXPGUI Screen snapshot">
277<H3>File Menu</H3>
278<DT>Tickmarks
279<DD>Checkbuttons are provided for each phase to determine if tick marks
280are shown. See the Options/"Configure Tickmarks"menu item for information
281on tickmarks
282<DT>Histogram
283<DD>This allows a histogram to be selected to be loaded
284<DT>Update Plot
285<DD>The causes LIVEPLOT to read read the current histogram again from
286the datafile
287<DT>Make PostScript
288<DD>Creates a low quality PostScript file containing the LIVEPLOT
289output. See the Options/"Set PS output" button for where the file is created.
290<DT>Quit
291<DD>Exits BKGEDIT/LIVEPLOT.
292</DL></DL>
293<br clear=all>
294<img SRC="lm2.gif" align=RIGHT alt="EXPGUI Screen snapshot">
295<H3>Options Menu</H3>
296<DL><DL>
297<DT>Configure Tickmarks
298<DD>Tickmarks can be placed automatically, similar to their
299 placement in POWPLOT or can be drawn one height to another. The default
300is for lines to be draw from "-Inf" to "Inf", which creates lines from the
301bottom 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
302the vertical placement of the tickmarks can be specified. The "show" flag,
303set in the File/Tickmarks menu can also be changed here.
304<DT>Obs Symbol (Symbol Type)
305<DD>This brings up a menu where the symbol type and size for the
306observed data points (and for BKGEDIT, the fixed background points)
307can be selected.
308<DT>Symbol Color
309<DD>The colors for all the displayed lines and symbols can be changed here.
310<DT>X units
311<DD>The x units can be selected here. The choices are
312"as collected" (2Theta/TOF/KeV), d-space (A) or Q (A<sup>-1</sup>)
313<DT>Y units
314<DD>The intensity values can be normalized by the incident spectrum
315(for energy dispersive methods).
316<DT>HKL labeling
317<DD>This brings up a menu that selects how long <I>hkl</I> values are shown
318before they are erased (0 means that they are not erased), the size of the
319labels and the width around the mouse that is searched for matching
320reflections. If requested using the "Separate window for <I>hkl</I> labels"
321option, labels are also show in a separate window.
322<DT>Subtract background
323<DD>The background is always shown, even when subtracted
324<DT>Include legend
325<DD>The legend is the optional box in the upper left that defines the
326plot entries
327<DT>Set PS output
328<DD>For UNIX this allows the file to be sent directly to a printer
329or can be saved in a file. For Windows, a file must be written.
330<DT>Set screen font
331<DD>This option is used to control the font used for menus, graphics and
332other aspects of windows.
333<DT>Raise on update
334<DD>This causes the plot to be placed on top of other windows, if partially
335obscured, when the plot is updated. At this time, this option does not
336work in Windows-NT and -2000.
337<DT>Cumulative Chi2
338<DD>The causes the Cumulative chi<sup>2</sup> function to be defined
339(see below).
340<DT>Save Options
341<DD>Causes many of the options set in this menu to be saved in the <TT>.gsas_config</TT> file.
342</DL></DL>
343<br clear=all>
344
345<P>
346<hr><H2>Customization of LIVEPLOT & BKGEDIT</H2><A NAME="customize"></A>
347The <TT>localconfig</TT> and <TT>.gsas_config</TT> files are read, if present.
348The following variables control how LIVEPLOT, and in most cases BKGEDIT,
349function and can be
350customized by changing their values in the
351<TT>localconfig</TT> and <TT>.gsas_config</TT> files.
352Note that some of these options are relevant only if the tcldump program is
353present.
354<DL><DL>
355<DT><TT>peakinfo(flag<i>n</i>)</TT><DD>
356These variables define if peak positions will be shown
357for reflections in phase "<i>n</i>". Reflections will be shown if
358the value is non-zero.
359
360<DT><TT>peakinfo(color<i>n</i>)</TT><DD>
361These variables define the default colors for
362reflections in phase "<i>n</i>"
363
364<DT><TT>peakinfo(dashes<i>n</i>)</TT><DD>
365These variables define if peaks will be dashed for
366reflections in phase "<i>n</i>" (UNIX only). Lines will be dashed if
367the value is non-zero.
368
369<DT><TT>peakinfo(min<i>n</i>) and peakinfo(max<i>n</i>)</TT><DD>
370These variables dictate the placement vertical position for reflection
371markers, when manually placed (see expgui(autotick), below). To draw
372to the edge of the screen, use -Inf and Inf.
373</DL></DL>
374
375The following variables are written to <tt>.gsas_config</tt> when
376"Save Options" is used. These variables are all set from the GUI and therefore
377do not need to be edited manually.
378
379<DL><DL>
380<DT><TT>graph(printout)</TT><DD>
381This is set to 1 if PostScript files
382will be printed and 0 if they will be written to disk (for Windows all
383files should be written to disk).
384
385<DT><TT>graph(outname)</TT><DD>
386This is the default for the file name used
387when PostScript files will be written to disk.
388
389<DT><TT>graph(outcmd)</TT><DD>
390This is the default for the command used
391to print PostScript files (Unix only).
392
393<DT><TT>graph(legend)</TT><DD>
394Sets the default value for display of the legend in LIVEPLOT and WIDPLT.
395
396<DT><TT>graph(autoraise)</TT><DD>
397This option shows up in the options menu item as "Raise on update."
398When set to non-zero, the LIVEPLOT window is raised
399(placed on top of any other overlapping) windows
400each time it is updated.
401This option does not seem to work in Windows-NT, but this may depend on
402the version of Tcl/Tk.
403
404<DT><TT>peakinfo(obssym)</TT><DD>
405Symbol for observed data points. Valid choices are square, circle, diamond,
406plus, cross, splus and scross.
407
408<DT><TT>peakinfo(obssize)</TT><DD>
409Size for the symbol for observed data points. A value of 1 corresponds to about 1/8 inch
410(about 3 mm).
411
412<DT><TT>expgui(pixelregion)</TT><DD>
413When hkl values are loaded (using tcldump) and reflections are labeled, reflections
414can be labeled using a Shift-Left-Mouse click. All labeled reflections within expgui(pixelregion)
415pixels of the mouse position are assumed to be overlapped and are labeled.
416
417<DT><TT>expgui(fadetime)</TT><DD>
418The time in seconds before reflection labels are removed. A value of zero means that reflections
419must be deleted manually (Shift-Right-Mouse).
420
421<DT><TT>expgui(lblfontsize)</TT><DD>
422A size for reflections labels in pixels.
423
424<DT><TT>expgui(hklbox)</TT><DD>
425If this variable is non-zero, reflection indices are shown in a box.
426
427<DT><TT>expgui(autotick)</TT><DD>
428If this variable is non-zero, reflection markers positions are
429set automatically.
430</DL></DL>
431<P>
432<hr><H2>Installation details/External Programs</H2>
433<B>Using TCLDUMP with LIVEPLOT.</B>
434LIVEPLOT works with the standard GSAS program HSTDMP, but it works faster and is more
435powerful when used with the TCLDUMP program.
436Note that as of the April 2000 releases, GSAS is now distributed with TCLDUMP
437included. For older versions of GSAS, note the
438instructions for downloading this file can in the installation notes for
439<A HREF="expgui_Win_readme.html">
440Windows</A> and
441<A HREF="expgui_Unix_readme.html">
442UNIX</A>.
443<P>
444
445<B>Combining CMPR and LIVEPLOT.</B>
446If you have <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr.html">CMPR</A>
447installed on your computer, you can use superimpose on the GSAS results
448the peaks for an arbitrary unit cell. If desired, space group extinctions
449can even be shown.
450This is pretty neat! To enable this feature, you must have a version
451of CMPR downloaded after 4 May 1998
452<A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/cmpr.html">
453(see the CMPR installation instructions.)</A>
454<UL><LI>
455For UNIX, create a link from in the EXPGUI
456directory to file cellgen.tcl in the CMPR directory. For example:
457<PRE>
458   ln -s /usr/local/cmpr/cellgen.tcl /usr/local/gsas/expgui/cellgen.tcl
459</PRE>
460<LI>For Windows, copy all the .tcl and .exe files from the CMPR directory
461into the EXPGUI directory.
462</UL>
463<P>
464
465<B>Combining LOGIC and LIVEPLOT.</B>
466If you have <A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/logic.html">LOGIC</A>
467installed on your computer, you can superimpose peaks
468for a entry from the ICDD/JCPDS database on a pattern in LIVEPLOT.
469This is also pretty neat!
470To enable this feature, you must have
471a version of LOGIC downloaded after 4 May 1998
472<A HREF="http://www.ncnr.nist.gov/programs/crystallography/software/logic.html">
473(see the LOGIC installation instructions.)</A>
474<UL><LI>
475For UNIX, create a link from in the GSAS GUI
476directory to file icddcmd.tcl in the LOGIC directory. For example:
477<PRE>
478   ln -s /usr/local/powdersuite/icddcmd.tcl /usr/local/gsas/expgui/icddcmd.tcl
479</PRE>
480<LI>For Windows, copy all the LOGIC files into the EXPGUI directory.
481</UL>
482<hr>
483<TABLE BORDER BGCOLOR="#FFFF40" ALIGN=RIGHT>
484<TR><TH><A  Href="expgui.html">EXPGUI top</A> 
485</TH></TR></TABLE>
486
487<a href="http://www.ncnr.nist.gov/staff/toby/">Brian Toby</a> (<a href="mailto:brian.toby@nist.gov">Brian.Toby@NIST.GOV</a>)
488<br>
489$Revision: 433 $ $Date: 2009-12-04 23:06:05 +0000 (Fri, 04 Dec 2009) $
490</body>
491</html>
Note: See TracBrowser for help on using the repository browser.