Return a ufunc-like tophat function on the defined range, left-exclusive
    and right-exclusive. Returns 1 if lower < x < upper, 0 otherwise.
514244
def make_tophat_ee (lower, upper):
    
    if not np.isfinite (lower):
        raise ValueError ('"lower" argument must be finite number; got %r' % lower)
    if not np.isfinite (upper):
        raise ValueError ('"upper" argument must be finite number; got %r' % upper)

    def range_tophat_ee (x):
        x = np.asarray (x)
        x1 = np.atleast_1d (x)
        r = ((lower < x1) & (x1 < upper)).astype (x.dtype)
        if x.ndim == 0:
            return np.asscalar (r)
        return r

    range_tophat_ee.__doc__ = ('Ranged tophat function, left-exclusive and '
                               'right-exclusive. Returns 1 if %g < x < %g, '
                               '0 otherwise.') % (lower, upper)
    return range_tophat_ee
1162933
def getTopLeft(self):
        
        return (float(self.get_cx()) - float(self.get_rx()), float(self.get_cy()) + float(self.get_ry()))
410184
def confine(x,low,high):
    ''''''

    y=x.copy()
    y[y < low] = low
    y[y > high] = high
    return y
107577
def unit_tophat_ee (x):
    
    x = np.asarray (x)
    x1 = np.atleast_1d (x)
    r = ((0 < x1) & (x1 < 1)).astype (x.dtype)
    if x.ndim == 0:
        return np.asscalar (r)
    return r
140093
function ( startX, startY, endX, endY ) {
        var gapH = Math.max( startX, endX ) - Math.min( startX, endX ),
            gapV = Math.max( startY, endY ) - Math.min( startY, endY );

        if ( gapH > gapV ) {
            return 'horizontal';
        } else if ( gapH < gapV ) {
            return 'vertical';
        } else {
            return 'none';
        }
    }
463923
function ensureUpperBound (range, maximum) {
  return function applyUpperBound (comparators) {
    var hasUpperBound = isBounded.comparators(comparators)
    if (hasUpperBound) return comparators
    var msg = printf(
      'Cannot determine major versions: ' +
      '"%s" is unbounded and ',
      range
    )
    if (maximum == null) {
      throw new Error(msg + 'no maximum was provided')
    }
    var upper = last(comparators)
    if (!upper.test(maximum)) {
      var explanation = printf('"%s" does not satisfy "%s"', maximum, upper.toString())
      throw new Error(msg + explanation)
    }
    return comparators.concat(new semver.Comparator('<=' + maximum))
  }
}
36785
def clamp(inclusive_lower_bound: int,
          inclusive_upper_bound: int,
          value: int) -> int:
    
    if value <= inclusive_lower_bound:
        return inclusive_lower_bound
    elif value >= inclusive_upper_bound:
        return inclusive_upper_bound
    else:
        return value
1144900
def prox_min(X, step, thresh=0):
    
    thresh_ = _step_gamma(step, thresh)
    below = X - thresh_ < 0
    X[below] = thresh_
    return X
111217
def _generate_limit_items(lower, upper):
    
    # Use value + 0 to convert any -0.0 to 0.0 which looks better.
    if lower is not None and upper is not None and lower == upper:
        yield 'fixed', upper + 0
    else:
        if lower is not None:
            yield 'lower', lower + 0
        if upper is not None:
            yield 'upper', upper + 0
1149536
def openclosed(lower_value, upper_value):
    
    return Interval(Interval.OPEN, lower_value, upper_value, Interval.CLOSED)
716961
def _limit(lower, upper):
    """"""
    if ((lower < 0) or (upper <= 0) or (upper < lower)):
        raise Exception("Illegal argument to _limit")
    return unicod("{%d,%d}") % (lower, upper)
1159989
def top_and_tail(a):
    
    if np.all(np.isnan(a)):
        return np.array([])
    nans = np.where(~np.isnan(a))[0]
    last = None if nans[-1]+1 == a.size else nans[-1]+1
    return a[nans[0]:last]
730567
def upper(self):
        
        q = self.copy()
        q.addFunction(Query.Function.Upper)
        return q
746529
function inRange (data, x, y) {
    if (x < y) {
      return greaterOrEqual(data, x) && data <= y;
    }

    return lessOrEqual(data, x) && data >= y;
  }
304067
def upper_lower_none(arg):
    """"""
    if not arg:
        return arg

    arg = arg.strip().lower()
    if arg in ['upper', 'lower']:
        return arg

    raise ValueError('argument must be "upper", "lower" or None')
852880
function (low, high, max) {
            var length = high - low;

            if (length < 0) {
                return {
                    min: -1,
                    max: -1
                };
            }

            low = util.clamp(low, 0, max);
            high = util.clamp(low + length, 0, max);
            if (high - low < length) {
                low = util.clamp(high - length, 0, max);
            }
            return {
                min: low,
                max: high
            };
        }
54768
def RACC_calc(TOP, P, POP):
    
    try:
        result = (TOP * P) / ((POP) ** 2)
        return result
    except Exception:
        return "None"