T1 Mapping in Python?
You are fitting a polynomial to a logarithmic decay curve, which is probably wrong.  You probably want to fit a log curve to a log curve.  You can use the naïve method of np.polyfit(log(x), y, 1) which will probably work fine, or you can weight the points to make it more accurate, or you can use scipy.optimize.curve_fit.  All are described here: https://stackoverflow.com/q/3433486/125507
The coefficients returned by the polyfit are the coefficients of the polynomial.  So with deg=2, you're fitting a parabola to the decay curve, which again is probably wrong: p(x) = p[0] * x**2 + p[1] * x + p[2]  With the np.polyfit(log(x), y, 1) method you'll be fitting a straight line to a straight line, so there will only be a slope and an offset: p(x) = p[0] * x + p[1]  The slope would then be proportional to the decay rate of the log curve (somehow, which you can figure out for the type of value you need).
After getting this working, you can probably vectorize it for speed, fitting all pixels simultaneously instead of using for loops.  np.polyfit can handle this, for instance: &quot;Several data sets of sample points sharing the same x-coordinates can be fitted at once by passing in a 2D-array that contains one dataset per column.&quot;