Changed sys.exit to gprMax GeneralError.

这个提交包含在:
Craig Warren
2016-08-04 15:57:17 +01:00
父节点 98b51d6c2e
当前提交 3c03ebbd36

查看文件

@@ -13,6 +13,8 @@ import matplotlib.pyplot as plt
np.seterr(divide='ignore') np.seterr(divide='ignore')
from gprMax.exceptions import GeneralError
"""This module contains fitness metric functions that can be used with the Taguchi optimisation method. """This module contains fitness metric functions that can be used with the Taguchi optimisation method.
All fitness functions must take two arguments and return a single fitness value. All fitness functions must take two arguments and return a single fitness value.
@@ -326,13 +328,13 @@ def peakdet(v, delta, x = None):
v = np.asarray(v) v = np.asarray(v)
if len(v) != len(x): if len(v) != len(x):
sys.exit('Input vectors v and x must have same length') raise GeneralError('Input vectors v and x must have same length')
if not np.isscalar(delta): if not np.isscalar(delta):
sys.exit('Input argument delta must be a scalar') raise GeneralError('Input argument delta must be a scalar')
if delta <= 0: if delta <= 0:
sys.exit('Input argument delta must be positive') raise GeneralError('Input argument delta must be positive')
mn, mx = np.Inf, -np.Inf mn, mx = np.Inf, -np.Inf
mnpos, mxpos = np.NaN, np.NaN mnpos, mxpos = np.NaN, np.NaN