def curve(x, ymin, ymax, xhl, xhu, up=True): a = (xhl + xhu) / 2 b = 2 / abs(xhl - xhu) c = ymin d = ymax - c if up == True: y = c + ( d / ( 1 + np.exp(1)**( -b * (x - a) ) ) ) elif up == False: y = c + ( d / ( 1 + np.exp( b * (x - a) ) ) ) else: None return y