本文整理匯總了Python中numpy.core.umath.less_equal方法的典型用法代碼示例。如果您正苦於以下問題:Python umath.less_equal方法的具體用法?Python umath.less_equal怎麽用?Python umath.less_equal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.core.umath
的用法示例。
在下文中一共展示了umath.less_equal方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: allclose
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import less_equal [as 別名]
def allclose (a, b, fill_value=1, rtol=1.e-5, atol=1.e-8):
""" Returns true if all components of a and b are equal
subject to given tolerances.
If fill_value is 1, masked values considered equal.
If fill_value is 0, masked values considered unequal.
The relative error rtol should be positive and << 1.0
The absolute error atol comes into play for those elements
of b that are very small or zero; it says how small a must be also.
"""
m = mask_or(getmask(a), getmask(b))
d1 = filled(a)
d2 = filled(b)
x = filled(array(d1, copy=0, mask=m), fill_value).astype(float)
y = filled(array(d2, copy=0, mask=m), 1).astype(float)
d = umath.less_equal(umath.absolute(x-y), atol + rtol * umath.absolute(y))
return fromnumeric.alltrue(fromnumeric.ravel(d))
示例2: masked_values
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import less_equal [as 別名]
def masked_values (data, value, rtol=1.e-5, atol=1.e-8, copy=1):
"""
masked_values(data, value, rtol=1.e-5, atol=1.e-8)
Create a masked array; mask is nomask if possible.
If copy==0, and otherwise possible, result
may share data values with original array.
Let d = filled(data, value). Returns d
masked where abs(data-value)<= atol + rtol * abs(value)
if d is of a floating point type. Otherwise returns
masked_object(d, value, copy)
"""
abs = umath.absolute
d = filled(data, value)
if issubclass(d.dtype.type, numeric.floating):
m = umath.less_equal(abs(d-value), atol+rtol*abs(value))
m = make_mask(m, flag=1)
return array(d, mask = m, copy=copy,
fill_value=value)
else:
return masked_object(d, value, copy=copy)
示例3: __call__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import less_equal [as 別名]
def __call__ (self, x):
"Execute the call behavior."
return umath.less_equal (x, self.critical_value)
示例4: __le__
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import less_equal [as 別名]
def __le__(self, other):
return less_equal(self, other)
示例5: masked_less_equal
# 需要導入模塊: from numpy.core import umath [as 別名]
# 或者: from numpy.core.umath import less_equal [as 別名]
def masked_less_equal(x, value, copy=1):
"masked_less_equal(x, value) = x masked where x <= value"
return masked_where(less_equal(x, value), x, copy)