source: Tutorials/PythonScript/data/sim.py @ 3209

Last change on this file since 3209 was 3209, checked in by toby, 4 years ago

Add simulation to scriptable & add to tutorial; add sphinx index to ctrlsGUI; remove path from RunGSASII.bat

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1'''Sample script to demonstrate use of GSASIIscriptable to simulate a powder pattern
2
3This script is described in this tutorial:
4https://subversion.xray.aps.anl.gov/pyGSAS/Tutorials/PythonScript/Scripting.htm
5'''
6
7import os,sys
8sys.path.insert(0,'/Users/toby/software/G2/GSASII')
9import GSASIIscriptable as G2sc
10
11workdir = "/Users/toby/Scratch/PythonScript"
12datadir = "/Users/toby/software/G2/Tutorials/PythonScript/data"
13
14gpx = G2sc.G2Project(filename='PbSO4sim.gpx') # create a project
15
16# setup step 1: add a phase to the project
17phase0 = gpx.add_phase(os.path.join(datadir,"PbSO4-Wyckoff.cif"),
18                      phasename="PbSO4",fmthint='CIF')
19
20# setup step 2: add a simulated histogram and link it to the previous phase(s)
21hist1 = gpx.add_simulated_powder_histogram("PbSO4 simulation",
22                          os.path.join(datadir,"inst_d1a.prm"),
23                          5.,120.,0.01,
24                          phases=gpx.phases())
25gpx.data['Controls']['data']['max cyc'] = 0 # refinement not needed
26gpx.do_refinements([{}])
27gpx.save()
28
29
30
Note: See TracBrowser for help on using the repository browser.