def __init__(self, models, expSpeed, eig, speed): # the plot should have eigenvalues for each rider in a different color # and plot dots for the eigenvalues from the model self.fig = bp.plot_eigenvalues([mod.bicycle for mod in models.values()], speed) # plot eigenvalues of the experimental models self.ax = self.fig.axes[0] self.ax.set_ylim((-10., 10.)) #self.real = self.ax.plot(expSpeed, np.real(eig), '.k') self.real = [] for eigs in eig.T: eigWithImag = abs(np.imag(eigs)) > 1e-10 self.real.append(self.ax.scatter(expSpeed, np.real(eigs), c=eigWithImag)) self.imag = self.ax.plot(expSpeed, abs(np.imag(eig)), 'ob') self.canvas = mpgtk.FigureCanvasGTK(self.fig) self.canvas.show()
# Geometry Plot benchmark.plot_bicycle_geometry(show=False, inertiaEllipse=False, color='grey', ax=axes[0]) optimal.plot_bicycle_geometry(show=False, inertiaEllipse=False, color='black', ax=axes[0]) axes[0].set_title('Bicycle Geometry') axes[0].set_xlabel('Distance [m]') axes[0].set_ylabel('Distance [m]') # Eigenvalues Versus Speed Plot speeds = np.linspace(0.0, 10.0, num=100) bp.plot_eigenvalues([benchmark, optimal], speeds, ax=axes[1], colors=['grey', 'black']) axes[1].set_ylim((-10, 15)) l = axes[1].legend(['Benchmark', 'Optimal @ 5 m/s']) #l = axes[1].legend(['Benchmark', 'Falkor @ 5 m/s']) l.remove() axes[1].set_ylabel('Real & Imaginary\nParts of the\nEigenvalues [1/s]') # Handling Quality Metric Plot benchmark_hqm_data = np.loadtxt('data/hqmbenchmark.csv'.format(speed), delimiter=',') optimal_hqm_data = np.loadtxt('data/hqm{}.csv'.format(speed), delimiter=',') #optimal_hqm_data = np.loadtxt('data/hqm-falkor.csv', delimiter=',') axes[2].plot(*benchmark_hqm_data.T, color='grey')
import bicycleparameters as bp import numpy as np bikeNames = ['Browserins', 'Browser', 'Pista', 'Fisher', 'Yellow', 'Yellowrev'] colors = ['k'] * 3 + ['gray'] * 3 linestyles = ['-', '-.', '--'] * 2 bikes = [] for name in bikeNames: bikes.append(bp.Bicycle(name, pathToData='../data')) speeds = np.linspace(0., 10., num=100) bp.plot_eigenvalues(bikes, speeds, colors=colors, linestyles=linestyles), largest=True) bp.plt.vlines([2.5, 5., 7.], -0.5, 4.) #bp.plt.savefig('../plots/largest.png') bp.plt.show()
#!/usr/bin/env python import numpy as np import bicycleparameters as bp from dtk import bicycle pathToData = '/media/Data/Documents/School/UC Davis/Bicycle Mechanics/BicycleParameters/data' speeds = np.linspace(0., 10., num=100) # compare a bike with rider and bike without rider stratos = bp.Bicycle('Stratos', pathToData=pathToData, forceRawCalc=True) stratosRider = bp.Bicycle('Stratos', pathToData=pathToData, forceRawCalc=True) stratosRider.add_rider('Jason') compareRider = bp.plot_eigenvalues([stratos, stratosRider], speeds) ax = compareRider.axes[0] ax.set_ylim(-10, 10) ax.legend_.get_texts()[1].set_text('Stratos + Jason') compareRider.savefig('../../figures/parameterstudy/compare-rider-eig.png', dpi=200) # compare the benchmark parameters to some of the bicycles I measured benchmark = bp.Bicycle('Benchmark', pathToData=pathToData) browser = bp.Bicycle('Browser', pathToData=pathToData, forceRawCalc=True) browser.add_rider('Jason') stratos = bp.Bicycle('Stratos', pathToData=pathToData, forceRawCalc=True) stratos.add_rider('Jason') benchmarkReal = bp.plot_eigenvalues([benchmark, browser, stratos], speeds)