Python numpy.core.umath.less() Examples

The following are 7 code examples of numpy.core.umath.less(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module numpy.core.umath , or try the search function .
Example #1
Source File: ma.py    From Computable with MIT License 6 votes vote down vote up
def power (a, b, third=None):
    "a**b"
    if third is not None:
        raise MAError("3-argument power not supported.")
    ma = getmask(a)
    mb = getmask(b)
    m = mask_or(ma, mb)
    fa = filled(a, 1)
    fb = filled(b, 1)
    if fb.dtype.char in typecodes["Integer"]:
        return masked_array(umath.power(fa, fb), m)
    md = make_mask(umath.less(fa, 0), flag=1)
    m = mask_or(m, md)
    if m is nomask:
        return masked_array(umath.power(fa, fb))
    else:
        fa = numeric.where(m, 1, fa)
        return masked_array(umath.power(fa, fb), m) 
Example #2
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __call__ (self, x):
        "Execute the call behavior."
        return umath.logical_or(umath.greater (x, self.y2),
                                   umath.less(x, self.y1)
                                  ) 
Example #3
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __call__ (self, x):
        "Execute the call behavior."
        return umath.less(umath.absolute(umath.cos(x)), self.eps) 
Example #4
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __call__ (self, x):
        "Execute the call behavior."
        return umath.less (x, self.critical_value) 
Example #5
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __lt__(self, other):
        return less(self, other) 
Example #6
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def masked_outside(x, v1, v2, copy=1):
    """x with mask of all values of x that are outside [v1,v2]
       v1 and v2 can be given in either order.
    """
    if v2 < v1:
        t = v2
        v2 = v1
        v1 = t
    d = filled(x, 0)
    c = umath.logical_or(umath.less(d, v1), umath.greater(d, v2))
    m = mask_or(c, getmask(x))
    return array(d, mask = m, copy=copy) 
Example #7
Source File: ma.py    From Computable with MIT License 5 votes vote down vote up
def __call__ (self, a, b=None):
        "Execute the call behavior."
        if b is None:
            m = getmask(a)
            if m is nomask:
                d = amin(filled(a).ravel())
                return d
            ac = a.compressed()
            if len(ac) == 0:
                return masked
            else:
                return amin(ac.raw_data())
        else:
            return where(less(a, b), a, b)