Only give scalar options that have a varying range
546149
def _get_scalar_names(self, limit=None):
        """"""
        names = []
        if limit == 'point':
            inpnames = list(self.input_dataset.point_arrays.keys())
        elif limit == 'cell':
            inpnames = list(self.input_dataset.cell_arrays.keys())
        else:
            inpnames = self.input_dataset.scalar_names
        for name in inpnames:
            arr = self.input_dataset.get_scalar(name)
            rng = self.input_dataset.get_data_range(name)
            if arr is not None and arr.size > 0 and (rng[1]-rng[0] > 0.0):
                names.append(name)
        try:
            self._last_scalars = names[0]
        except IndexError:
            pass
        return names
222211
def range_fltr(dem, rangelim):
    
    print('Excluding values outside of range: {0:f} to {1:f}'.format(*rangelim))
    out = np.ma.masked_outside(dem, *rangelim)
    out.set_fill_value(dem.fill_value)
    return out
895731
def normalize_to_range(
    values,
    minimum = 0.0,
    maximum = 1.0
    ):

    

    normalized_values = []
    minimum_value = min(values)
    maximum_value = max(values)
    for value in values:
        numerator = value - minimum_value
        denominator = maximum_value - minimum_value
        value_normalized = (maximum - minimum) * numerator/denominator + minimum
        normalized_values.append(value_normalized)
    return normalized_values
410184
def confine(x,low,high):
    ''''''

    y=x.copy()
    y[y < low] = low
    y[y > high] = high
    return y
869962
function opt(argv, arg, index, key) {
    var value = argv[index + 1], equals = arg.indexOf('=');
    if(equals > -1) {
      value = arg.substr(equals + 1);
    }
    if(value && ~keys.indexOf(value)) {
      return value;
    }
    if(arg === option[key]) {
      return modes[key];
    }
  }
743063
def cast_scalar_indexer(val):
    
    # assumes lib.is_scalar(val)
    if lib.is_float(val) and val == int(val):
        return int(val)
    return val
1146350
def option2tuple(opt):
    """"""

    if isinstance(opt[0], int):
        tup = opt[1], opt[2:]
    else:
        tup = opt[0], opt[1:]

    return tup
295637
def _rlimit_min(one_val, nother_val):
    """"""
    if one_val < 0 or nother_val < 0 :
        return max(one_val, nother_val)
    else:
        return min(one_val, nother_val)
572549
def _elsed_block_range(self, lineno, orelse, last=None):
        
        if lineno == self.fromlineno:
            return lineno, lineno
        if orelse:
            if lineno >= orelse[0].fromlineno:
                return lineno, orelse[-1].tolineno
            return lineno, orelse[0].fromlineno - 1
        return lineno, last or self.tolineno
960620
def indxByRange(self, valu):
        '''
        
        '''

        if not isinstance(valu, (list, tuple)):
            raise s_exc.BadCmprValu(valu=valu, cmpr='*range=')

        if len(valu) != 2:
            raise s_exc.BadCmprValu(valu=valu, cmpr='*range=')

        tick, tock = self.getTickTock(valu)

        if tick > tock:
            # User input has requested a nullset
            return ()

        return self._indxTimeRange(tick, tock)
208260
def _op_generic_StoU_saturation(self, value, min_value, max_value): #pylint:disable=no-self-use
        
        return claripy.If(
            claripy.SGT(value, max_value),
            max_value,
            claripy.If(claripy.SLT(value, min_value), min_value, value))
1088508
def _get_randomized_range(val,
                          provided_range,
                          default_range):
    
    if val is None:
        if provided_range is None:
            return default_range
        else:
            return provided_range
    else:
        if provided_range is not None:
            raise ValueError('Value {} overrides range {}'
                             .format(str(val), str(provided_range)))
        return [val]
1095024
def _psturng(q, r, v):
    """"""
    if q < 0.:
        raise ValueError('q should be >= 0')

    opt_func = lambda p, r, v : abs(_qsturng(p, r, v) - q)

    if v == 1:
        if q < _qsturng(.9, r, 1):
            return .1
        elif q > _qsturng(.999, r, 1):
            return .001
        return 1. - fminbound(opt_func, .9, .999, args=(r,v))
    else:
        if q < _qsturng(.1, r, v):
            return .9
        elif q > _qsturng(.999, r, v):
            return .001
        return 1. - fminbound(opt_func, .1, .999, args=(r,v))
523397
def some(arr):
    """"""
    return functools.reduce(lambda x, y: x or (y is not None), arr, False)
207999
def _zip_with_scalars(args):
  """"""
  zipped = []
  for arg in args:
    if isinstance(arg, prettytensor.PrettyTensor):
      zipped.append(arg if arg.is_sequence() else itertools.repeat(arg))
    elif (isinstance(arg, collections.Sequence) and
          not isinstance(arg, tf.compat.bytes_or_text_types)):
      zipped.append(arg)
    else:
      zipped.append(itertools.repeat(arg))
  assert len(args) == len(zipped)
  return zip(*zipped)
478491
def _check_scalar(value):
    '''
    '''
    if isinstance(value, np.ndarray):
        if value.ndim == 0:
            # We have a 0-dimensional array
            return value[None][0]
    return value
135121
def minValue(self, value):
        """"""
        if isinstance(value, [int, float, long]):
            self._rangeMin = value