def mid_range_f(a, axis=None, masked=False): """Return the minimum and maximum of an array or the minimum and maximum along an axis. ``mid_range_f(a, axis=axis)`` is equivalent to ``(numpy.amin(a, axis=axis), numpy.amax(a, axis=axis))`` :Parameters: a: numpy array_like Input array axis: `int`, optional Axis along which to operate. By default, flattened input is used. kwargs: ignored :Returns: 3-`tuple` The sample size, minimum and maximum inside a 3-tuple. """ (N,) = sample_size_f(a, axis=axis, masked=masked) amin = numpy_amin(a, axis=axis) amax = numpy_amax(a, axis=axis) if not numpy_ndim(amin): # Make sure that we have a numpy array (as opposed to, e.g. a # numpy.float64) amin = numpy_asanyarray(amin) amax = numpy_asanyarray(amax) return asanyarray(N, amin, amax)
def min_f(a, axis=None, masked=False): '''Return the minimum of an array, or the minima of an array along an axis. :Parameters: a: numpy array_like Input array axis: `int`, optional Axis along which to operate. By default, flattened input is used. masked: `bool` :Returns: out: 2-tuple of `numpy.ndarray` The sample sizes and the minima. ''' N, = sample_size_f(a, axis=axis, masked=masked) amin = numpy_amin(a, axis=axis) return asanyarray(N, amin)
def min_f(a, axis=None, masked=False): """Return the minimum of an array or minimum along a specified axis. :Parameters: a: numpy array_like Input array axis: `int`, optional Axis along which to operate. By default, flattened input is used. masked: `bool`, optional :Returns: 2-`tuple` of `numpy.ndarray` The sample size and the minimum. """ (N,) = sample_size_f(a, axis=axis, masked=masked) amin = numpy_amin(a, axis=axis) return asanyarray(N, amin)