-
Notifications
You must be signed in to change notification settings - Fork 0
/
autonxds
executable file
·73 lines (53 loc) · 2.36 KB
/
autonxds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
"""
########################################
# #
# Automagically integrate xfel data #
# #
########################################
Integrate X-FEL data using vanilla nXDS (http://nxds.mpimf-heidelberg.mpg.de/).
"""
import xds
from subprocess import call
import argparse
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("image1", type=str, help="Specify the first image in an XFEL dataset. Images must be enumerated with fixed width, zero padded integers __immediately__ prior to the file extension (/path/to/image/prefix00001.cbf).")
parser.add_argument("--xdsin", type=str, help="XDS.INP file with default parameters to use during integration. Some parameters are overridden during the process.", default=None)
parser.add_argument("--generate", action="store_true", help="Use the generate_XDS.INP to try to guess some sane nXDS.INP parameters.")
parser.add_argument("--align", action="store_true", help="Align the XPARM entries for consistent indexing.")
parser.add_argument("--serial", action="store_true", help="Use nxds rather than nxds_par.")
args = parser.parse_args()
dataset = xds.dataset(args.image1)
if args.generate:
xdsinp = dataset.generate_nxdsin()
else:
xdsinp = xds.nxdsinp()
if args.xdsin is not None:
overrides = xds.nxdsinp(args.xdsin)
xdsinp.update(overrides)
# -------------------------------------
# | RUN nXDS |
# -------------------------------------
with open('LISTIM', 'w') as out:
out.write('\n'.join(dataset.imlist))
xdsinp['JOB='] = " XYCORR INIT COLSPOT POWDER IDXREF"# INTEGRATE CORRECT"
xdsinp['IMAGE_LIST='] = "LISTIM"
xdsinp['IMAGE_DIRECTORY='] = dataset.dirname
xdsinp.write()
if args.serial:
call(['nxds'])
else:
call(['nxds_par'])
xparms = xds.xparm("XPARM.nXDS")
if args.align:
xparms.align_parms()
xparms.write("XPARM.nXDS")
xdsinp['JOB='] = " INTEGRATE CORRECT"
xdsinp.write()
if args.serial:
call(['nxds'])
else:
call(['nxds_par'])
if __name__=="__main__":
main()