I'm trying to fit the following equation to my data using scipy, but I think I'm doing something wrong.

(You can view the details of the model from the pdf here.)
I converted the equation (T to the other side of the equation) to be able to use the curve_fit function.
What is the correct way to use the model in optimize.curve_fit?
import pandas as pd
import numpy as np
from scipy import optimize
import plotly.graph_objects as go
data = pd.read_html('https://gist.github.com/birdalugureren/42e1ea13913780161a31a333031e836d')[0]
data = data.drop('Unnamed: 0', axis=1).set_index('year')
T = data.shape[0] # year
x = data.iloc[0, :] # first year
y = np.log(data.iloc[-1, :]) - np.log(data.iloc[0, :]) # growth rate
def b_convergence(x, a, b):
global T
y = (a + ((1 - np.exp(-b * T)) / T) * np.log(x)) * T
return y
popt, pcov = optimize.curve_fit(b_convergence, xdata=x, ydata=y)
a, b = popt
x_line = np.arange(min(x), max(x), 1)
new_Y = b_convergence(x_line, a, b)
fig = go.Figure()
fig.add_trace(go.Scatter(x=x, y=y, mode='markers'))
fig.add_trace(go.Scatter(x=x_line, y=new_Y, mode='lines'))
fig.show()
The output of my popt and pcov variables is as follows:
>>> print(popt)
[-0.13299378 1. ]
>>> print(pcov)
[[inf inf]
[inf inf]]
