In [54]:
import numpy as np
from matplotlib import pyplot as plt

data_points = np.array([
    [ 4936.490,     0],
    [ 7264.623,   0.7],
    [ 9005.072,  10.4],
    [10343.531,  37.0],
    [11441.591,  77.4],
    [12391.082, 122.8],
    [13245.908, 169.5],
    [14038.782, 216.0],
    [14727.344, 254.0],
    [15398.375, 286.0],
    [15997.332, 314.0],
    [16597.289, 336.0]
])

x, y = data_points.T
plt.scatter(x,y)


Out[54]:
<matplotlib.collections.PathCollection at 0x7f74252b1a20>

In [55]:
a = ( np.mean(y)*sum([i*i for i in x]) - np.mean(x)*sum(np.multiply(x, y)) ) / (sum([i*i for i in x]) - len(x)*np.mean(x)**2)
b = ( sum(np.multiply(x, y)) - len(x)*np.mean(x)*np.mean(y) ) / (sum([i*i for i in x]) - len(x)*np.mean(x)**2)

line = np.polyfit(x, y, 1)
print(line, (a,b))


[ 2.70073257e-02 -1.93618101e+02] (-193.61810056413904, 0.02700732571799571)

In [56]:
def lineeqn(xo):
    return line[0]*xo + line[1]

plt.plot(x, y, 'bo')
plt.plot(x, lineeqn(x))
plt.grid()
plt.show()



In [60]:
vsd = [j - line[1] for j in y]

stefs = []
for l in range(len(vsd)):
    stefs.append(2.43*10**(-4)*vsd[l]/x[l])

stefs, np.mean(stefs)


Out[60]:
([9.530901194388259e-06,
  6.499896613641987e-06,
  5.5053861242959185e-06,
  5.417898243557803e-06,
  5.755965095858233e-06,
  6.2052368338039965e-06,
  6.661506212868586e-06,
  7.090159134680325e-06,
  7.385662916347016e-06],
 6.67251248549357e-06)

In [58]:
stef = 2.43*10**(-4)*(216.0-line[1])/14038.782*10**-3
stef


Out[58]:
7.090159134680325e-09