source: Examples/scripts/python/myscript.py

Last change on this file was 3028, checked in by odonnell, 6 years ago

example scripts

  • Property svn:executable set to *
File size: 843 bytes
Line 
1#!/usr/bin/env python
2
3
4import os
5import json
6import sys
7import GSASIIscriptable as G2sc
8
9
10datafile = sys.argv[1]
11database, dataname = os.path.split(datafile)
12if len(sys.argv) > 2:
13    projname = sys.argv[2]
14else:
15    projname = os.path.join('/home/odonnell/amno2_data_from_box/refinements/',
16                            dataname.replace('.chi', '.gpx'))
17
18instprms = '/home/odonnell/amno2_data_from_box/refined_box_data_100.instprm'
19phasefile = '/home/odonnell/amno2_data_from_box/smaller-with-oxygen.cif'
20refinementsfile = '/home/odonnell/amno2_data_from_box/alpha-mno2-new.json'
21
22proj = G2sc.G2Project(filename=projname)
23hist = proj.add_powder_histogram(datafile, instprms)
24phase = proj.add_phase(phasefile, histograms=[hist])
25
26with open(refinementsfile) as rf:
27    refs = json.load(rf)
28
29proj.do_refinements(refs['refinements'])
30proj.save()
Note: See TracBrowser for help on using the repository browser.