From 66e84c89ac4e5f99fac08d38cc0fa4a04d770aa5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 24 Aug 2022 16:24:48 +0200 Subject: 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. --- scripts/peakogram-stream | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'scripts') 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) -- cgit v1.2.3