本文整理匯總了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