Changeset 3207 for Tutorials/PythonScript
- Timestamp:
- Dec 26, 2017 8:18:10 PM (7 years ago)
- Location:
- Tutorials/PythonScript
- Files:
-
- 5 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified Tutorials/PythonScript/Scripting.htm ¶
r3202 r3207 6 6 <body> 7 7 <h1>Running a GSAS-II Refinement From a Python Script</h1> 8 In this training example we create a Python script to duplicate the 8 To demonstrate the use of the 9 <A href="http://gsas-ii.readthedocs.io/en/latest/GSASIIscripts.html" target="_blank"> 10 GSASIIscriptable module</A>, we create a Python script to duplicate the 9 11 refinement in the 10 12 <A 11 13 href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/CWCombined/Combined%20refinement.htm" 12 14 target="_blank">GSAS-II CW Combined Refinement</A> 13 tutorial. This uses the 15 tutorial. This uses a Python script 16 to perform the same refinements steps as in that tutorial, but without use of the GSAS-II 17 graphical user interface. Note that the 14 18 <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. 19 GSASIIscriptable module</A> does not offer access to all of the 20 features within GSAS-II, but over time it is expected to grow in 21 capabilities. Much of the initial development for this module was done 22 by Jackson O'Donnell, as a summer undergraduate visitor under 23 supervisor Dr. Maria Chan. Other programming contributions are welcome. 18 24 19 25 <h2>Prerequisites</h2> … … 30 36 exercise is modeled upon, which explains why each refinement step is 31 37 being used. 38 The exercise will require downloading of the same files needed for the 39 Combined Refinement tutorial: "PBSO4.XRA", "INST_XRY.PRM", "PBSO4.CWN", 40 "inst_d1a.prm" and "PbSO4-Wyckoff.cif", 41 which can be downloaded from 42 <A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/"> 43 https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/</A>) 44 or will be downloaded with this tutorial if that is requested. 32 45 <P> 33 46 The exercise can be performed by placing all of the Python commands 34 into a script, (which can also be35 <A href="https://subversion.xray.aps.anl.gov/trac/pyGSAS/ export/3131/Tutorials/PythonScript/data/example.py">36 download edhere</A>),47 into 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"> 49 download here</A>), 37 50 but a more pedagogical approach will be to enter the 38 51 commands into a Python interpreter. Use of IPython or Jupyter to run … … 68 81 To simplify this example, we will define the location where files will 69 82 be 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 may71 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 83 be 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 86 be found as <tt>datadir</tt>. (As discussed previously, 87 these files can be 75 88 <A href="https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/"> 76 https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/data/</A>)89 downloaded from here. </A>) 77 90 <P> 78 91 We also define here a short function to display the weighted profile R … … 437 450 438 451 </blockquote> 439 <a name="Sing eStep"><h2>Single Step Approach</h2></a>452 <a name="SingleStep"><h2>Single Step Approach</h2></a> 440 453 <blockquote> 441 454 … … 445 458 the <I>project</i><tt>.do_refinements()</tt> method can be used to 446 459 perform multiple refinement steps. To duplicate the above steps into a 447 single call a more complex set of dicts must be created, as shown460 single call, a more complex set of dicts must be created, as shown 448 461 below: 449 462 … … 511 524 gpx.do_refinements(dictList) 512 525 </textarea></blockquote> 526 Note 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"> 528 downloaded here</A>). 513 529 514 530 </blockquote> … … 516 532 <hr> 517 533 <address></address> 518 <!-- hhmts start -->Last modified: Fri Dec 22 16:24:53CST 2017 <!-- hhmts end -->534 <!-- hhmts start -->Last modified: Tue Dec 26 17:03:22 CST 2017 <!-- hhmts end --> 519 535 </body> </html>
Note: See TracChangeset
for help on using the changeset viewer.