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

data_points = np.array([
    [300, 207],
    [310, 209],
    [320, (195+199)/2],
    [330, (176+180)/2],
    [340, 146.5],
    [350, (114+117)/2],
    [360, 89],
    [370, 70],
    [380, 53],
    [390, 40.5],
    [400, 32.5],
    [410, 26]
])

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


Out[2]:
<matplotlib.collections.PathCollection at 0x7f6da5ef0828>

In [62]:
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))


[ 3.29418354e-02 -2.47127369e+02] (-247.12736927443734, 0.03294183543689739)

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

plt.plot(x, y, 'b+')
plt.plot(x, lineeqn(x), 'r')
plt.grid()
plt.show()



In [64]:
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[64]:
([1.2164908818550878e-05,
  8.289769576988127e-06,
  6.949322641028103e-06,
  6.674988525068298e-06,
  6.892411268125929e-06,
  7.254600585621838e-06,
  7.643149169818199e-06,
  8.016361443157123e-06,
  8.26856157727342e-06,
  8.413222222064876e-06,
  8.52354322168773e-06,
  8.53753590322421e-06],
 8.135697912717395e-06)

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


Out[58]:
7.090159134680325e-09