%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import Image
#СВЯЗИ
a = np.loadtxt("bond")
x_o=a[:,0]
y_o=a[:,1]
print "initial data:", y_o
#function is f(x)=k(b-x)^2 + a
#fitfunc = lambda p, x: p[0]*pow(p[1]-x,2) + p[2] # Target function
#errfunc = lambda p, x, y: fitfunc(p, x) - y # Error function
#p0 = [1,1, -79] # Initial guess for the parameters
#p1, success = optimize.leastsq(errfunc, p0[:], args=(x_o, y_o))
#print "Optimized params:", p1
#Plot it
plt.plot(x_o, y_o, "ro")
plt.xlim(1.3,1.8)
plt.show()
#ВАЛЕНТНЫЙ УГОЛ
a = np.loadtxt("hch")
x_o=a[:,0]
y_o=a[:,1]
print "Initial data:", y_o
plt.plot(x_o, y_o, "ro")
plt.xlim(108,115)
plt.savefig('hch.png')
plt.show()
#ТОРСИОННЫЙ УГОЛ
a = np.loadtxt("d3")
x_o=a[:,0]
y_o=a[:,1]
print "Initial data:", y_o
#Plot it
plt.plot(x_o, y_o, "ro")
plt.xlim(-180,180)
plt.savefig('d3.png')
plt.show()
#ТОРСИОННЫЕ УГЛЫ