Ignore:
Timestamp:
Dec 26, 2017 8:18:10 PM (4 years ago)
Author:
toby
Message:

New command-line tutorial

Location:
Tutorials/PythonScript
Files:
5 added
1 edited

Legend:

Unmodified
Added
Removed
  • Tutorials/PythonScript/Scripting.htm

    r3202 r3207  
    66<body>
    77<h1>Running a GSAS-II Refinement From a Python Script</h1>
    8 In this training example we create a Python script to duplicate the
     8To demonstrate the use of the
     9<A href="http://gsas-ii.readthedocs.io/en/latest/GSASIIscripts.html" target="_blank">
     10GSASIIscriptable module</A>, we create a Python script to duplicate the
    911refinement in the
    1012<A
    1113href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/CWCombined/Combined%20refinement.htm"
    1214target="_blank">GSAS-II CW Combined Refinement</A>
    13 tutorial. This uses the
     15tutorial. This uses a Python script
     16to perform the same refinements steps as in that tutorial, but without use of the GSAS-II
     17graphical user interface. Note that the
    1418<A href="http://gsas-ii.readthedocs.io/en/latest/GSASIIscripts.html" target="_blank">
    15 GSASIIscriptable module</A>
    16 to perform the same refinements steps, but without use of the GSAS-II
    17 graphical user interface.
     19GSASIIscriptable module</A> does not offer access to all of the
     20features within GSAS-II, but over time it is expected to grow in
     21capabilities. Much of the initial development for this module was done
     22by Jackson O'Donnell, as a summer undergraduate visitor under
     23supervisor Dr. Maria Chan. Other programming contributions are welcome.
    1824
    1925<h2>Prerequisites</h2>
     
    3036exercise is modeled upon, which explains why each refinement step is
    3137being used.
     38The exercise will require downloading of the same files needed for the
     39Combined Refinement tutorial: "PBSO4.XRA", "INST_XRY.PRM", "PBSO4.CWN",
     40"inst_d1a.prm" and "PbSO4-Wyckoff.cif",
     41which can be downloaded from
     42<A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/">
     43https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/</A>)
     44or will be downloaded with this tutorial if that is requested.
    3245<P>
    3346The exercise can be performed by placing all of the Python commands
    34 into a script, (which can also be
    35 <A href="https://subversion.xray.aps.anl.gov/trac/pyGSAS/export/3131/Tutorials/PythonScript/data/example.py">
    36 downloaded here</A>),
     47into a script, (which is supplied for
     48<A href="https://subversion.xray.aps.anl.gov/trac/pyGSAS/browser/Tutorials/PythonScript/data/example.py?format=txt">
     49download here</A>),
    3750but a more pedagogical approach will be to enter the
    3851commands into a Python interpreter. Use of IPython or Jupyter to run
     
    6881To simplify this example, we will define the location where files will
    6982be written as <tt>workdir</tt> (this directory must exist, but it may
    70 be empty) and the location where the input files for this exercise may
    71 be found as <tt>datadir</tt>. (Note that this directory must have the
    72 the following files: "PBSO4.XRA", "INST_XRY.PRM", "PBSO4.CWN",
    73 "inst_d1a.prm" and "PbSO4-Wyckoff.cif". These files can be downloaded
    74 from
     83be empty) and the location where the input files for this exercise
     84("PBSO4.XRA", "INST_XRY.PRM", "PBSO4.CWN",
     85"inst_d1a.prm" and "PbSO4-Wyckoff.cif") will
     86be found as <tt>datadir</tt>. (As discussed previously,
     87these files can be
    7588<A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/">
    76 https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/</A>)
     89downloaded from here. </A>)
    7790<P>
    7891We also define here a short function to display the weighted profile R
     
    437450
    438451</blockquote>
    439 <a name="SingeStep"><h2>Single Step Approach</h2></a>
     452<a name="SingleStep"><h2>Single Step Approach</h2></a>
    440453<blockquote>
    441454
     
    445458the <I>project</i><tt>.do_refinements()</tt> method can be used to
    446459perform multiple refinement steps. To duplicate the above steps into a
    447 single call a more complex set of dicts must be created, as shown
     460single call, a more complex set of dicts must be created, as shown
    448461below:
    449462
     
    511524gpx.do_refinements(dictList)
    512525</textarea></blockquote>
     526Note that this version of the exercise can be
     527<A href="https://subversion.xray.aps.anl.gov/trac/pyGSAS/browser/Tutorials/PythonScript/data/SingleStep.py?format=txt">
     528downloaded here</A>).
    513529
    514530</blockquote>
     
    516532<hr>
    517533<address></address>
    518 <!-- hhmts start -->Last modified: Fri Dec 22 16:24:53 CST 2017 <!-- hhmts end -->
     534<!-- hhmts start -->Last modified: Tue Dec 26 17:03:22 CST 2017 <!-- hhmts end -->
    519535</body> </html>
Note: See TracChangeset for help on using the changeset viewer.