Why does averaging over vector values cause errors?
Change this:

import bumpy as np
a = np.array([1,2,3])
b = np.array([4,5,6])
vec_line = [a,b]

print(np.mean(vec_line, axis=0, keepdims=True)[:,None])
&gt;&gt;[[[2.5 3.5 4.5]]]
np.mean(vec_line, axis=0, keepdims=True)[:,None].shape
&gt;&gt;(1,1,3)


To this:

print(np.mean(vec_line, axis=0))
&gt;&gt;[2.5 3.5 4.5]
np.mean(vec_line, axis=0).shape
&gt;&gt;(3,)