From 30bd7b109c460ecb2be1f86022ab9f4b88593595 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Fri, 23 Jul 2021 10:33:25 +0300 Subject: [PATCH] [~] Refactor --- python/tasks/mlb_player.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/tasks/mlb_player.py b/python/tasks/mlb_player.py index 77e4f83..0c7451a 100644 --- a/python/tasks/mlb_player.py +++ b/python/tasks/mlb_player.py @@ -587,6 +587,8 @@ def kernel_7( for j in range(nB): vec = np.subtract(candB[j][:2], candA[i][:2]) norm = math.sqrt(vec[0] * vec[0] + vec[1] * vec[1]) + if norm < 1e-8: + raise ZeroDivisionError vec = np.divide(vec, norm) startend = zip(np.linspace(candA[i][0], candB[j][0], num=mid_num), @@ -1105,9 +1107,9 @@ def kernel_15( t8.frame_id, ) ) - plt.subplot(1, 2, 1) + matplotlib.pyplot.subplot(1, 2, 1) matplotlib.pyplot.imshow(t14) - plt.subplot(1, 2, 2) + matplotlib.pyplot.subplot(1, 2, 2) matplotlib.pyplot.imshow(t32['img_canvas']) t25 = os.path.join( t30,