diff --git a/splipy/Curve.py b/splipy/Curve.py index c381a7b..0e985a8 100644 --- a/splipy/Curve.py +++ b/splipy/Curve.py @@ -168,7 +168,7 @@ def binormal(self, t, above=True): return result / np.linalg.norm(result) # normalize - magnitude = np.apply_along_axis(np.linalg.norm, 1, result) + magnitude = np.linalg.norm(result, axis=1) magnitude = magnitude.reshape(-1,1) return result / magnitude @@ -224,9 +224,9 @@ def curvature(self, t, above=True): magnitude = np.abs(w) else: # for 3D, it is vectors - magnitude = np.apply_along_axis(np.linalg.norm, -1, w) + magnitude = np.linalg.norm( w, axis= -1) - speed = np.apply_along_axis(np.linalg.norm, -1, v) + speed = np.linalg.norm( v, axis=-1) return magnitude / np.power(speed,3) @@ -261,7 +261,7 @@ def torsion(self, t, above=True): magnitude = np.linalg.norm(w) nominator = np.dot(w, a) else: # multiple evaluation points - magnitude = np.apply_along_axis(np.linalg.norm, -1, w) + magnitude = np.linalg.norm( w, axis=-1) nominator = np.array([np.dot(w1,da1) for (w1,da1) in zip(w, da)]) return nominator / np.power(magnitude, 2) diff --git a/splipy/SplineObject.py b/splipy/SplineObject.py index 2aabfdc..4e25c9a 100644 --- a/splipy/SplineObject.py +++ b/splipy/SplineObject.py @@ -339,7 +339,7 @@ def tangent(self, *params, **kwargs): if len(v.shape)==1: speed = np.linalg.norm(v) else: - speed = np.apply_along_axis(np.linalg.norm, -1, v) + speed = np.linalg.norm( v, axis=-1) speed = np.reshape(speed, speed.shape +(1,)) # store in result tuple result += (v/speed,) @@ -354,7 +354,7 @@ def tangent(self, *params, **kwargs): if len(v.shape)==1: speed = np.linalg.norm(v) else: - speed = np.apply_along_axis(np.linalg.norm, -1, v) + speed = np.linalg.norm( v, axis=-1) speed = np.reshape(speed, speed.shape +(1,)) return v / speed diff --git a/splipy/Surface.py b/splipy/Surface.py index ccb9459..012353e 100644 --- a/splipy/Surface.py +++ b/splipy/Surface.py @@ -80,7 +80,7 @@ def normal(self, u, v, above=(True,True), tensor=True): # normalize output if len(du.shape) == 1: return normals / np.linalg.norm(normals) - magnitude = np.apply_along_axis(np.linalg.norm, -1, normals) + magnitude = np.linalg.norm( normals, axis=-1) magnitude = magnitude.reshape(magnitude.shape + (1,)) return normals / magnitude else: