add try except

This commit is contained in:
Junzi Sun 2018-04-04 16:41:34 +02:00
parent e821b8fa77
commit f246c88dd6

View File

@ -80,8 +80,11 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
# since the covariance matrix is identity matrix,
# M-dist is same as eculidian distance
dist = np.linalg.norm(X-Mu, axis=1)
BDS = allbds[np.nanargmin(dist)]
try:
dist = np.linalg.norm(X-Mu, axis=1)
BDS = allbds[np.nanargmin(dist)]
except ValueError:
return None
return BDS