In [2]:
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
%matplotlib inline
steps = 1000
qtime = np.array(range(steps))
leg = np.sin(qtime*2*np.pi/steps*2)
leg[249:] = 0
hippts = np.array([(0, 0), (150, 0.9), (500, 0.6), (700, 0.2), (1000, 0)])
hip = interp1d(hippts[:,0], hippts[:,1], kind='cubic')
hip = hip(qtime)
hip = np.clip(hip, 0.0, 1.0)
plt.plot(hip)
plt.plot(250, 0, 'o')
plt.plot(250, 1.0, 'o')
plt.plot(leg)
plt.show()
In [83]:
#for testing directionality
#rads = np.linspace(0, np.pi*2., 200)
#plt.plot(rads*180/np.pi, np.tanh(rads))
l = np.linspace(0, 2*np.pi)
degs = np.linspace(0, 360)
#plt.plot(degs, -np.tanh((np.fmod(l, 3./2.*np.pi))*2. - np.pi))
plt.plot(degs, np.cos(l))
#plt.plot(degs, np.sin(l))
plt.plot(np.pi, -1, 'o')
plt.show()
In [ ]: