source: Tutorials/PythonScript/data/example.sh @ 4946

Last change on this file since 4946 was 4946, checked in by vondreele, 12 months ago

delete 2dtexture - will be rebuilt

  • Property svn:mime-type set to text/html
File size: 2.0 KB
Line 
1# example script that uses sh to run a GSAS-II script
2datadir="/Users/toby/software/G2/Tutorials/PythonScript/data"
3gsaspath="/Users/toby/GSASII"
4python $gsaspath/GSASIIscriptable.py create test.gpx
5python $gsaspath/GSASIIscriptable.py add test.gpx \
6    -d $datadir/PBSO4.XRA $datadir/PBSO4.CWN -i $datadir/INST_XRY.PRM $datadir/inst_d1a.prm -hf GSAS \
7    -p $datadir/PbSO4-Wyckoff.cif -pf CIF -l 0 1
8cat > example.json <<EOF
9{"refinements": 
10  [
11    {"skip":true, "call":"SetParams"},
12    { "set": {"Background": {"no. coeffs": 3, "refine": true}}, 
13      "call":"HistStats", "output": "step4.gpx"}, 
14    { "set": {"Cell": true}, "call":"HistStats", "output": "step5.gpx"}, 
15    { "set": {"HStrain": true}, 
16      "histograms": [0], "phases": [0], "call":"HistStats", "output": "step6.gpx"}, 
17    { "set": {"Mustrain": {"type": "isotropic", "refine": true}, 
18             "Size": {"type": "isotropic", "refine": true}}, 
19      "histograms": [0], "call":"HistStats", "output": "step7.gpx"}, 
20    { "set": {"Sample Parameters": ["Shift"]}, 
21      "histograms": [0], "skip": true}, 
22    { "set": {"Atoms": {"all": "XU"}, 
23             "Sample Parameters": ["DisplaceX", "DisplaceY"]}, 
24      "histograms": [1], "call":"HistStats", "output": "step8.gpx"}, 
25    { "set": {"Limits": [16.0, 158.4]}, 
26      "histograms": [0], "skip": true}, 
27    { "set": {"Limits": [19.0, 153.0]}, 
28      "histograms": [1], "skip": true}, 
29    { "set": {"Instrument Parameters": ["U", "V", "W"]}, 
30      "call":"HistStats", "output": "step9.gpx"}
31  ],
32"code":
33  ["global HistStats",
34   "def HistStats(gpx):",
35   "    '''prints profile rfactors for all histograms'''",
36   "    print(u'*** profile Rwp, '+os.path.split(gpx.filename)[1])",
37   "    for hist in gpx.histograms():",
38   "        print('\t{:20s}: {:.2f}'.format(hist.name,hist.get_wR()))",
39   "    print()",
40   "proj.data['Controls']['data']['max cyc'] = 8 # not in API",
41   "proj.histogram(1).data['Sample Parameters']['Gonio. radius'] = 650. # not in API"
42  ]
43}
44EOF
45python $gsaspath/GSASIIscriptable.py refine test.gpx example.json
Note: See TracBrowser for help on using the repository browser.