From 32ee1e53156d817ceb794fd568db374c61283989 Mon Sep 17 00:00:00 2001 From: craig-warren Date: Tue, 6 Oct 2015 09:58:27 +0100 Subject: [PATCH] Added warning of Anaconda/h5py bug for Win64 users. Added check when plotting B-scan that there is more than one A-scan present. --- tools/plot_hdf5_Bscan.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/plot_hdf5_Bscan.py b/tools/plot_hdf5_Bscan.py index b506b48b..5a0950e7 100644 --- a/tools/plot_hdf5_Bscan.py +++ b/tools/plot_hdf5_Bscan.py @@ -21,6 +21,8 @@ import h5py import numpy as np import matplotlib.pyplot as plt +from gprMax.exceptions import CmdInputError + """Plots B-scan.""" # Parse command line arguments @@ -36,6 +38,10 @@ path = '/rxs/rx1' f = h5py.File(file, 'r') data = f[path + '/' + field] +# Check that there is more than one A-scan present +if data.shape[1] == 1: + raise raise CmdInputError('{} contains only a single A-scan.'.format(file)) + # Plot B-scan image fig = plt.figure(num=file, figsize=(20, 10), facecolor='w', edgecolor='w') plt.imshow(data, extent=[0, data.shape[1], data.shape[0]*f.attrs['dt'], 0], interpolation='nearest', aspect='auto', cmap='seismic', vmin=-np.amax(np.abs(data)), vmax=np.amax(np.abs(data)))