本文整理汇总了Python中numpy.ma.arctan2方法的典型用法代码示例。如果您正苦于以下问题:Python ma.arctan2方法的具体用法?Python ma.arctan2怎么用?Python ma.arctan2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.ma
的用法示例。
在下文中一共展示了ma.arctan2方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _angles_lengths
# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import arctan2 [as 别名]
def _angles_lengths(self, U, V, eps=1):
xy = self.ax.transData.transform(self.XY)
uv = np.hstack((U[:, np.newaxis], V[:, np.newaxis]))
xyp = self.ax.transData.transform(self.XY + eps * uv)
dxy = xyp - xy
angles = np.arctan2(dxy[:, 1], dxy[:, 0])
lengths = np.absolute(dxy[:, 0] + dxy[:, 1] * 1j) / eps
return angles, lengths
示例2: _angles_lengths
# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import arctan2 [as 别名]
def _angles_lengths(self, U, V, eps=1):
xy = self.ax.transData.transform(self.XY)
uv = np.column_stack((U, V))
xyp = self.ax.transData.transform(self.XY + eps * uv)
dxy = xyp - xy
angles = np.arctan2(dxy[:, 1], dxy[:, 0])
lengths = np.hypot(*dxy.T) / eps
return angles, lengths
示例3: cart2polar
# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import arctan2 [as 别名]
def cart2polar(x, y, degrees=True):
"""
Convert cartesian X and Y to polar RHO and THETA.
:param x: x cartesian coordinate
:param y: y cartesian coordinate
:param degrees: True = return theta in degrees, False = return theta in
radians. [default: True]
:return: r, theta
"""
rho = ma.sqrt(x ** 2 + y ** 2)
theta = ma.arctan2(y, x)
if degrees:
theta *= (180 / math.pi)
return rho, theta
示例4: _compare
# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import arctan2 [as 别名]
def _compare(self):
dy, dx = compare_slices(self._i, self._rng, operator=angle_diff)
self._derts[1:][central_slice(self._rng)] += np.concatenate((dy, dx))
self._derts[0] = ma.hypot(
ma.arctan2(*self.dy),
ma.arctan2(*self.dx),
)
self._derts[rim_mask(self._i.shape, rng)] = ma.masked
return self
# -----------------------------------------------------------------------------
# Functions
示例5: _angles_lengths
# 需要导入模块: from numpy import ma [as 别名]
# 或者: from numpy.ma import arctan2 [as 别名]
def _angles_lengths(self, U, V, eps=1):
xy = self.ax.transData.transform(self.XY)
uv = np.hstack((U[:, np.newaxis], V[:, np.newaxis]))
xyp = self.ax.transData.transform(self.XY + eps * uv)
dxy = xyp - xy
angles = np.arctan2(dxy[:, 1], dxy[:, 0])
lengths = np.hypot(*dxy.T) / eps
return angles, lengths