From d2b85b8d0945c9e3e37e31ea5d1378e99e0adc0a Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 25 Feb 2016 10:43:29 +0000 Subject: [PATCH] Added a check to ensure there are receivers in the specified output file. --- tools/plot_Ascan.py | 4 ++++ tools/plot_Bscan.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tools/plot_Ascan.py b/tools/plot_Ascan.py index fdffae49..ca7d3ebe 100644 --- a/tools/plot_Ascan.py +++ b/tools/plot_Ascan.py @@ -43,6 +43,10 @@ iterations = f.attrs['Iterations'] time = np.linspace(0, 1, iterations) time *= (iterations * dt) +# Check there are any receivers +if nrx == 0: + raise CmdInputError('No receivers found in {}'.format(file)) + # Check for single output component when doing a FFT if args.fft: if not len(args.outputs) == 1: diff --git a/tools/plot_Bscan.py b/tools/plot_Bscan.py index 34d6cd45..d854bb5e 100644 --- a/tools/plot_Bscan.py +++ b/tools/plot_Bscan.py @@ -35,6 +35,10 @@ args = parser.parse_args() f = h5py.File(args.outputfile, 'r') nrx = f.attrs['nrx'] +# Check there are any receivers +if nrx == 0: + raise CmdInputError('No receivers found in {}'.format(args.outputfile)) + for rx in range(1, nrx + 1): path = '/rxs/rx' + str(rx) + '/' availableoutputs = list(f[path].keys())