aboutsummaryrefslogtreecommitdiff
path: root/scripts/crystal-frame-number
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/crystal-frame-number
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/crystal-frame-number')
-rwxr-xr-xscripts/crystal-frame-number13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/crystal-frame-number b/scripts/crystal-frame-number
index b3ed3f1f..883abb81 100755
--- a/scripts/crystal-frame-number
+++ b/scripts/crystal-frame-number
@@ -1,6 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-
+#
+# Show sequence numbers of crystals and frames
+#
+# Copyright © 2015-2017 Deutsches Elektronen-Synchrotron DESY,
+# a research centre of the Helmholtz Association.
+#
+# Author:
+# 2015-2017 Thomas White <taw@physics.org>
import sys
@@ -16,9 +23,9 @@ while True:
if fline.find("Image filename") != -1:
frame_number += 1
fn = fline.split(': ')[1].split(' ')[0].rstrip("\r\n")
- print 'Frame %i: %s' % (frame_number, fn)
+ print('Frame {}: {}'.format(frame_number, fn))
if fline.find("diffraction_resolution_limit") != -1:
crystal_number += 1
- print ' Crystal %i: %s' % (crystal_number, fline.rstrip("\r\n"))
+ print(' Crystal {}: {}'.format(crystal_number, fline.rstrip("\r\n")))
f.close()