Values of 1/4, 1/2, 3/4 of logistic fit are incorrect

I have this code in Python (Jupyter Notebook: GitHub - danmikes/samsim: Sensitivity of Shoreline-Trajectory to Deposition-Events) that runs fine except for the last code cell.
The code creates a composite sine-wave for a range of variables (Period T, Amplitude A, Period Modulator Tm, Amplitude Modulator Am, phase p). It then takes random samples from the signal and calculates ratio of cycles of sample-signal and original-signal (fit).
It then fits a logistic curve and plots crosses at fit-value 1/4, 1/2, 3/4.
The last code cell creates the plot for those five parameters. The sixth is the one for default parameter values.
All seems to work fine, except the crosses for Period are off. All goes through the same functions, so the only reason I can find for this discrepancy is the range for T. But why and how to fix it?


It activates many functions, but these are the relevant ones for myproblem:

def logistic_function(x, a, b, c):
  return a / (1 + np.exp(-b * (np.log(x) - c)))

def logistic_fit(x_data, y_data, params, maxfev=1e4):
  return curve_fit(logistic_function, x_data, y_data, params, maxfev=int(maxfev))

def find_x_for_y(y, a, b, c):
  x = np.exp((np.log(a / (y * a)) / -b) + c)
  return x

def all(ax, param_ranges, title):
  sams, fits = run_params(param_ranges)
  ax.scatter(sams, fits, s=5, color='darkcyan')
  set_plot_prop(ax, 'log', 'linear', title, (1, 1e3), (0, 1))
  return sams, fits

def logistic(ax, x_data, y_data):
  params = (1, 0.4, 60) # (1.0, 0.4, 60)
  covariance = np.zeros((3, 3))
  params, covariance = logistic_fit(x_data, y_data, params, 1e5)
  x_fit = np.linspace(min(x_data), max(x_data), 100)
  y_fit = logistic_function(x_fit, *params)
  ax.plot(x_fit, y_fit, color='cyan')
  return params, covariance
def func_lin(ax, params, lines, x_vals, y_vals):
  for (y, color, linestyle, linewidth) in lines:
    ax.axhline(y=y, color=color, linestyle=linestyle, linewidth=linewidth)
    x_y = find_x_for_y(y, *params)
    x_x = np.interp(y, y_vals, x_vals)
    ax.axvline(x=x_x, color=color, label=f'{round(x_x)}', linestyle=linestyle, linewidth=linewidth)
  ax.legend(loc='center right')

def func_par(axes, variables, lines):
  for ax, (title, ranges) in zip(axes, variables):
    sams, fits = all(ax, ranges, title)
    params, _ = logistic(ax, sams, fits)
    func_lin(ax, params, lines, sams, fits)

def plot_pars():
  fig, axes = plt.subplots(2, 3, figsize=(20, 8))
  axes = axes.flatten()

  variables = [
    ('Period', _T_),
    ('Amplitude', _A_),
    ('Default', SAM_L),
    ('Period mod', _Tm_),
    ('Amplitude mod', _Am_),
    ('Phase', _p_),

  lines = [
    (3/4, 'yellow', '--', 1),
    (1/2, 'lime', '--', 1),
    (1/4, 'red', '--', 1)

  func_par(axes, variables, lines)
  return fig