aboutsummaryrefslogtreecommitdiff
path: root/scripts/move-entire-detector
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-05-12 15:51:33 +0200
committerThomas White <taw@physics.org>2017-05-12 15:51:33 +0200
commit690666e32643302970b1f54bbaa0efe83aac7e86 (patch)
treecd4e9b32b46160649a1fa4f5c1786b1cbf614356 /scripts/move-entire-detector
parent4227f0b190b08ecc50a49875e86dbb9b14714bdd (diff)
Make all Python scripts compatible with Python 2 and 3
It would be nice to upgrade completely to Python 3, but this may create problems at SLAC because psana only supports Python 2 (Python 3 is available, but means that users have to jump through hoops to run a simple CrystFEL script). None of our scripts do anything complicated, so they can all be compatible with both so far. If anyone adds a script which requires a particular version, make sure to specify the version in the first line, consistent with PEP 394.
Diffstat (limited to 'scripts/move-entire-detector')
-rwxr-xr-xscripts/move-entire-detector16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/move-entire-detector b/scripts/move-entire-detector
index 79ce5a5c..3d06c408 100755
--- a/scripts/move-entire-detector
+++ b/scripts/move-entire-detector
@@ -1,13 +1,13 @@
#!/usr/bin/env python
-
+# -*- coding: utf-8 -*-
#
# Shift the detector by a given amount
#
-# Copyright (c) 2016 Deutsches Elektronen-Synchrotron DESY,
-# a research centre of the Helmholtz Association.
+# Copyright © 2016-2017 Deutsches Elektronen-Synchrotron DESY,
+# a research centre of the Helmholtz Association.
#
# Author:
-# 2016 Thomas White <taw@physics.org>
+# 2016-2017 Thomas White <taw@physics.org>
#
import sys
@@ -58,8 +58,8 @@ if args.beam:
else:
bm = 'detector'
-print 'Input filename %s\nOutput filename %s' % (args.ifn,out)
-print 'Shifting %s by %f,%f %s' % (bm, args.xshift, args.yshift, units)
+print('Input filename {}\nOutput filename {}'.format(args.ifn,out))
+print('Shifting {} by {},{} {}'.format(bm, args.xshift, args.yshift, units))
if args.beam:
args.xshift = -args.xshift
@@ -104,7 +104,7 @@ while True:
else:
res = default_res
if not args.px:
- print 'Using default resolution (%f px/m) for panel %s' % (res, panel)
+ print('Using default resolution ({} px/m) for panel {}'.format(res, panel))
if args.px:
h.write('%s/corner_x = %f\n' % (panel,panel_cnx+args.xshift))
else:
@@ -120,7 +120,7 @@ while True:
else:
res = default_res
if not args.px:
- print 'Using default resolution (%f px/m) for panel %s' % (res, panel)
+ print('Using default resolution ({} px/m) for panel {}'.format(res, panel))
if args.px:
h.write('%s/corner_y = %f\n' % (panel,panel_cny+args.yshift))
else: