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)))