• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python umath.arctan2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中numpy.core.umath.arctan2函数的典型用法代码示例。如果您正苦于以下问题:Python arctan2函数的具体用法?Python arctan2怎么用?Python arctan2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了arctan2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_distance

def get_distance(locA, locB):
    # use haversine forumla
    print "ayyo"
    earth_rad = 6371.0
    dlat = deg2rad(locB[0] - locA[0])
    dlon = deg2rad(locB[1] - locA[1])
    a = sin(dlat / 2) * sin(dlat / 2) + \
        cos(deg2rad(locA[0])) * cos(deg2rad(locB[0])) * \
        sin(dlon / 2) * sin(dlon / 2)
    c = 2 * arctan2(sqrt(a), sqrt(1 - a))
    return earth_rad * c
开发者ID:dotslash,项目名称:Projects,代码行数:11,代码来源:dist_cities.py


示例2: angle

def angle(z, deg=0):
    """Return the angle of the complex argument z.
    """
    if deg:
        fact = 180/pi
    else:
        fact = 1.0
    z = asarray(z)
    if (issubclass(z.dtype.type, _nx.complexfloating)):
        zimag = z.imag
        zreal = z.real
    else:
        zimag = 0
        zreal = z
    return arctan2(zimag, zreal) * fact
开发者ID:ruschecker,项目名称:DrugDiscovery-Home,代码行数:15,代码来源:function_base.py


示例3: test_zero_negative

 def test_zero_negative(self):
     # atan2(+-0, x) returns +-pi for x < 0.
     assert_almost_equal(ncu.arctan2(np.PZERO, -1), np.pi)
     assert_almost_equal(ncu.arctan2(np.NZERO, -1), -np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例4: test_zero_nzero

 def test_zero_nzero(self):
     # atan2(+-0, -0) returns +-pi.
     assert_almost_equal(ncu.arctan2(np.PZERO, np.NZERO), np.pi)
     assert_almost_equal(ncu.arctan2(np.NZERO, np.NZERO), -np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例5: test_one_one

 def test_one_one(self):
     # atan2(1, 1) returns pi/4.
     assert_almost_equal(ncu.arctan2(1, 1), 0.25 * np.pi)
     assert_almost_equal(ncu.arctan2(-1, 1), -0.25 * np.pi)
     assert_almost_equal(ncu.arctan2(1, -1), 0.75 * np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:5,代码来源:test_umath.py


示例6: assert_arctan2_isnzero

def assert_arctan2_isnzero(x, y):
    assert_(
        (ncu.arctan2(x, y) == 0 and np.signbit(ncu.arctan2(x, y))),
        "arctan(%s, %s) is %s, not -0" % (x, y, ncu.arctan2(x, y)),
    )
开发者ID:jarrodmillman,项目名称:numpy,代码行数:5,代码来源:test_umath.py


示例7: getAngleToNegativeXAxis

 def getAngleToNegativeXAxis(self):
     rad = arctan2( self[1], self[0]);
     deg = (rad/pi)*180.0 + 180.0;
     return deg
开发者ID:specpose,项目名称:stopeight,代码行数:4,代码来源:vectorTools.py


示例8: test_inf_ninf

 def test_inf_ninf(self):
     # atan2(+-infinity, -infinity) returns +-3*pi/4.
     assert_almost_equal(ncu.arctan2(np.inf, -np.inf), 0.75 * np.pi)
     assert_almost_equal(ncu.arctan2(-np.inf, -np.inf), -0.75 * np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例9: test_any_ninf

 def test_any_ninf(self):
     # atan2(+-y, -infinity) returns +-pi for finite y > 0.
     assert_almost_equal(ncu.arctan2(1, np.NINF), np.pi)
     assert_almost_equal(ncu.arctan2(-1, np.NINF), -np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例10: assert_arctan2_ispzero

def assert_arctan2_ispzero(x, y):
    assert (ncu.arctan2(x, y) == 0 and not np.signbit(ncu.arctan2(x, y))), "arctan(%s, %s) is %s, not +0" % (x, y, ncu.arctan2(x, y))
开发者ID:8cH9azbsFifZ,项目名称:wspr,代码行数:2,代码来源:test_umath.py


示例11: assert_arctan2_isnzero

 def assert_arctan2_isnzero(x, y):
     assert ncu.arctan2(x, y) == 0 and np.signbit(ncu.arctan2(x, y))
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:2,代码来源:test_umath.py


示例12: assert_arctan2_isninf

 def assert_arctan2_isninf(x, y):
     assert np.isinf(ncu.arctan2(x, y)) and ncu.arctan2(x, y) < 0
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:2,代码来源:test_umath.py


示例13: assert_arctan2_isnan

 def assert_arctan2_isnan(x, y):
     assert np.isnan(ncu.arctan2(x, y))
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:2,代码来源:test_umath.py


示例14: test_arctan2_special_values

def test_arctan2_special_values():
    def assert_arctan2_isnan(x, y):
        assert np.isnan(ncu.arctan2(x, y))

    def assert_arctan2_ispinf(x, y):
        assert np.isinf(ncu.arctan2(x, y)) and ncu.arctan2(x, y) > 0

    def assert_arctan2_isninf(x, y):
        assert np.isinf(ncu.arctan2(x, y)) and ncu.arctan2(x, y) < 0

    def assert_arctan2_ispzero(x, y):
        assert ncu.arctan2(x, y) == 0 and not np.signbit(ncu.arctan2(x, y))

    def assert_arctan2_isnzero(x, y):
        assert ncu.arctan2(x, y) == 0 and np.signbit(ncu.arctan2(x, y))

    # atan2(1, 1) returns pi/4.
    yield assert_almost_equal,  ncu.arctan2(1, 1), 0.25 * np.pi
    yield assert_almost_equal,  ncu.arctan2(-1, 1), -0.25 * np.pi
    yield assert_almost_equal,  ncu.arctan2(1, -1), 0.75 * np.pi

    # atan2(+-0, -0) returns +-pi.
    yield assert_almost_equal,  ncu.arctan2(np.PZERO, np.NZERO), np.pi
    yield assert_almost_equal,  ncu.arctan2(np.NZERO, np.NZERO), -np.pi
    # atan2(+-0, +0) returns +-0.
    yield assert_arctan2_ispzero,  np.PZERO, np.PZERO
    yield assert_arctan2_isnzero,  np.NZERO, np.PZERO

    # atan2(+-0, x) returns +-pi for x < 0.
    yield assert_almost_equal,  ncu.arctan2(np.PZERO, -1), np.pi
    yield assert_almost_equal,  ncu.arctan2(np.NZERO, -1), -np.pi

   # atan2(+-0, x) returns +-0 for x > 0.
    yield assert_arctan2_ispzero,  np.PZERO, 1
    yield assert_arctan2_isnzero,  np.NZERO, 1

   # atan2(y, +-0) returns +pi/2 for y > 0.
    yield assert_almost_equal,  ncu.arctan2(1, np.PZERO), 0.5 * np.pi
    yield assert_almost_equal,  ncu.arctan2(1, np.NZERO), 0.5 * np.pi

   # atan2(y, +-0) returns -pi/2 for y < 0.
    yield assert_almost_equal,  ncu.arctan2(-1, np.PZERO), -0.5 * np.pi
    yield assert_almost_equal,  ncu.arctan2(-1, np.NZERO), -0.5 * np.pi

   # atan2(+-y, -infinity) returns +-pi for finite y > 0.
    yield assert_almost_equal,  ncu.arctan2(1, np.NINF),  np.pi
    yield assert_almost_equal,  ncu.arctan2(-1, np.NINF), -np.pi

   # atan2(+-y, +infinity) returns +-0 for finite y > 0.
    yield assert_arctan2_ispzero,  1, np.inf
    yield assert_arctan2_isnzero, -1, np.inf

   # atan2(+-infinity, x) returns +-pi/2 for finite x.
    yield assert_almost_equal, ncu.arctan2( np.inf, 1),  0.5 * np.pi
    yield assert_almost_equal, ncu.arctan2(-np.inf, 1), -0.5 * np.pi

   # atan2(+-infinity, -infinity) returns +-3*pi/4.
    yield assert_almost_equal, ncu.arctan2( np.inf, -np.inf),  0.75 * np.pi
    yield assert_almost_equal, ncu.arctan2(-np.inf, -np.inf), -0.75 * np.pi

   # atan2(+-infinity, +infinity) returns +-pi/4.
    yield assert_almost_equal, ncu.arctan2( np.inf, np.inf),  0.25 * np.pi
    yield assert_almost_equal, ncu.arctan2(-np.inf, np.inf), -0.25 * np.pi

   # atan2(nan, x) returns nan for any x, including inf
    yield assert_arctan2_isnan, np.nan, np.inf
    yield assert_arctan2_isnan, np.inf, np.nan
    yield assert_arctan2_isnan, np.nan, np.nan
开发者ID:GunioRobot,项目名称:numpy-refactor,代码行数:68,代码来源:test_umath.py


示例15: test_positive_zero

 def test_positive_zero(self):
     # atan2(y, +-0) returns +pi/2 for y > 0.
     assert_almost_equal(ncu.arctan2(1, np.PZERO), 0.5 * np.pi)
     assert_almost_equal(ncu.arctan2(1, np.NZERO), 0.5 * np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例16: test_negative_zero

 def test_negative_zero(self):
     # atan2(y, +-0) returns -pi/2 for y < 0.
     assert_almost_equal(ncu.arctan2(-1, np.PZERO), -0.5 * np.pi)
     assert_almost_equal(ncu.arctan2(-1, np.NZERO), -0.5 * np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例17: assert_arctan2_ispinf

def assert_arctan2_ispinf(x, y):
    assert_((np.isinf(ncu.arctan2(x, y)) and ncu.arctan2(x, y) > 0), "arctan(%s, %s) is %s, not +inf" % (x, y, ncu.arctan2(x, y)))
开发者ID:Fematich,项目名称:article_browser,代码行数:2,代码来源:test_umath.py


示例18: test_inf_any

 def test_inf_any(self):
     # atan2(+-infinity, x) returns +-pi/2 for finite x.
     assert_almost_equal(ncu.arctan2(np.inf, 1), 0.5 * np.pi)
     assert_almost_equal(ncu.arctan2(-np.inf, 1), -0.5 * np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py


示例19: assert_arctan2_isnan

def assert_arctan2_isnan(x, y):
    assert_(np.isnan(ncu.arctan2(x, y)), "arctan(%s, %s) is %s, not nan" % (x, y, ncu.arctan2(x, y)))
开发者ID:jarrodmillman,项目名称:numpy,代码行数:2,代码来源:test_umath.py


示例20: test_inf_pinf

 def test_inf_pinf(self):
     # atan2(+-infinity, +infinity) returns +-pi/4.
     assert_almost_equal(ncu.arctan2(np.inf, np.inf), 0.25 * np.pi)
     assert_almost_equal(ncu.arctan2(-np.inf, np.inf), -0.25 * np.pi)
开发者ID:jarrodmillman,项目名称:numpy,代码行数:4,代码来源:test_umath.py



注:本文中的numpy.core.umath.arctan2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python umath.exp函数代码示例发布时间:2022-05-27
下一篇:
Python numerictypes.issubdtype函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap