Changeset 1342


Ignore:
Timestamp:
May 12, 2014 1:19:21 PM (8 years ago)
Author:
toby
Message:

suggested help changes

Location:
trunk/help
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/help/ParametricFitting.htm

    r1340 r1342  
    11091109<h2>Step 2. Create a Pseudo <span class=SpellE>Var</span></h2>
    11101110
     1111<p class=MsoNormal><o:p>&nbsp;</o:p></p>
     1112
    11111113<p class=MsoNormal>Pseudo <span class=SpellE>Vars</span> allow computation of
    11121114an arbitrarily defined function of combinations of the variables that are
     
    13441346<h2>Step 3: Fitting a simple parametric equation to the unit cell volume</h2>
    13451347
     1348<p class=MsoNormal><o:p>&nbsp;</o:p></p>
     1349
    13461350<p class=MsoNormal>In the next few steps we will fit increasingly sophisticated
    13471351equations of state to different parameters. As a simple example, we can <b
     
    16021606(shown as very small error bars, unless the plot is magnified). <span
    16031607style="mso-spacerun:yes">&nbsp;</span>If a linear relationship had been defined
    1604 as a constraint (as can be done with other software packages) the unit cell
     1608as a constraint (as can be done with other software packages) <I>the unit cell
    16051609parameters would have been forced onto this line with no obvious indication
    1606 that this was not a correct result. </p>
     1610that this was not a correct result.</I> </p>
    16071611
    16081612<p class=MsoListParagraphCxSpLast><span style="mso-spacerun:yes">&nbsp;</span></p>
    16091613
    16101614<h2>Step 4: Examples of more complex fitting equations</h2>
     1615
     1616<p class=MsoNormal><o:p>&nbsp;</o:p></p>
    16111617
    16121618<p class=MsoNormal>Here we will look at how more sophisticated Python capabilities
     
    18391845<h2>Step 5: Fitting to a Pseudo <span class=SpellE>Var</span></h2>
    18401846
     1847<p class=MsoNormal><o:p>&nbsp;</o:p></p>
     1848
    18411849<p class=MsoNormal>One can fit a function to a pseudo <span class=SpellE>var</span>,
    18421850just as to a direct variable. If we look at the plot shown in Step 2, it
     
    19411949<p class=MsoNormal><o:p>&nbsp;</o:p></p>
    19421950
    1943 <h2>Use of externally defined routines</h2>
     1951<h2>Advanced Use: Externally-Defined Functions</h2>
    19441952
    19451953<p class=MsoNormal><o:p>&nbsp;</o:p></p>
     
    19471955<p class=MsoNormal>The parametric refinement section of GSAS-II is intended to
    19481956be quite flexible, but for very complex fitting, a user may wish to define a
    1949 custom Python function. This can be done in a separate module that defines a Python
    1950 function that can be called here. As an example of that, if we create a file
    1951 called fittest.py that is in any directory in the Python path (for example in
    1952 the GSAS-II source directory) and place a routine <span class=SpellE><span
     1957custom Python function. Such a function can be defined in a separate
     1958module that will be accessed with a parametric equation (or pseudo
     1959var).</p>
     1960
     1961<p class=MsoNormal><o:p>&nbsp;</o:p></p>
     1962
     1963<p class=MsoNormal>As an example of that, if we create a file called
     1964<span class=SpellE><span style='font-family:Courier'>fittest.py</span></span>
     1965and locate that file in any directory in the Python path (most simply,
     1966in the directory where the project file,
     1967<span class=SpellE><span
     1968style='font-family:Courier'>SeqTut.gpx</span></span>,
     1969is located) and place a routine <span class=SpellE><span
    19531970style='font-family:Courier'>fitfxn</span></span> in that module:</p>
    19541971
    1955 <p class=MsoNormal><o:p>&nbsp;</o:p></p>
    1956 
    1957 <p class=MsoNormal><!--[if gte vml 1]><o:wrapblock><v:shapetype id="_x0000_t202"
    1958   coordsize="21600,21600" o:spt="202" path="m0,0l0,21600,21600,21600,21600,0xe">
    1959   <v:stroke joinstyle="miter"/>
    1960   <v:path gradientshapeok="t" o:connecttype="rect"/>
    1961  </v:shapetype><v:shape id="Text_x0020_Box_x0020_47" o:spid="_x0000_s1026"
    1962   type="#_x0000_t202" style='position:absolute;margin-left:136.25pt;
    1963   margin-top:-73.95pt;width:218.15pt;height:82.3pt;z-index:251664384;
    1964   visibility:visible;mso-wrap-style:none;mso-width-percent:0;
    1965   mso-height-percent:0;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;
    1966   mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;
    1967   mso-position-horizontal:absolute;mso-position-horizontal-relative:margin;
    1968   mso-position-vertical:absolute;mso-position-vertical-relative:margin;
    1969   mso-width-percent:0;mso-height-percent:0;mso-width-relative:margin;
    1970   mso-height-relative:margin;v-text-anchor:top' o:gfxdata="UEsDBBQABgAIAAAAIQDkmcPA+wAAAOEBAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbJSRQU7DMBBF
    1971 90jcwfIWJQ5dIISSdEHaJSBUDjCyJ4nVZGx53NDeHictG4SKWNrj9//TuFwfx0FMGNg6quR9XkiB
    1972 pJ2x1FXyY7fNHqXgCGRgcISVPCHLdX17U+5OHlkkmriSfYz+SSnWPY7AufNIadK6MEJMx9ApD3oP
    1973 HapVUTwo7SgixSzOGbIuG2zhMESxOabrs0nCpXg+v5urKgneD1ZDTKJqnqpfuYADXwEnMj/ssotZ
    1974 nsglnHvr+e7S8JpWE6xB8QYhvsCYPJQJrHDlGqfz65Zz2ciZa1urMW8Cbxbqr2zjPing9N/wJmHv
    1975 OH2nq+WD6i8AAAD//wMAUEsDBBQABgAIAAAAIQAjsmrh1wAAAJQBAAALAAAAX3JlbHMvLnJlbHOk
    1976 kMFqwzAMhu+DvYPRfXGawxijTi+j0GvpHsDYimMaW0Yy2fr28w6DZfS2o36h7xP//vCZFrUiS6Rs
    1977 YNf1oDA78jEHA++X49MLKKk2e7tQRgM3FDiMjw/7My62tiOZYxHVKFkMzLWWV63FzZisdFQwt81E
    1978 nGxtIwddrLvagHro+2fNvxkwbpjq5A3wye9AXW6lmf+wU3RMQlPtHCVN0xTdPaoObMsc3ZFtwjdy
    1979 jWY5YDXgWTQO1LKu/Qj6vn74p97TRz7jutV+h4zrj1dvuhy/AAAA//8DAFBLAwQUAAYACAAAACEA
    1980 ksn9LecCAAA4BgAADgAAAGRycy9lMm9Eb2MueG1srFRNb9swDL0P2H8QdE9tZ06TGHUKN0GGAUVb
    1981 rB16VmQpMaYvSGribNh/HyXHSdbtsA672BRJUeR7JK+uWynQllnXaFXi7CLFiCmq60atS/zlaTmY
    1982 YOQ8UTURWrES75nD17P37652pmBDvdGiZhZBEOWKnSnxxntTJImjGyaJu9CGKTBybSXxcLTrpLZk
    1983 B9GlSIZpepnstK2N1ZQ5B9pFZ8SzGJ9zRv095455JEoMufn4tfG7Ct9kdkWKtSVm09BDGuQfspCk
    1984 UfDoMdSCeIJebPNbKNlQq53m/oJqmWjOG8piDVBNlr6q5nFDDIu1ADjOHGFy/y8svds+WNTUJc7H
    1985 GCkigaMn1np0o1sEKsBnZ1wBbo8GHH0LeuC51ztQhrJbbmX4Q0EI7ID0/ohuiEZBOZx8GA3HI4wo
    1986 2LI0Hw2ziH9yum6s8x+ZligIJbZAX0SVbG+dh1TAtXcJrym9bISIFAoVFE6Lpg66eLDr1VxYtCXA
    1987 fb6cZDeLkDbEOHODU3eVxWbpniEF5AxiiBKyj0R+n4/Gw2o8mg4uq1E2yLN0MqiqdDhYLKu0SvPl
    1988 fJrf/IB0JcnyYgctZaAhA5YA2VKQ9YG+YP47/iShv3R7liWxz7oiIHAspk81CTx1fETJ7wULBQj1
    1989 mXFgONIScQmzxY7IEEqZ8pHRCAZ4By8OKL7l4sE/QhahfMvlDvz+Za388bJslLaxB+JKOKVdf+1T
    1990 5p0/gHFWdxB9u2oBqyCudL2H9rW6WwDO0GUDLXZLnH8gFiYeOha2mL+HDxd6V2J9kDDaaPvtT/rg
    1991 D0SCFaNAd4kVrDiMxCcFAzrN8jwsnHjIoXXgYM8tq3OLepFzDW2awbY0NIrB34te5FbLZ1h1VXgT
    1992 TERReLnEvhfnvttqsCopq6roBCvGEH+rHg0NoQM3YXye2mdizWHGPPTPne43DSlejVrnG24qXb14
    1993 zZs4hydMD7DDeordeFilYf+dn6PXaeHPfgIAAP//AwBQSwMEFAAGAAgAAAAhACzp+tXiAAAACwEA
    1994 AA8AAABkcnMvZG93bnJldi54bWxMj0FLw0AQhe+C/2EZwYu0m4TYtDGbIoKCIEKjHnrbJGMSzM6m
    1995 u9s2/nvHkx6H+Xjve8V2NqM4ofODJQXxMgKB1Nh2oE7B+9vjYg3CB02tHi2hgm/0sC0vLwqdt/ZM
    1996 OzxVoRMcQj7XCvoQplxK3/RotF/aCYl/n9YZHfh0nWydPnO4GWUSRStp9EDc0OsJH3psvqqjUaDT
    1997 zr1O8RPdpHuL1Ud9eH7ZHZS6vprv70AEnMMfDL/6rA4lO9X2SK0Xo4IkS24ZVbCI02wDgpEs3vC8
    1998 mtlVBrIs5P8N5Q8AAAD//wMAUEsBAi0AFAAGAAgAAAAhAOSZw8D7AAAA4QEAABMAAAAAAAAAAAAA
    1999 AAAAAAAAAFtDb250ZW50X1R5cGVzXS54bWxQSwECLQAUAAYACAAAACEAI7Jq4dcAAACUAQAACwAA
    2000 AAAAAAAAAAAAAAAsAQAAX3JlbHMvLnJlbHNQSwECLQAUAAYACAAAACEAksn9LecCAAA4BgAADgAA
    2001 AAAAAAAAAAAAAAAsAgAAZHJzL2Uyb0RvYy54bWxQSwECLQAUAAYACAAAACEALOn61eIAAAALAQAA
    2002 DwAAAAAAAAAAAAAAAAA/BQAAZHJzL2Rvd25yZXYueG1sUEsFBgAAAAAEAAQA8wAAAE4GAAAAAA==
    2003 " filled="f" strokecolor="#4f81bd">
    2004   <v:textbox>
    2005    <![if !mso]>
    2006    <table cellpadding=0 cellspacing=0 width="100%">
    2007     <tr>
    2008      <td><![endif]>
    2009      <div>
    2010      <p class=MsoNormal><span style='font-family:Courier'># <span class=GramE>file</span>
    2011      fittest.py<o:p></o:p></span></p>
    2012      <p class=MsoNormal><span class=SpellE><span class=GramE><span
    2013      style='font-family:Courier'>def</span></span></span><span
    2014      style='font-family:Courier'> <span class=SpellE>fitfxn</span>(T,o1,o2,a1,a2,k):<o:p></o:p></span></p>
    2015      <p class=MsoNormal><span style='font-family:Courier'><span
    2016      style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span class=GramE>if</span>
    2017      T &lt; 120:<o:p></o:p></span></p>
    2018      <p class=MsoNormal><span style='font-family:Courier'><span
    2019      style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    2020      </span><span class=GramE>return</span> o1 + (a1*T)**k<o:p></o:p></span></p>
    2021      <p class=MsoNormal><span style='font-family:Courier'><span
    2022      style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp; </span><span class=GramE>else</span>:<o:p></o:p></span></p>
    2023      <p class=MsoNormal><span style='font-family:Courier'><span
    2024      style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    2025      </span><span class=GramE>return</span> o2 + a2*T<o:p></o:p></span></p>
    2026      <p class=MsoNormal><span style='font-family:Courier'><o:p>&nbsp;</o:p></span></p>
    2027      </div>
    2028      <![if !mso]></td>
    2029     </tr>
    2030    </table>
    2031    <![endif]></v:textbox>
    2032   <w:wrap type="topAndBottom" anchorx="margin" anchory="margin"/>
    2033  </v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout'>
    2034  <table cellpadding=0 cellspacing=0 align=left>
    2035   <tr>
    2036    <td width=136 height=0></td>
    2037   </tr>
    2038   <tr>
    2039    <td></td>
    2040    <td><img width=221 height=85 src="ParametricFitting_files/image069.png"
    2041    alt="Text Box: # file fittest.py&#13;def fitfxn(T,o1,o2,a1,a2,k):&#13;    if T &lt; 120:&#13;        return o1 + (a1*T)**k&#13;    else:&#13;        return o2 + a2*T&#13;&#13;"
    2042    v:shapes="Text_x0020_Box_x0020_47"></td>
    2043   </tr>
    2044  </table>
    2045  </span><![endif]><!--[if gte vml 1]></o:wrapblock><![endif]--><br
    2046 style='mso-ignore:vglayout' clear=ALL>
    2047 </p>
     1972<blockquote><blockquote><PRE>
     1973# file fittest.py
     1974def fitfxn(T,o1,o2,a1,a2,k):
     1975    if T < 120:
     1976        return o1 + (a1*T)**k
     1977    else:
     1978        return o2 + a2*T
     1979</PRE></blockquote></blockquote>
    20481980
    20491981<p class=MsoNormal>The function <span class=SpellE><span style='font-family:
     
    20611993src="ParametricFitting_files/image071.png" v:shapes="Picture_x0020_47"><![endif]></span></p>
    20621994
     1995<p class=MsoNormal><o:p>&nbsp;</o:p></p>
     1996
     1997<p class=MsoNormal>Note that module <span class=SpellE><span style='font-family:
     1998Courier'>fittest</span></span> is automatically located and loaded,
     1999provided it is found in the path. No changes to the standard
     2000distributed GSAS-II code is needed. Care to avoid use of a module name
     2001already found in GSAS-II or Python is wise.</p>
     2002
    20632003</div>
    20642004
  • trunk/help/SequentialTutorial.htm

    r1340 r1342  
    26252625<B>Calculate/Sequential refine menu item</B>. The fits are significantly improved at
    26262626higher temperatures, with <span class=SpellE>R<sub>wp</sub></span> values
    2627 between 13.8 and 16.4.</p>
     2627between 13.8 and 16.4. Be sure to save the project file by <B>clicking on the File/Save project
     2628menu item</B>, since this will be of use for a later tutorial.</p>
    26282629
    26292630<p>This completes the sequential refinement tutorial, although many
    26302631more things could be attempted to further improve the refinement
    2631 quality. Note that the results of this refinement are used for
    2632 additional analysis in the <a href="ParametricFitting.htm">Parametric
    2633 Fitting and Pseudo Variables for Sequential Fits</a> tutorial.
     2632quality. In the <a href="ParametricFitting.htm">Parametric
     2633Fitting and Pseudo Variables for Sequential Fits</a> tutorial,
     2634functions of fitted parameters are computed and plotted and
     2635results are fitted to equations of state.</p>
    26342636
    26352637</div>
Note: See TracChangeset for help on using the changeset viewer.