aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-08-24 16:24:48 +0200
committerThomas White <taw@physics.org>2022-08-24 16:24:48 +0200
commit66e84c89ac4e5f99fac08d38cc0fa4a04d770aa5 (patch)
tree79f7ca6e0e0639c040bc8779a9420bb4727794f5 /scripts
parentcdcb96528b869fee86ac5531dbb45fdf726045b1 (diff)
scripts/peakogram-stream: Better handling of multiple streams
This allows the "-i" option to be given multiple times, instead of having to concatenate the streams via stdin.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/peakogram-stream15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/peakogram-stream b/scripts/peakogram-stream
index 2785d2cf..9e921adc 100755
--- a/scripts/peakogram-stream
+++ b/scripts/peakogram-stream
@@ -64,7 +64,7 @@ def resolution(scell, shkl):
parser = argparse.ArgumentParser()
-parser.add_argument("-i", default="my.stream", help="stream filename")
+parser.add_argument("-i", action="append", required=True, help="stream filename")
parser.add_argument("-l", action="store_true", help="log scale y-axis")
parser.add_argument("--rmin", type=float, help="minimum resolution cutoff (1/d in Angstroms^-1)")
parser.add_argument("--rmax", type=float, help="maximum resolution cutoff (1/d in Angstroms^-1)")
@@ -79,12 +79,13 @@ n=0
in_list = 0
cell = []
-if args.i == "-":
- f = sys.stdin
-else:
- f = open(args.i)
+for file in args.i:
+
+ if file == "-":
+ f = sys.stdin
+ else:
+ f = open(file)
-if f:
for line in f:
if line.find("Cell parameters") != -1:
@@ -120,6 +121,8 @@ if f:
if n >= args.nmax:
break
+ f.close()
+
data = np.asarray(data,dtype=float)