tt = np.linspace(0, 32*10/1600, 32*10, endpoint=False) # A phase comparison vector. This should be the idea output. pt = np.concatenate((((2*np.pi*50.0*tt+np.pi) % (2*np.pi) - np.pi),(2*np.pi*ft*tt+np.pi) % (2*np.pi) - np.pi)) # The test input vector yt = np.concatenate((mag*np.cos(2*np.pi*50*tt) + dc_offset, mag*np.cos(2*np.pi*ft*tt) + dc_offset)) # Re-define tt to extend the full length. tt = np.linspace(0, 2*32*10/1600, 2*32*10, endpoint=False) step_time = (32*10)/1600 # used for drawing a line of the plots # Create and run the filter, noting increasing the number of iterations # will reduce the LES filter settling time at the cost of higher computation time. les = LES(iterations=1) les_out = les.run_les(yt) # Visualisation of the output fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex=True, sharey=False) fig.suptitle('LES Freq Step Test', fontsize=16) # Plots have the LES generated lines wider so the correct lines is overlayed and visable. # Plot the phases ax1.plot(tt, les_out[1], linewidth=3) ax1.plot(tt, pt) ax1.set_title('Phase (rad)') ax1.axvline(x=step_time, ls='--', c='red') # Plot the freqency ax2.plot(tt, les_out[2], linewidth=3)