当前位置: 首页>>代码示例>>Python>>正文


Python umath.equal方法代码示例

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


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

示例1: allclose

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import 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)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:ma.py

示例2: allequal

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import equal [as 别名]
def allequal (a, b, fill_value=1):
    """
        True if all entries of  a and b are equal, using
        fill_value as a truth value where either or both are masked.
    """
    m = mask_or(getmask(a), getmask(b))
    if m is nomask:
        x = filled(a)
        y = filled(b)
        d = umath.equal(x, y)
        return fromnumeric.alltrue(fromnumeric.ravel(d))
    elif fill_value:
        x = filled(a)
        y = filled(b)
        d = umath.equal(x, y)
        dm = array(d, mask=m, copy=0)
        return fromnumeric.alltrue(fromnumeric.ravel(filled(dm, 1)))
    else:
        return 0 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:21,代码来源:ma.py

示例3: sort

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import equal [as 别名]
def sort (x, axis = -1, fill_value=None):
    """If x does not have a mask, return a masked array formed from the
       result of numeric.sort(x, axis).
       Otherwise, fill x with fill_value. Sort it.
       Set a mask where the result is equal to fill_value.
       Note that this may have unintended consequences if the data contains the
       fill value at a non-masked site.

       If fill_value is not given the default fill value for x's type will be
       used.
    """
    if fill_value is None:
        fill_value = default_fill_value (x)
    d = filled(x, fill_value)
    s = fromnumeric.sort(d, axis)
    if getmask(x) is nomask:
        return masked_array(s)
    return masked_values(s, fill_value, copy=0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,代码来源:ma.py

示例4: mask_or

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import equal [as 别名]
def mask_or (m1, m2):
    """Logical or of the mask candidates m1 and m2, treating nomask as false.
       Result may equal m1 or m2 if the other is nomask.
     """
    if m1 is nomask: return make_mask(m2)
    if m2 is nomask: return make_mask(m1)
    if m1 is m2 and is_mask(m1): return m1
    return make_mask(umath.logical_or(m1, m2)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:10,代码来源:ma.py

示例5: __eq__

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import equal [as 别名]
def __eq__(self, other):
        return equal(self, other) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:ma.py

示例6: masked_object

# 需要导入模块: from numpy.core import umath [as 别名]
# 或者: from numpy.core.umath import equal [as 别名]
def masked_object (data, value, copy=1):
    "Create array masked where exactly data equal to value"
    d = filled(data, value)
    dm = make_mask(umath.equal(d, value), flag=1)
    return array(d, mask=dm, copy=copy, fill_value=value) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:ma.py


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