本文整理汇总了Python中numpy.sometrue方法的典型用法代码示例。如果您正苦于以下问题:Python numpy.sometrue方法的具体用法?Python numpy.sometrue怎么用?Python numpy.sometrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy
的用法示例。
在下文中一共展示了numpy.sometrue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _classify
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import sometrue [as 别名]
def _classify(self):
if self.dimension == 2:
print "Use fixedpoint_2D class"
real_evals = (isreal(self.evals[0]), isreal(self.evals[1]))
equal_evals = abs(self.evals[0] - self.evals[1]) < self.eps
zero_evals = (abs(self.evals[0]) < self.eps,
abs(self.evals[1]) < self.eps)
## if alltrue(real_evals):
## sign_evals = (sign(self.evals[0]), sign(self.evals[1]))
## if sign_evals[0] == sign_evals[1]:
## self.classification = 'node-like'
## else:
## self.classification = 'saddle-like'
## else:
## self.classification = 'spiral-like'
real_parts = real(self.evals)
if alltrue(real_parts<0):
self.stability = 's'
elif alltrue(real_parts==0):
self.stability = 'c'
else:
self.stability = 'u'
self.degenerate = sometrue(zero_evals) or equal_evals
示例2: test_nd
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import sometrue [as 别名]
def test_nd(self):
y1 = [[0, 0, 0], [0, 1, 0], [1, 1, 0]]
assert_(np.any(y1))
assert_array_equal(np.sometrue(y1, axis=0), [1, 1, 0])
assert_array_equal(np.sometrue(y1, axis=1), [0, 1, 1])
示例3: test_fail
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import sometrue [as 别名]
def test_fail(self):
z = np.array([-1, 0, 1])
res = iscomplex(z)
assert_(not np.sometrue(res, axis=0))
示例4: sometrue
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import sometrue [as 别名]
def sometrue(array, axis=0):
return np.sometrue(array, axis)
#clipmode is ignored if axis is not an integer
示例5: sometrue
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import sometrue [as 别名]
def sometrue(x, axis=0):
return np.sometrue(x, axis)
示例6: proj_transform_vec_clip
# 需要导入模块: import numpy [as 别名]
# 或者: from numpy import sometrue [as 别名]
def proj_transform_vec_clip(vec, M):
vecw = np.dot(M, vec)
w = vecw[3]
# clip here..
txs, tys, tzs = vecw[0]/w, vecw[1]/w, vecw[2]/w
tis = (vecw[0] >= 0) * (vecw[0] <= 1) * (vecw[1] >= 0) * (vecw[1] <= 1)
if np.sometrue(tis):
tis = vecw[1] < 1
return txs, tys, tzs, tis