Changeset 1009


Ignore:
Timestamp:
Jul 24, 2013 4:39:06 PM (8 years ago)
Author:
vondreele
Message:

auto peak search for TOF - no duplicates either
small amendment to peak fit tutorial

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r998 r1009  
    439439    return widths,fmin,fmax
    440440   
    441 def getFWHM(TTh,Inst):
     441def getFWHM(pos,Inst):
    442442    'needs a doc string'
    443443    sig = lambda Th,U,V,W: 1.17741*math.sqrt(max(0.001,U*tand(Th)**2+V*tand(Th)+W))*math.pi/180.
     444    sigTOF = lambda dsp,S0,S1,Sq:  S0+S1*dsp**2+Sq*dsp
    444445    gam = lambda Th,X,Y: (X/cosd(Th)+Y*tand(Th))*math.pi/180.
    445     s = sig(TTh/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])*100.
    446     g = gam(TTh/2.,Inst['X'][1],Inst['Y'][1])*100.
     446    gamTOF = lambda dsp,X,Y: X*dsp+Y*dsp**2
     447    if 'C' in Inst['Type'][0]:
     448        s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])*100.
     449        g = gam(pos/2.,Inst['X'][1],Inst['Y'][1])*100.
     450    else:
     451        dsp = pos/Inst['difC'][0]
     452        s = sigTOF(dsp,Inst['sig-0'][1],Inst['sig-1'][1],Inst['sig-q'][1])
     453        g = gamTOF(dsp,Inst['X'][1],Inst['Y'][1])
    447454    return getgamFW(g,s)
    448455   
  • trunk/help/Fit Peaks.htm

    r898 r1009  
    2323  <o:Author>Von Dreele</o:Author>
    2424  <o:LastAuthor>Von Dreele</o:LastAuthor>
    25   <o:Revision>30</o:Revision>
    26   <o:TotalTime>770</o:TotalTime>
     25  <o:Revision>31</o:Revision>
     26  <o:TotalTime>773</o:TotalTime>
    2727  <o:Created>2012-05-05T16:28:00Z</o:Created>
    28   <o:LastSaved>2013-04-30T18:16:00Z</o:LastSaved>
     28  <o:LastSaved>2013-07-24T21:07:00Z</o:LastSaved>
    2929  <o:Pages>11</o:Pages>
    30   <o:Words>2633</o:Words>
    31   <o:Characters>15011</o:Characters>
     30  <o:Words>2707</o:Words>
     31  <o:Characters>15435</o:Characters>
    3232  <o:Company>Argonne National Laboratory</o:Company>
    33   <o:Lines>125</o:Lines>
    34   <o:Paragraphs>35</o:Paragraphs>
    35   <o:CharactersWithSpaces>17609</o:CharactersWithSpaces>
     33  <o:Lines>128</o:Lines>
     34  <o:Paragraphs>36</o:Paragraphs>
     35  <o:CharactersWithSpaces>18106</o:CharactersWithSpaces>
    3636  <o:Version>14.00</o:Version>
    3737 </o:DocumentProperties>
     
    11431143mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
    11441144Calibri;mso-bidi-theme-font:minor-latin'>Import/Powder Data/from GSAS file</span></b>
    1145 menu item to read the data file into the current GSAS-II project. This read option
    1146 is set to read any of the powder data formats defined for GSAS (angles in <span
    1147 class=SpellE>centidegrees</span>, TOF in µsec). Other submenu items will read
    1148 the <span class=SpellE><b style='mso-bidi-font-weight:normal'><span
     1145menu item to read the data file into the current GSAS-II project. This read
     1146option is set to read any of the powder data formats defined for GSAS (angles
     1147in <span class=SpellE>centidegrees</span>, TOF in µsec). Other submenu items
     1148will read the <span class=SpellE><b style='mso-bidi-font-weight:normal'><span
    11491149style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    11501150mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:
     
    12981298normal'><span style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:
    12991299minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;
    1300 mso-bidi-theme-font:minor-latin'>Limits</span></b> window is erased). At this
    1301 point it is wise to zoom in on the data that will be used for indexing. </p>
     1300mso-bidi-theme-font:minor-latin'>Limits</span></b> window is erased). At this point
     1301it is wise to zoom in on the data that will be used for indexing. </p>
    13021302
    13031303<p class=MsoListParagraphCxSpMiddle style='margin-left:39.0pt;mso-add-space:
     
    13671367
    13681368<p class=MsoListParagraphCxSpLast style='margin-left:39.0pt;mso-add-space:auto'>There
    1369 will be 22-23 peaks in this example. You should examine both the list and the
    1370 plot to be sure the auto search did not pick a peak twice (there may be three
    1371 of these!) or skip a peak or shoulder. You can add a peak to the list by
    1372 pressing the left mouse button with the pointer on a data point at the peak top
    1373 or shoulder; be sure the zoom/shift buttons are off. You may drag a peak
    1374 position as needed. A position may be deleted with a right click with the mouse
    1375 on the blue line. You can also delete a peak by selecting the row in the table;
    1376 it will be highlighted in blue. Then press the <b style='mso-bidi-font-weight:
    1377 normal'><span style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:
    1378 minor-latin;mso-hansi-theme-font:minor-latin'>Delete</span></b> key; it will be
    1379 removed from the table and the plot. The list will always show the peaks sorted
    1380 by position. When done you should have 20 unique peak positions.</p>
     1369will be 20+ peaks in this example. You should examine both the list and the
     1370plot to be sure the auto search did not pick a peak twice (quite rarely) or
     1371skip a peak or shoulder. You can add a peak to the list by pressing the left
     1372mouse button with the pointer on a data point at the peak top or shoulder; be
     1373sure the zoom/shift buttons are off. You may drag a peak position as needed. A
     1374position may be deleted with a right click with the mouse on the blue line. You
     1375can also delete a peak by selecting the row in the table; it will be
     1376highlighted in blue. Then press the <b style='mso-bidi-font-weight:normal'><span
     1377style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
     1378mso-hansi-theme-font:minor-latin'>Delete</span></b> key; it will be removed
     1379from the table and the plot. The list will always show the peaks sorted by
     1380position. When done you should have 20 unique peak positions.</p>
    13811381
    13821382<h2>Step 4: Refine Peak Positions</h2>
     
    15351535src="Fit%20Peaks_files/image012.png" v:shapes="Picture_x0020_11"><![endif]></span></p>
    15361536
    1537 <p class=MsoListParagraphCxSpLast>Notice that the peak position is slightly to
    1538 the right of the peak top. This is a consequence of the peak asymmetry arising
    1539 from axial divergence in the diffractometer. The <span class=SpellE>Rwp</span>
    1540 is ~6% as shown on the console window. Again the <b style='mso-bidi-font-weight:
     1537<p class=MsoListParagraphCxSpLast>Notice that the peak position is slightly to the
     1538right of the peak top. This is a consequence of the peak asymmetry arising from
     1539axial divergence in the diffractometer. The <span class=SpellE>Rwp</span> is
     1540~6% as shown on the console window. Again the <b style='mso-bidi-font-weight:
    15411541normal'><span style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:
    15421542minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;
     
    16441644
    16451645<p class=MsoNormal>Select the cell with M20 ~ 2970 with a = 4.15683 Å. This
    1646 indexes all peaks with almost a perfect fit to the peak positions (compare
    1647 dashed red lines to solid blue ones). Import the cell information using the <b
     1646indexes all peaks with almost a perfect fit to the peak positions (compare dashed
     1647red lines to solid blue ones). Import the cell information using the <b
    16481648style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    16491649mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
     
    17031703can be used in future analysis (e.g. Rietveld or Pawley refinement).</p>
    17041704
    1705 <p class=MsoNormal>To continue with the second part of this exercise, select
    1706 the menu item <b style='mso-bidi-font-weight:normal'><span style='font-family:
    1707 "Calibri","sans-serif";mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:
    1708 minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin'>File/Close
    1709 project</span></b> in the <b style='mso-bidi-font-weight:normal'><span
    1710 style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    1711 mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:
    1712 minor-latin'>GSAS-II data tree </span></b>window. You will be asked if you want
    1713 it saved; if <span class=GramE><b style='mso-bidi-font-weight:normal'><span
    1714 style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    1715 mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:
    1716 minor-latin'>Yes</span></b></span> then all the peak fitting/indexing &amp;
    1717 cell refinement results will be saved to the <b style='mso-bidi-font-weight:
    1718 normal'><span style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:
    1719 minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;
    1720 mso-bidi-theme-font:minor-latin'>LaB6.gpx</span></b> file. If <b
     1705<p class=MsoNormal>To continue with the second part of this exercise, select the
     1706menu item <b style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1707mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
     1708Calibri;mso-bidi-theme-font:minor-latin'>File/Close project</span></b> in the <b
     1709style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1710mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
     1711Calibri;mso-bidi-theme-font:minor-latin'>GSAS-II data tree </span></b>window.
     1712You will be asked if you want it saved; if <span class=GramE><b
     1713style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1714mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
     1715Calibri;mso-bidi-theme-font:minor-latin'>Yes</span></b></span> then all the
     1716peak fitting/indexing &amp; cell refinement results will be saved to the <b
     1717style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
     1718mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
     1719Calibri;mso-bidi-theme-font:minor-latin'>LaB6.gpx</span></b> file. If <b
    17211720style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    17221721mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
     
    17391738style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    17401739mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:
    1741 minor-latin'>\Exercises\kryptonite\11bmb_6231.fxye</span></b>; it has a
    1742 corresponding <span class=SpellE><b style='mso-bidi-font-weight:normal'><span
     1740minor-latin'>\Exercises\kryptonite\11bmb_6231.fxye</span></b>; it has a corresponding
     1741<span class=SpellE><b style='mso-bidi-font-weight:normal'><span
    17431742style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    17441743mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:
     
    17701769small ones); use <b style='mso-bidi-font-weight:normal'><span style='font-family:
    17711770"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:
    1772 minor-latin'>Auto search</span></b> to start and then fill in by hand:
    1773 Add peaks by left-clicking on a data point near the top of the
    1774 peak. Peak positions can be moved by dragging the peak line and peaks
    1775 can be deleted by right-clicking on them. This only works when the
    1776 zoom and reposition modes (below) are not selected. Also note
    1777 some peaks have shoulders most notably at 5.07, 6.04, 7.81deg. I found 28 peaks
    1778 (there was one very weak shoulder at ~7.3 deg. I skipped – it might be from a
    1779 second phase? We’ll see later).</p>
     1771minor-latin'>Auto search</span></b> to start and then fill in by hand: Add
     1772peaks by left-clicking on a data point near the top of the peak. Peak positions
     1773can be moved by dragging the peak line and peaks can be deleted by
     1774right-clicking on them. This only works when the zoom and reposition modes
     1775(below) are not selected. Also note some peaks have shoulders most notably at
     17765.07, 6.04, 7.81deg. I found 28 peaks (there was one very weak shoulder at ~7.3
     1777deg. I skipped – it might be from a second phase? We’ll see later).</p>
    17801778
    17811779<p class=MsoNormal><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
    1782  id="_x0000_i1034" type="#_x0000_t75" style='width:525pt;height:450pt;
    1783  visibility:visible;mso-wrap-style:square'>
     1780 id="Picture_x0020_19" o:spid="_x0000_i1034" type="#_x0000_t75" style='width:525pt;
     1781 height:450pt;visibility:visible;mso-wrap-style:square'>
    17841782 <v:imagedata src="Fit%20Peaks_files/image020.png" o:title=""/>
    17851783</v:shape><![endif]--><![if !vml]><img border=0 width=700 height=600
    1786 src="Fit%20Peaks_files/image020.png" v:shapes="_x0000_i1034"><![endif]></span><br
     1784src="Fit%20Peaks_files/image020.png" v:shapes="Picture_x0020_19"><![endif]></span><br
    17871785clear=all style='mso-special-character:line-break'>
    17881786</p>
     
    17901788<h2><span class=GramE>Step 4.</span> Refine peaks</h2>
    17911789
    1792 <p class=MsoNormal>Following the steps used in the LaB<sub>6</sub> example
    1793 above, refine the peaks and the profile shape parameters in <b
    1794 style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    1795 mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
    1796 Calibri;mso-bidi-theme-font:minor-latin'>Instrument Parameters</span></b>. You
    1797 will be asked for a project file name at the first refinement (I used ‘<span
     1790<p class=MsoNormal>Following the steps used in the LaB<sub>6</sub> example above,
     1791refine the peaks and the profile shape parameters in <b style='mso-bidi-font-weight:
     1792normal'><span style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:
     1793minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;
     1794mso-bidi-theme-font:minor-latin'>Instrument Parameters</span></b>. You will be
     1795asked for a project file name at the first refinement (I used ‘<span
    17981796class=SpellE><b style='mso-bidi-font-weight:normal'><span style='font-family:
    17991797"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:
     
    18641862
    18651863<p class=MsoNormal><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
    1866  id="_x0000_i1033" type="#_x0000_t75" style='width:525pt;height:450pt;
    1867  visibility:visible;mso-wrap-style:square'>
     1864 id="Picture_x0020_20" o:spid="_x0000_i1033" type="#_x0000_t75" style='width:525pt;
     1865 height:450pt;visibility:visible;mso-wrap-style:square'>
    18681866 <v:imagedata src="Fit%20Peaks_files/image021.png" o:title=""/>
    18691867</v:shape><![endif]--><![if !vml]><img border=0 width=700 height=600
    1870 src="Fit%20Peaks_files/image021.png" v:shapes="_x0000_i1033"><![endif]><!--[if gte vml 1]><v:shape
     1868src="Fit%20Peaks_files/image021.png" v:shapes="Picture_x0020_20"><![endif]><!--[if gte vml 1]><v:shape
    18711869 id="Picture_x0020_21" o:spid="_x0000_i1032" type="#_x0000_t75" style='width:527.25pt;
    18721870 height:376.5pt;visibility:visible;mso-wrap-style:square'>
     
    19091907
    19101908<p class=MsoNormal><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
    1911  id="_x0000_i1031" type="#_x0000_t75" style='width:545.25pt;height:303.75pt;
    1912  visibility:visible;mso-wrap-style:square'>
     1909 id="Picture_x0020_22" o:spid="_x0000_i1031" type="#_x0000_t75" style='width:545.25pt;
     1910 height:303.75pt;visibility:visible;mso-wrap-style:square'>
    19131911 <v:imagedata src="Fit%20Peaks_files/image023.png" o:title=""/>
    19141912</v:shape><![endif]--><![if !vml]><img border=0 width=727 height=405
    1915 src="Fit%20Peaks_files/image023.png" v:shapes="_x0000_i1031"><![endif]></span><span
     1913src="Fit%20Peaks_files/image023.png" v:shapes="Picture_x0020_22"><![endif]></span><span
    19161914style='mso-spacerun:yes'> </span></p>
    19171915
     
    19291927style='mso-bidi-font-weight:normal'><span style='font-family:"Calibri","sans-serif";
    19301928mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:
    1931 Calibri;mso-bidi-theme-font:minor-latin'>Save</span></b></span> the project
    1932 file as it is needed for the <b style='mso-bidi-font-weight:normal'><span
     1929Calibri;mso-bidi-theme-font:minor-latin'>Save</span></b></span> the project file
     1930as it is needed for the <b style='mso-bidi-font-weight:normal'><span
    19331931style='font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
    19341932mso-hansi-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:
     
    19921990small ones); use <b style='mso-bidi-font-weight:normal'><span style='font-family:
    19931991"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;mso-hansi-theme-font:
    1994 minor-latin'>Auto search</span></b> to start and then fill in by hand:
    1995 Add peaks by left-clicking on a data point near the top of the
    1996 peak. Peak positions can be moved by dragging the peak line and peaks
    1997 can be deleted by right-clicking on them. This only works when the
    1998 zoom and reposition modes (below) are not selected. Also note the
    1999 shoulder at ~6.3 <span class=SpellE>deg</span> that should be added to the
    2000 list. I skipped a couple of very weak peaks; the total list has 28 peaks.</p>
     1992minor-latin'>Auto search</span></b> to start and then fill in by hand: Add
     1993peaks by left-clicking on a data point near the top of the peak. Peak positions
     1994can be moved by dragging the peak line and peaks can be deleted by
     1995right-clicking on them. This only works when the zoom and reposition modes
     1996(below) are not selected. Also note the shoulder at ~6.3 <span class=SpellE>deg</span>
     1997that should be added to the list. I skipped a couple of very weak peaks; the
     1998total list has 28 peaks.</p>
    20011999
    20022000<p class=MsoNormal><span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shape
Note: See TracChangeset for help on using the changeset viewer.