import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rcParams
plt.rcParams["font.family"] = "Times New Roman"

time = np.linspace(0,20.28125, num=32*20.28125+1)

strain = np.zeros(len(time))


strain[100:125]=.2*(time[100:125]-time[100]) # Ramp 1 up
strain[124:149]=-.2*(time[124:149]-time[124])+.15 # Ramp 1 down
strain[148:169] = .2*(time[148:169]-time[148]) # Ramp up to 12.5%
strain[168:489] = 0.025*np.sin(np.pi*2*2*(time[168:489]-time[168])+np.pi)+.125 # Preconditioning (note that there are 16 data points in each wave)
strain[488:509] = -.2*(time[488:509]-time[488])+.125 # Ramp back down after preconditioning

strain[600:625] = .2*(time[600:625]-time[600]) # Ramp 2 up
strain[624:649] = -.2*(time[624:649]-time[624])+.15 # Ramp 2 down

plt.figure(figsize=(6,1.5))
plt.plot(time, strain)
plt.xlim([0,21])
plt.ylim([0,.16])
plt.xlabel('Time')
plt.ylabel('Strain')
plt.gca().get_xaxis().set_ticks([])
plt.gca().get_yaxis().set_ticks([])
plt.gca().spines['right'].set_visible(False)
plt.gca().spines['top'].set_visible(False)
plt.tight_layout()
plt.savefig('figure1.svg')
plt.show()