本文整理匯總了Python中numpy.lib.ufunclike.isposinf方法的典型用法代碼示例。如果您正苦於以下問題:Python ufunclike.isposinf方法的具體用法?Python ufunclike.isposinf怎麽用?Python ufunclike.isposinf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.lib.ufunclike
的用法示例。
在下文中一共展示了ufunclike.isposinf方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_scalar
# 需要導入模塊: from numpy.lib import ufunclike [as 別名]
# 或者: from numpy.lib.ufunclike import isposinf [as 別名]
def test_scalar(self):
x = np.inf
actual = np.isposinf(x)
expected = np.True_
assert_equal(actual, expected)
assert_equal(type(actual), type(expected))
x = -3.4
actual = np.fix(x)
expected = np.float64(-3.0)
assert_equal(actual, expected)
assert_equal(type(actual), type(expected))
out = np.array(0.0)
actual = np.fix(x, out=out)
assert_(actual is out)
示例2: test_isposinf
# 需要導入模塊: from numpy.lib import ufunclike [as 別名]
# 或者: from numpy.lib.ufunclike import isposinf [as 別名]
def test_isposinf(self):
a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0])
out = nx.zeros(a.shape, bool)
tgt = nx.array([True, False, False, False, False, False])
res = ufl.isposinf(a)
assert_equal(res, tgt)
res = ufl.isposinf(a, out)
assert_equal(res, tgt)
assert_equal(out, tgt)
a = a.astype(np.complex)
with assert_raises(TypeError):
ufl.isposinf(a)
示例3: test_deprecated
# 需要導入模塊: from numpy.lib import ufunclike [as 別名]
# 或者: from numpy.lib.ufunclike import isposinf [as 別名]
def test_deprecated(self):
# NumPy 1.13.0, 2017-04-26
assert_warns(DeprecationWarning, ufl.fix, [1, 2], y=nx.empty(2))
assert_warns(DeprecationWarning, ufl.isposinf, [1, 2], y=nx.empty(2))
assert_warns(DeprecationWarning, ufl.isneginf, [1, 2], y=nx.empty(2))
示例4: test_isposinf
# 需要導入模塊: from numpy.lib import ufunclike [as 別名]
# 或者: from numpy.lib.ufunclike import isposinf [as 別名]
def test_isposinf(self):
a = nx.array([nx.inf, -nx.inf, nx.nan, 0.0, 3.0, -3.0])
out = nx.zeros(a.shape, bool)
tgt = nx.array([True, False, False, False, False, False])
res = ufl.isposinf(a)
assert_equal(res, tgt)
res = ufl.isposinf(a, out)
assert_equal(res, tgt)
assert_equal(out, tgt)