code: def open01(x, limit=1.e-6):
      
      try:
          return np.array([min(max(y, limit), 1. - limit) for y in x])
      except TypeError:
          return min(max(x, limit), 1. - limit)
docs: Constrain numbers to (0,1) interval