docs: def make_tophat_ei (lower, upper):
      """Return a ufunc-like tophat function on the defined range, left-exclusive
      and right-inclusive. Returns 1 if lower < x <= upper, 0 otherwise.
  
      """
      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_ei (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_ei.__doc__ = ('Ranged tophat function, left-exclusive and '
                                 'right-inclusive. Returns 1 if %g < x <= %g, '
                                 '0 otherwise.') % (lower, upper)
      return range_tophat_ei