From b88b72ec76bc18c4291534519d8025bdb61c0c4b Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Wed, 13 Jan 2016 13:10:37 +0000 Subject: [PATCH] Added some checks for waveform type and frequency. --- tools/plot_builtin_wave.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/plot_builtin_wave.py b/tools/plot_builtin_wave.py index 1fe8c995..20c2a49c 100644 --- a/tools/plot_builtin_wave.py +++ b/tools/plot_builtin_wave.py @@ -20,6 +20,7 @@ import os, argparse import numpy as np import matplotlib.pyplot as plt +from gprMax.exceptions import CmdInputError from gprMax.waveforms import Waveform @@ -35,6 +36,12 @@ parser.add_argument('dt', type=float, help='time step to view waveform') parser.add_argument('-fft', action='store_true', default=False, help='plot FFT') args = parser.parse_args() +# Check waveform parameters +if args.type.lower() not in Waveform.waveformtypes: + raise CmdInputError('The waveform must have one of the following types {}'.format(','.join(Waveform.waveformtypes))) +if args.freq <= 0: + raise CmdInputError('The waveform requires an excitation frequency value of greater than zero') + w = Waveform() w.type = args.type w.amp = args.amp