def vectorAngle(vec1,vec2):
if vec1.ndim == <NUM_LIT:1>:<EOL><INDENT>assert vec2.ndim == <NUM_LIT:3><EOL>vec1 = vectorToField(vec1, vec2.shape[:<NUM_LIT:2>])<EOL><DEDENT>if vec2.ndim == <NUM_LIT:1>:<EOL><INDENT>assert vec1.ndim == <NUM_LIT:3><EOL>vec2 = vectorToField(vec2, vec1.shape[<NUM_LIT:1>:])<EOL><DEDENT>a = np.arccos(<EOL>np.einsum('<STR_LIT>', vec1,vec2)<EOL>/( norm(vec1,axis=<NUM_LIT:0>) * norm(vec2,axis=<NUM_LIT:0>) ) )<EOL>ab = np.abs(np.pi-a)<EOL>with np.errstate(invalid='<STR_LIT:ignore>'):<EOL><INDENT>i = a>ab<EOL><DEDENT>a[i] = ab[i]<EOL>return a<EOL>
vector (x,y,z) or vector field of shape (3,x,y)