Changeset 3207


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

New command-line tutorial

Files:
5 added
43 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>
  • Tutorials/SeqRefine/SequentialTutorial_files/image001.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image002.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image003.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image004.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image006.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image007.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image009.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image013.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image015.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image017.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image019.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image021.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image023.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image025.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image026.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image027.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image029.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image031.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image033.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image034.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image035.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image036.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image038.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image041.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image042.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image044.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image046.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image048.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image050.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image052.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image053.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image055.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image057.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image059.png

    • Property svn:mime-type set to application/octet-stream
  • Tutorials/SeqRefine/SequentialTutorial_files/image060.png

    • Property svn:mime-type set to application/octet-stream
  • trunk/GSASIIctrlGUI.py

    r3197 r3207  
    45944594    ['MerohedralTwins', 'Merohedral twin refinement in GSAS.htm', 'Merohedral twin refinements'],
    45954595    ['TOF Single Crystal Refinement', 'TOF single crystal refinement in GSAS.htm', 'Single crystal refinement from TOF data'],
    4596     ['PythonScript','Scripting.htm','Scripting a GSAS-II Refinement from Python']
     4596    ['PythonScript','Scripting.htm','Scripting a GSAS-II Refinement from Python'],
     4597    ['PythonScript','CommandLine.htm','     Running a GSAS-II Refinement from the Command Line'],
    45974598   
    45984599    #['ExampleDir', 'ExamplePage.html', 'Example Tutorial Title'],
  • trunk/GSASIIfiles.py

    • Property svn:keywords set to Date Author Revision URL Id
    r3157 r3207  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: $
    4 # $Author: $
    5 # $Revision: $
    6 # $URL: $
    7 # $Id: $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    3131
    3232import GSASIIpath
    33 GSASIIpath.SetVersionNumber("$Revision: 2957 $")
     33GSASIIpath.SetVersionNumber("$Revision$")
    3434
    3535# N.B. This is duplicated in G2IO
  • trunk/GSASIImpsubs.py

    • Property svn:keywords set to Date Author Revision URL Id
    r3136 r3207  
    1919'''
    2020########### SVN repository information ###################
    21 # $Date: $
    22 # $Author: $
    23 # $Revision: $
    24 # $URL: $
    25 # $Id: $
     21# $Date$
     22# $Author$
     23# $Revision$
     24# $URL$
     25# $Id$
    2626########### SVN repository information ###################
    2727from __future__ import division, print_function
     
    3030import numpy.ma as ma
    3131import GSASIIpath
    32 GSASIIpath.SetVersionNumber("$Revision: 2895 $")
     32GSASIIpath.SetVersionNumber("$Revision$")
    3333import GSASIIpwd as G2pwd
    3434
  • trunk/GSASIIscriptable.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3205 r3207  
    22# -*- coding: utf-8 -*-
    33########### SVN repository information ###################
    4 # $Date: 2017-04-12 15:12:45 -0500 (Wed, 12 Apr 2017) $
    5 # $Author: vondreele $
    6 # $Revision: 2777 $
    7 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/GSASIIscriptable.py $
    8 # $Id: GSASIIIO.py 2777 2017-04-12 20:12:45Z vondreele $
     4# $Date$
     5# $Author$
     6# $Revision$
     7# $URL$
     8# $Id$
    99########### SVN repository information ###################
    1010"""
     
    182182                       [phase0, phase2].
    183183call                   Specifies a function to call after a refinement is completed.
    184                        No function is called if this is not specified.
     184                       The value supplied can be the object (typically a function)
     185                       that will be called or a string that will evaluate (in the
     186                       namespace inside :meth:`G2Project.iter_refinements` where
     187                       ``self`` references the project.)
     188                       Nothing is called if this is not specified.
    185189callargs               Provides a list of arguments that will be passed to the function
    186190                       in call (if any). If call is defined and callargs is not, the
     
    10951099
    10961100    Parameters for Rietveld refinement can be turned on and off as well.
    1097     See :meth:`~G2Project.set_refinement`, :meth:`~G2Project.refine`,
     1101    See :meth:`~G2Project.set_refinement`, :meth:`~G2Project.clear_refinements`,
    10981102    :meth:`~G2Project.iter_refinements`, :meth:`~G2Project.do_refinements`.
    10991103    """
  • trunk/exports/__init__.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
  • trunk/help/Tutorials.html

    r3135 r3207  
    8282<LI><A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/Scripting.htm">Scripting a GSAS-II Refinement from Python</A>
    8383 [link: <A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data">Exercise files</A>].
     84<UL><LI><A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/CommandLine.htm">Running a GSAS-II Refinement from the Command Line</A> <A href="#prereq">*</A>
     85 [link: <A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data">Exercise files</A>].
     86</UL>
    8487</UL>
    8588<A name=prereq>* Indented tutorials require the previous unindented tutorial as a prerequisite
  • trunk/imports/G2img_CBF.py

    • Property svn:eol-style set to native
    • Property svn:keywords set to Date Author Revision URL Id
    r3194 r3207  
    11# -*- coding: utf-8 -*-
    22########### SVN repository information ###################
    3 # $Date: 2016-01-22 13:05:12 -0600 (Fri, 22 Jan 2016) $
    4 # $Author: toby $
    5 # $Revision: 2133 $
    6 # $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/imports/G2img_CBF.py $
    7 # $Id: G2img_CBF.py 2133 2016-01-22 19:05:12Z toby $
     3# $Date$
     4# $Author$
     5# $Revision$
     6# $URL$
     7# $Id$
    88########### SVN repository information ###################
    99'''
     
    2020import numpy as np
    2121import unpack_cbf as cbf
    22 GSASIIpath.SetVersionNumber("$Revision: 2133 $")
     22GSASIIpath.SetVersionNumber("$Revision$")
    2323class CBF_ReaderClass(G2obj.ImportImage):
    2424    '''Routine to read a Read cif image data .cbf file.
Note: See TracChangeset for help on using the changeset viewer.