import csv
import numpy as np
from scipy import interpolate
import scipy as sp

min_e = 100.0

with open('Tamosauskas-e.csv', 'r') as csvFile:
    reader = csv.reader(csvFile)
    my_list=list(reader)
    print(my_list)

for i in range(len(my_list)):

    if abs(float(my_list[i][0])-0.300)<min_e:
        min_e=abs(float(my_list[i][0])-0.300)
        n_e1=my_list[i][1]
        n_e0=my_list[i-1][1]
        n_e2=my_list[i+1][1]
        x0=my_list[i-1][0]
        x1 = my_list[i][0]
        x2 = my_list[i + 1][0]

print(n_e0)
print(n_e1)
print(n_e2)


y = [float(n_e0), float(n_e1), float(n_e2)]
x = [float(x0), float(x1), float(x2)]


print(x)
print(y)

f1 = sp.interpolate.interp1d(x, y,kind = 'linear')

y1=f1(0.300)
print(y1)

first_row=my_list[1]

