from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots.add_plot().line('t','x') \ .xlabel('t').ylabel('x [m]') \ .title('Trajectory') plots.add_plot().line('t','v') \ .xlabel('t (s)').ylabel('v (m/s)') \ .title('Velocity history') plots.add_plot().line('t','a') \ .xlabel('t (s)').ylabel('a (m/s^2)') \ .title('Control history') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data_dubin.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot().line('x','y') \ .xlabel('x [m]').ylabel('y [m]') \ .title('Trajectory') plots.add_plot().line('t','delta') \ .xlabel('t (s)').ylabel('delta (m/s)') \ .title('Control history') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./cart120.dill', default_sol=-1, default_step=-1) plots.add_plot().line('x_n*x_s','y_n*y_s') \ # .xlabel('t (s)').ylabel('h (km)') \ # .title('Altitude vs. Time') plots.add_plot().line('t', 'sin(w)') \ # .xlabel('t (s)').ylabel('h (km)') \ # .title('Altitude vs. Time') plots.add_plot().line('t', 'theta_n') \ plots.add_plot().line('t', 'p22_n*p22_s') \ plots.add_plot().line('t', 'p11_n*p11_s') \ # plots.add_plot().line('t','alfa*180/3.14') \ # .xlabel('t (s)').ylabel('alfa (degrees)') \ # .title('Angle of attack vs. Time') # plots.add_plot().line('theta*re/1000','h/1000',legend='Foo') \ # .line('theta*re/1000','h/1000',legend='Bar',step=1,sol=5) \ # .xlabel('Downrange (km)') \ # .ylabel('h (km)') \ # .title('Altitude vs. Downrange') plots.render()
from beluga.visualization import BelugaPlot from beluga.visualization.datasources import Dill # from beluga.visualization.renderers import ToyPlot ds_constraint = Dill('./data-1k2-eps4-eps4.dill') # 26 steps ds_epsHR = Dill('./data-1k2-eps6-eps4.dill') # 36 steps ds_epsAlfa = Dill('./data-1k2-eps6-eps7.dill') # 36 steps # toyplot = ToyPlot(backend = 'png') # plots = BelugaPlot(datasource=ds_constraint,default_sol=-1,default_step=-1,renderer='bokeh') plots = BelugaPlot('./data-1k2-eps4-eps4.dill',default_sol=-1,default_step=-1,renderer='matplotlib') qdot = 'k*v**3*sqrt(rho0*exp(-h/H)/rn)' # 90 plots.add_plot(mesh_size=512).line_series('theta*re/1000','h/1000', skip=5, datasource=ds_constraint) \ .xlabel('Downrange (km)').ylabel('Altitude (km)') \ .title('Altitude vs. Downrange') plots.add_plot(mesh_size=512).line_series('t','qdot/1e4', skip=5, datasource=ds_constraint) \ .xlabel('t (s)').ylabel('Heat Rate (W/cm^2)') \ .title('Heat Rate vs. Time') plots.add_plot(mesh_size=512).line_series('t','alfa*180/3.14', skip=5, datasource=ds_constraint) \ .line('t','alfaMax*180/3.14', datasource=ds_epsAlfa) \ .xlabel('t (s)').ylabel('Alpha (deg)') \ .title('Control History') plots.add_plot(mesh_size=512).line_series('v/1000','h/1000', skip=5, datasource=ds_constraint) \ .xlabel('Velocity (km/s)').ylabel('Altitude (km)') \ .title('Altitude vs. Velocity')
from beluga.visualization import BelugaPlot from beluga.visualization.datasources import Dill # plots = BelugaPlot('./data.dill',default_sol=-1,default_step=0) unc_ds = Dill('../../mpbvp/boundedBrachistochrone/data.dill') plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot().line('x','y',label='Solution', sol=-1, step=-1,style={'lw':2.0}) \ .line('x','y',label='Unconstrained Solution', datasource=unc_ds, step=0, sol=-1,style={'lw':2.0})\ .line('x','xlim-x',label='Constraint1',step=-1,sol=-1) \ .xlabel('x(t)').ylabel('y(t)') \ .title('Trajectory') # .line('x','-2-0.75*x',label='Constraint2',step=-1,sol=-1) \ plots.add_plot().line('t','theta*180/3.14') \ .xlabel('t (s)').ylabel('theta (degrees)') \ .title('Control history') plots.add_plot().line('t','lamX') \ .xlabel('t (s)').ylabel('lamX') \ .title('lamX') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plot1 = plots.add_plot() plot1.line_series('x', 'y') plot1.xlabel('x(t)') plot1.ylabel('y(t)') plot1.title('Trajectory time history') plot2 = plots.add_plot() plot2.line('t', '180/pi*theta') plot2.xlabel('t (s)') plot2.ylabel('theta (degrees)') plot2.title('Control time history') plots.render()
mpl.rcParams['legend.fontsize'] = 'x-large' mpl.rcParams['xtick.labelsize'] = 'x-large' mpl.rcParams['ytick.labelsize'] = 'x-large' output_dir = './plots/' def save_pic(renderer, fig, p, suffix): fh = renderer._get_figure(fig); plt.tight_layout() plt.savefig(f'{output_dir}/planarHypersonic_{suffix}.eps') # mpbvp_ds = Dill('../../mpbvp/boundedBrachistochrone/data.dill') icrm_ds = Dill('../planarHypersonic/data_thesis.dill') plots = BelugaPlot('./data.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots.add_plot().line('theta*re/1000','h/1000',label='QCPI', sol=-1, step=-1, style={'lw':0.0, 'marker':'o'})\ .line('theta*re/1000','h/1000',label='Shooting', sol=-1, step=-1, style={'lw':2.0})\ .xlabel('Downrange distance [km]').ylabel('$h$ [km]') \ .postprocess(ft.partial(save_pic,suffix='qcpi_ht')) plots.add_plot().line('t','alfa*180/3.14',label='QCPI', style={'lw':0.0, 'marker':'o'})\ .line('t','alfa*180/3.14',label='Shooting', datasource=icrm_ds, step=-1, sol=-1, style={'lw':2.0})\ .xlabel('$t$ [s]').ylabel('$\\theta$ [deg]') \ .postprocess(ft.partial(save_pic,suffix='qcpi_alfa')) plots.add_plot(colormap=cmx.viridis).line_series('theta*re/1000','h/1000',step=-1,skip=5, style={'lw':1.5})\ .xlabel('Downrange distance [km]').ylabel('$h$ [km]') \ .postprocess(ft.partial(save_pic,suffix='qcpi_evol_ht')) plots.add_plot(colormap=cmx.viridis).line_series('v/1000','h/1000',step=-1, skip=1, style={'lw':1.5})\ .xlabel('$v(t)$ [km/s]').ylabel('$h(t)$ [km]') \ .postprocess(ft.partial(save_pic,suffix='qcpi_evol_hv'))
from beluga.visualization import BelugaPlot import matplotlib.pyplot as plt plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') # plots.add_plot().line('xbar*V*tfreal','ybar*V*tfreal') \ # .xlabel('x(t)').ylabel('y(t)') \ # .title('Trajectory') plots.add_plot().line('e','n',label='traj1') \ .xlabel('x(t)').ylabel('y(t)') \ .title('Trajectory') \ .postprocess(lambda a,b,c: plt.axis('equal')) plots.add_plot().line('t','psi*180/3.14') \ .xlabel('t (s)').ylabel('psi (deg)') \ .title('Heading') plots.add_plot().line('t','gam*180/3.14',label='FPA') \ .line('t','bank*180/3.14',label='Bank angle') \ .xlabel('t [s]').ylabel('Control [deg]') \ .title('Control history') # plots.add_plot().line('t','sqrt((xbar - xbar2)**2 + (ybar - ybar2)**2)*(V*tfreal)') \ # .xlabel('t').ylabel('Separation (m)') \ # .title('Separation') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1) plots.add_plot().line('t','x') \ .xlabel('t (s)').ylabel('x(t)') \ .title('Position vs. Time') # # plots.add_plot().line('t','(_xlim - (2*_xlim/(1+exp((2/_xlim)*xi11))))') \ # .xlabel('t (s)').ylabel('psi(t)') \ # .title('psi1 vs. Time') plots.add_plot().line('t','u') \ .xlabel('t (s)').ylabel('u(t)') \ .title('Control history') plots.add_plot().line('t','v') \ .xlabel('t (s)').ylabel('v(t)') \ .title('v vs. t') plots.add_plot().line('t','xi12') \ .xlabel('t (s)').ylabel('xi12(t)') \ .title('xi12 vs. t') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1) plots.add_plot().line('y','x') \ .xlabel('y (m)').ylabel('x (m)') \ .title('Boat Trajectory') \ plots.add_plot().line('t','hdg*57.3') \ .xlabel('time (s)').ylabel('hdg (rad)') \ .title('Boat Heading') plots.render()
plt.savefig(f'{output_dir}/brachisto_{suffix}.eps') def postprocess_ham(r, f, p): plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) save_pic(r, f, p, 'qcpi_ham') mpbvp_ds = Dill('../../1-brachistochrone/data.dill') plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot(mesh_size=None).line('x','y',label='QCPI', sol=-1, step=-1, style={'lw': 0.0, 'marker':'o'}) \ .line('x','y',label='Multiple Shooting', datasource=mpbvp_ds, step=-1, sol=-1, style={'lw': 2.0})\ .xlabel('$x(t)$ [m]').ylabel('$y(t)$ [m]') \ .postprocess(ft.partial(save_pic, suffix='qcpi_xy')) plots.add_plot(mesh_size=None).line('abs(t)','theta*180/3.14',label='QCPI', style={'lw': 0.0, 'marker':'o'}) \ .line('abs(t)','theta*180/3.14',label='Multiple Shooting', datasource=mpbvp_ds, step=-1, sol=-1, style={'lw': 2.0})\ .xlabel('$t$ [s]').ylabel('$\\theta$ [deg]') \ .postprocess(ft.partial(save_pic, suffix='qcpi_theta')) plots.add_plot(mesh_size=None)\ .line('abs(t)','lamX',label='$\\lambda_x(t)$', style={'lw': 2.0})\ .line('abs(t)','lamY',label='$\\lambda_y(t)$', style={'lw': 2.0})\ .line('abs(t)','lamV',label='$\\lambda_v(t)$', style={'lw': 2.0})\ .xlabel('$t$ [s]').ylabel('$\\lambda(t)$') \ .postprocess(ft.partial(save_pic, suffix='qcpi_lam')) ham = 'lamX*v*cos(theta)+lamY*v*sin(theta)+lamV*g*sin(theta)+1.0'
cmap=cmap, norm=norm, orientation=orient, format=formatter) cb.set_label(label) plots = BelugaPlot('./data_fpa60.dill', default_sol=-1, default_step=-1) mpbvp_ds = Dill('../../mpbvp/planarHypersonicWithHeatRate/data_1200.dill') const_ds = Dill('./data_1200_5k_1deg_ep6.dill') qdot_ds = Dill('./data_1200_ep4.dill') # Remove \addlegendimage lines from tex file for dot plots plots.add_plot(colormap=cmx.viridis_r).line_series('theta*re/1000','h/1000',step=1,skip=0,style={'lw':2.0}) \ .xlabel('Downrange [km]').ylabel('$h$ [km]')\ .postprocess(ft.partial(save_pic, suffix='evol1_htheta')) plots.add_plot(colormap=cmx.viridis_r).line_series('t','gam*180/3.14159',step=1,skip=0,style={'lw':2.0}) \ .xlabel('$t$ [s]').ylabel('$\\gamma$ [deg]')\ .postprocess(ft.partial(save_pic, suffix='evol1_fpa')) rho = 'rho0*exp(-h/H)' Cl = '(1.5658*alfa + -0.0000)' Cd = '(1.6537*alfa**2 + 0.0612)' D = '(0.5*' + rho + '*v**2*' + Cd + '*Aref)' L = '(0.5*' + rho + '*v**2*' + Cl + '*Aref)' # # plots.add_plot(colormap=cmx.jet_r).line_series('t','k*sqrt(rho0*exp(-h/H)/rn)*v**3/10000',datasource=mpbvp_ds,step=-1,skip=2) \ # .xlabel('$t$ [s]').ylabel('$\\dot{q}$ [W/cm$^2$]') \
from beluga.visualization import BelugaPlot import matplotlib.pyplot as plt import sys if len(sys.argv) < 2: print('Usage: python plot.py <n>') # plots = BelugaPlot('./data-3v-s15.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') # 872 # plots.add_plot().line('xbar*V*tfreal','ybar*V*tfreal')\ # .xlabel('x(t)').ylabel('y(t)')\ # .title('Trajectory') plot1 = plots.add_plot().line('xbar', 'ybar', label='traj1') n = 10 for i in range(2, n + 1): plot1.line(f'xbar{i}', f'ybar{i}', label=f'traj{i}') # plots.add_plot().line('t','psi*180/3.14')\ # .line('t','psi2*180/3.14')\ # .line('t','psi3*180/3.14')\ # .line('t','psi4*180/3.14')\ # # .line('t','psi5*180/3.14')\ # # .xlabel('t (s)').ylabel('psi (deg)')\ # # .title('Heading') # # plots.add_plot().line('t','abar')\ # .line('t','abar2')\ # .line('t','abar3')\
ax.plot_surface(X, Y, Z, linewidth=0) ax.plot_surface(X, (2 * y_center - Y), Z, linewidth=0) plt.axis('equal') # plots = BelugaPlot('./data-3s3-202.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots = BelugaPlot(filename, default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot(colormap=cmx.viridis).line('xbar2*V*tfreal/1e3','ybar2*V*tfreal/1e3',label='Vehicle 2',style={'color':'red'})\ .line('xbar*V*tfreal/1e3','ybar*V*tfreal/1e3',label='Vehicle 1')\ .line('xc*V*tfreal/1e3+rc*V*tfreal/1e3*cos(2*pi*t/tf)','yc*V*tfreal/1e3+rc*V*tfreal/1e3*sin(2*pi*t/tf)',label='c1')\ .line('xc2*V*tfreal/1e3+rc2*V*tfreal/1e3*cos(2*pi*t/tf)','yc2*V*tfreal/1e3+rc2*V*tfreal/1e3*sin(2*pi*t/tf)',label='c2')\ .xlabel('x(t) [km]').ylabel('y(t) [km]')\ .title('Trajectory') \ .postprocess(lambda a,b,c: plt.axis('equal')) # plots.add_plot().line('t','rc2') plots.add_plot(colormap=cmx.jet).line('t','psi2*180/pi',label='Vehicle 1',style='r')\ .line('t','psi*180/pi')\ .xlabel('t [s]').ylabel('x(t)')\ .title('x') \ # plots.add_plot().line('xbar','ybar',label='traj1')\ # .line('xbar2','ybar2',label='traj2')\ # .line('xc+rc*cos(2*pi*t/tf)','yc+rc*sin(2*pi*t/tf)')\ # .xlabel('x(t)').ylabel('y(t)')\
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill',default_sol=-1,default_step=-1) plots.add_plot().line('theta*re/1000','h/1000') \ .xlabel('Downrange (km)').ylabel('h (km)') \ .title('Altitude vs. Downrange') plots.add_plot().line('t','alfa*180/3.14') \ .xlabel('t (s)').ylabel('alfa (degrees)') \ .title('Angle of attack vs. Time') rho = 'rho0*exp(-h/H)' Cl = '(1.5658*alfa + -0.0000)' Cd = '(1.6537*alfa**2 + 0.0612)' D = '(0.5*'+rho+'*v**2*'+Cd+'*Aref)' L = '(0.5*'+rho+'*v**2*'+Cl+'*Aref)' plots.add_plot().line('t','sqrt('+D+'**2+'+L+'**2)/(mass*g0)') \ .xlabel('t (s)').ylabel('G-Loading') \ .title('G-Loading vs. Time') # plots.add_plot().line('theta*re/1000','h/1000',label='Foo') \ # .line('theta*re/1000','h/1000',label='Bar',step=1,sol=5) \ # .xlabel('Downrange (km)') \ # .ylabel('h (km)') \ # .title('Altitude vs. Downrange') plots.render()
(X - x_center)**2) + y_center # Pythagorean theorem ax.plot_surface(X, Y, Z, linewidth=0) ax.plot_surface(X, (2 * y_center - Y), Z, linewidth=0) plt.axis('equal') # plots = BelugaPlot('./data-3s3-202.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots = BelugaPlot(filename, default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot(colormap=cmx.viridis).line('xbar2*V*tfreal/1e3','ybar2*V*tfreal/1e3',label='Vehicle 2',style={'color':'red'})\ .line_series('xbar*V*tfreal/1e3','ybar*V*tfreal/1e3',skip=2)\ .line('xc*V*tfreal/1e3+rc*V*tfreal/1e3*cos(2*pi*t/tf)','yc*V*tfreal/1e3+rc*V*tfreal/1e3*sin(2*pi*t/tf)')\ .xlabel('x(t) [km]').ylabel('y(t) [km]')\ .title('Trajectory') \ .postprocess(lambda a,b,c: plt.axis('equal')) plots.add_plot(colormap=cmx.jet).line('t','V',label='Vehicle 1',style='r')\ .line_series('t','vbar2*V',skip=2)\ .xlabel('t [s]').ylabel('v(t) [m/s]')\ .title('Speed') \ # plots.add_plot().line('xbar','ybar',label='traj1')\ # .line('xbar2','ybar2',label='traj2')\ # .line('xc+rc*cos(2*pi*t/tf)','yc+rc*sin(2*pi*t/tf)')\ # .xlabel('x(t)').ylabel('y(t)')\ # .title('Trajectory') \ # .postprocess(lambda a,b,c: plt.axis('equal')) #
from beluga.visualization import BelugaPlot # plots = BelugaPlot('./data_2500_ep4.dill',default_sol=-1,default_step=-1, renderer='matplotlib') # plots = BelugaPlot('./data-flydown.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots = BelugaPlot('./data-1k2-eps6-eps7.dill', default_sol=-1, default_step=-1, renderer='matplotlib') # plots = BelugaPlot('./data_1200_5k_1deg_ep6.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots.add_plot().line('theta*180/3.14','h/1000') \ .xlabel('Downrange (deg)').ylabel('h (km)') \ .title('Altitude vs. Downrange') plots.add_plot().line('t','k*sqrt(rho0*exp(-h/H)/rn)*v**3/1e4') \ .line('t','qdotMax/1e4') \ .xlabel('t (s)').ylabel('Heat Rate (W/cm^2)') \ .title('Heat Rate vs. Time') # plots.add_plot().line('t','sqrt(D^2+L^2)/(mass*9.81)') \ # .xlabel('t (s)').ylabel('G-Loading') \ # .title('G-Loading vs. Time') plots.add_plot().line('t','v/1e3') \ .xlabel('t (s)').ylabel('Heat rate') \ .title('Heatrate vs. Time') plots.add_plot().line('t','gam*180/pi') \ .xlabel('t (s)').ylabel('FPA (deg)') \ .title('FPA') plots.render()
mpl.rcParams['xtick.labelsize'] = 'x-large' mpl.rcParams['ytick.labelsize'] = 'x-large' output_dir = './plots/' def save_pic(renderer, fig, p, suffix): fh = renderer._get_figure(fig) plt.tight_layout() plt.savefig(f'{output_dir}/boundedbrachisto_{suffix}.eps') # mpbvp_ds = Dill('../../mpbvp/boundedBrachistochrone/data.dill') icrm_ds = Dill('../../icrm/boundedBrachistochrone/data.dill') plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot().line('x','y',label='QCPI', sol=-1, step=-1, style={'lw':0.0, 'marker':'o'}) \ .line('x','y',label='ICRM + Shooting', datasource=icrm_ds, step=-1, sol=-1, style={'lw':2.0})\ .line('x','-1.0-x',label='x + y = 1',step=-1,sol=-1,style={'lw':2.0, 'linestyle':'--'}) \ .xlabel('$x(t)$ [m]').ylabel('$y(t)$ [m]') \ .postprocess(ft.partial(save_pic,suffix='qcpi_xy')) plots.add_plot().line('t','theta*180/3.14',label='QCPI Solution', style={'lw':0.0, 'marker':'o'}) \ .line('t','theta*180/3.14',label='ICRM + Shooting', datasource=icrm_ds, step=-1, sol=-1, style={'lw':2.0})\ .xlabel('$t$ [s]').ylabel('$\\theta$ [deg]') \ .postprocess(ft.partial(save_pic,suffix='qcpi_theta')) plots.render()
from beluga.visualization import BelugaPlot # plots = BelugaPlot('./data_fpa60_ms.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot().line('theta*180/3.14','h/1000') \ .xlabel('Downrange (deg)').ylabel('h (km)') \ .title('Altitude vs. Downrange') plots.add_plot().line_series('t','qdot/1e4',step=-1)\ .xlabel('t (s)').ylabel('Heat Rate (W/cm^2)') \ .title('Heat Rate vs. Time')\ .line('t','qdotMax/1e4') \ plots.add_plot().line_series('t','v/1e3',step=-1)\ .xlabel('t (s)').ylabel('Speed km/s') \ .title('Heat Rate vs. Time') # # plots.add_plot().line_series('t','qdot/1e4',step=4)\ # .xlabel('t (s)').ylabel('Heat Rate (W/cm^2)') \ # .title('Heat Rate vs. Time') # # plots.add_plot().line_series('t','qdot/1e4',step=5)\ # .xlabel('t (s)').ylabel('Heat Rate (W/cm^2)') \ # .title('Heat Rate vs. Time') # # plots.add_plot().line_series('t','qdot/1e4',step=6)\ # .xlabel('t (s)').ylabel('Heat Rate (W/cm^2)') \
from beluga.visualization import BelugaPlot # plots = BelugaPlot('./data.dill',default_sol=-1,default_step=0) plots = BelugaPlot('./data.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots.add_plot().line('x','y',label='Solution') \ .line('x','y',label='Unconstrained', step=0, sol=-1) \ .line('x','-1.0-x',label='Constraint1',step=-1,sol=-1) \ .xlabel('x(t)').ylabel('y(t)') \ .title('Trajectory') # .line('x','-2-0.75*x',label='Constraint2',step=-1,sol=-1) \ plots.add_plot().line('t','theta*180/3.14') \ .xlabel('t (s)').ylabel('theta (degrees)') \ .title('Control history') plots.add_plot().line('t','lamX') \ .xlabel('t (s)').ylabel('lamX') \ .title('lamX') plots.render()
# plots.add_plot(colormap=cmx.gnuplot2).line_series('t','gam*180/3.14159',step=1,skip=0,style={'lw':2.0}) \ # .xlabel('$t$ [s]').ylabel('$\\gamma$ [deg]')\ # .postprocess(ft.partial(save_pic, suffix='evol1_fpa')) # rho = 'rho0*exp(-h/H)' # Cl = '(1.5658*alfa + -0.0000)' # Cd = '(1.6537*alfa**2 + 0.0612)' # # D = '(0.5*'+rho+'*v**2*'+Cd+'*Aref)' # L = '(0.5*'+rho+'*v**2*'+Cl+'*Aref)' # # 90 plots.add_plot(mesh_size=200,colormap=cmx.jet_r)\ .line_series('t','alfa*180/3.14', skip=1, datasource=ds_constraint, style={'lw':2.0}) \ .line('t','alfaMax*180/3.14', datasource=ds_constraint, label='Control limit', style={'lw':2.0,'color':'red'}) \ .xlabel('$t$ [s]').ylabel('$\\alpha$ [deg]') \ .postprocess(ft.partial(add_colorbar, lb=1200, ub=10000, label='$\dot{Q}_{max}$ [W/cm$^2$]',cmap=cmx.jet)) \ .postprocess(ft.partial(save_pic, suffix='evol_qdot_alpha')) plots.add_plot(mesh_size=200,colormap=cmx.jet_r)\ .line_series('t','qdot/1e4', skip=1, datasource=ds_constraint, style={'lw':2.0}) \ .xlabel('$t$ [s]').ylabel('$\\dot{q}$ [W/cm$^2$]') \ .postprocess(ft.partial(add_colorbar, lb=1200, ub=10000, label='$\dot{Q}_{max}$ [W/cm$^2$]',cmap=cmx.jet)) \ .postprocess(ft.partial(save_pic, suffix='evol_qdot_qdot')) plots.add_plot(mesh_size=200,colormap=cmx.jet_r)\ .line_series('t','alfa*180/3.14', skip=1, datasource=ds_epsHR, style={'lw':2.0}) \ .line('t','alfaMax*180/3.14', label='Control limit', datasource=ds_epsHR, style={'lw':2.0,'color':'red'}) \ .xlabel('$t$ [s]').ylabel('$\\alpha$ [deg]') \ .postprocess(ft.partial(add_colorbar, lb=1e-4, ub=1e-6, label='$\epsilon_1$',cmap=cmx.jet, sci_ticks=True)) \
from beluga.visualization import BelugaPlot import matplotlib.pyplot as plt plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') # plots.add_plot().line('x*V*tfreal','y*V*tfreal') \ # .xlabel('x(t)').ylabel('y(t)') \ # .title('Trajectory') plots.add_plot().line('xbar','ybar',label='traj1') \ .xlabel('x(t)').ylabel('y(t)') \ .title('Trajectory') \ .postprocess(lambda a,b,c: plt.axis('equal')) # .line('xc + rc*cos(2*3.14*t/tf)','yc + rc*sin(2*3.14*t/tf)')\ # plots.add_plot().line('t','psi*180/3.14') \ # .xlabel('t (s)').ylabel('psi (deg)') \ # .title('Heading') # plots.add_plot().line('t','u') \ # .xlabel('t (s)').ylabel('u (rad/s)') \ # .title('Control history') # # plots.add_plot().line('t','sqrt((x - x2)**2 + (y - y2)**2)*(V*tfreal)') \ # .xlabel('t').ylabel('Separation (m)') \ # .title('Separation') plots.render()
from beluga.visualization import BelugaPlot # plots = BelugaPlot('./data.dill',default_sol=-1,default_step=0) plots = BelugaPlot('./data.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots.add_plot().line('x','y',label='Solution') \ .xlabel('x(t)').ylabel('y(t)') \ .title('Trajectory') # .line('x','-2-0.75*x',label='Constraint2',step=-1,sol=-1) \ plots.add_plot().line('t','delta*180/3.14') \ .xlabel('t (s)').ylabel('delta (degrees)') \ .title('Steering') # # plots.add_plot().line('t','theta*180/3.14') \ # .xlabel('t (s)').ylabel('theta (degrees)') \ # .title('Heading') plots.render()
rasterized=True, format='pdf', dpi=300) else: plt.savefig(f'{output_dir}/bench_{suffix}.{format}') plots = BelugaPlot('data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') scale = 15 plot1 = plots.add_plot(colormap=cmx.tab10).line(f'xbar*{scale}', f'ybar*{scale}', label='Vehicle 1', style={'lw': 2.0}) plot2 = plots.add_plot(colormap=cmx.tab10).line('t*50', 'abar', label='$\\bar{u}_1(t)$', style={'lw': 2.0}) n = 10 for i in range(2, n + 1): plot1.line(f'xbar{i}*{scale}', f'ybar{i}*{scale}', label=f'Vehicle {i}', style={'lw': 2.0}) plot2.line(f't*50', f'abar{i}', label='$\\bar{u}_' + str(i) + '(t)$',
from beluga.visualization import BelugaPlot from beluga.visualization.datasources import Dill # plots = BelugaPlot('./data.dill',default_sol=-1,default_step=0) mpbvp_ds = Dill('../../mpbvp/planarHypersonicWithHeatRate/data_1200.dill') plots = BelugaPlot('./data_1200_2deg15km_ep4.dill', default_sol=-1, default_step=-1, renderer='matplotlib') plots.add_plot().line('theta*180/3.14','h/1000',label='ICRM Solution') \ .xlabel('Downrange (deg)').ylabel('h (km)') \ .title('Altitude vs. Downrange') \ .line('theta*180/3.14','h/1000',label='MPBVP Solution', datasource=mpbvp_ds, step=-1, sol=-1) \ plots.add_plot().line('t','k*sqrt(rho0*exp(-h/H)/rn)*v**3/10000',label='ICRM Solution') \ .line('t','k*sqrt(rho0*exp(-h/H)/rn)*v**3/10000',label='MPBVP Solution', datasource=mpbvp_ds, step=-1, sol=-1) \ .xlabel('t (s)').ylabel('Heat-rate') \ .title('Heat-rate vs. Time') # plots.add_plot().line('t','theta*180/3.14',label='ICRM Solution') \ # .line('t','theta*180/3.14',label='MPBVP Solution', datasource=mpbvp_ds, step=-1, sol=-1)\ # .line('t','theta*180/3.14',label='Unconstrained Solution', datasource=mpbvp_ds, step=0, sol=-1)\ # .xlabel('t (s)').ylabel('theta (degrees)') \ # .title('Control history') # # plots.add_plot().line('t','lamY', label='ICRM Solution') \ # .line('t','lamY', label='MPBVP Solution', datasource=mpbvp_ds, step=-1, sol=-1)\ # .line('t','lamY', label='Unconstrained Solution', datasource=mpbvp_ds, step=0, sol=-1) \ # .xlabel('t (s)').ylabel('lamY') \ # .title('lamY')
from beluga.visualization import BelugaPlot import matplotlib.pyplot as plt # plots = BelugaPlot('./data-3s3-202.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1, renderer='matplotlib') # plots.add_plot().line('x*V*tfreal','y*V*tfreal')\ # .xlabel('x(t)').ylabel('y(t)')\ # .title('Trajectory') plots.add_plot().line('x','y',label='traj1')\ .line('x2','y2',label='traj2')\ .line('xc1+rc1*cos(2*pi*t/tf)','yc1+rc1*sin(2*pi*t/tf)')\ .line('xc2+rc2*cos(2*pi*t/tf)','yc2+rc2*sin(2*pi*t/tf)')\ .line('xc3+rc3*cos(2*pi*t/tf)','yc3+rc3*sin(2*pi*t/tf)')\ .xlabel('x(t)').ylabel('y(t)')\ .title('Trajectory') \ .postprocess(lambda a,b,c: plt.axis('equal')) # plots.add_plot().line('t','xi11',label='xi11')\ # .line('t','xi21',label='xi21')\ # .line('t','xi31',label='xi31') # .line('x2','y2',label='traj2')\ # .line('xc+rc*cos(2*pi*t/tf)','yc+rc*sin(2*pi*t/tf)')\ # .xlabel('x(t)').ylabel('y(t)')\ # .title('Trajectory') \ # .postprocess(lambda a,b,c: plt.axis('equal')) # plots.add_plot().line('t','z')\ # .xlabel('t (s)').ylabel('theta [deg]')\
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill',default_sol=-1,default_step=-1, renderer='matplotlib') plots.add_plot().line('x','y') \ .xlabel('x(t)').ylabel('y(t)') \ .title('Trajectory') plots.add_plot().line('t','theta') \ .xlabel('t (s)').ylabel('theta (degrees)') \ .title('Control history') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1) plots.add_plot().line('theta*re/1000','h/1000', step=-1) \ .xlabel('Downrange (km)').ylabel('h (km)') \ .title('Altitude vs. Downrange') plots.add_plot().line('t','alfa*180/pi') \ .xlabel('t (s)').ylabel('alfa (degrees)') \ .title('Angle of attack vs. Time') plots.add_plot().line('theta*re/1000','h/1000') \ .xlabel('Downrange (km)').ylabel('h (km)') \ .title('Altitude vs. Downrange') plots.add_plot().line('v/1000','h/1000') \ .xlabel('v (km/s)').ylabel('h (km)') \ .title('Altitude vs. Velocity') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('data.dill', default_sol=-1, default_step=-1) plots.add_plot().line('x','y') \ # .xlabel('t (s)').ylabel('h (km)') \ # .title('Altitude vs. Time') plots.add_plot().line('t', '(-ep*k*lamX*cos(u) - k*lamA*sin(u))') \ .line('t','(-ep*k*lamX*cos(u))') \ .line('t','lamX') \ .line('t','lamA') plots.add_plot().line('t', '-k*(lamX*v*sin(a) - lamY*v*cos(a))*cos(u)') \ # .xlabel('t (s)').ylabel('h (km)') \ # .title('Altitude vs. Time') # plots.add_plot().line('t','alfa*180/3.14') \ # .xlabel('t (s)').ylabel('alfa (degrees)') \ # .title('Angle of attack vs. Time') # plots.add_plot().line('theta*re/1000','h/1000',legend='Foo') \ # .line('theta*re/1000','h/1000',legend='Bar',step=1,sol=5) \ # .xlabel('Downrange (km)') \ # .ylabel('h (km)') \ # .title('Altitude vs. Downrange') plots.render()
from beluga.visualization import BelugaPlot plots = BelugaPlot('./data.dill', default_sol=-1, default_step=-1) plots.add_plot().line('theta*re/1000','h/1000') \ .xlabel('Downrange (km)').ylabel('h (km)') \ .title('Altitude vs. Downrange') plots.add_plot().line('t','alfa*180/3.14') \ .xlabel('t (s)').ylabel('alfa (degrees)') \ .title('Angle of attack vs. Time') # # rho = 'rho0*exp(-h/H)' # Cl = '(1.5658*alfa + -0.0000)' # Cd = '(1.6537*alfa**2 + 0.0612)' # # D = '(0.5*'+rho+'*v**2*'+Cd+'*Aref)' # L = '(0.5*'+rho+'*v**2*'+Cl+'*Aref)' # # plots.add_plot().line('t','sqrt('+D+'**2+'+L+'**2)/(mass*g0)') \ # .xlabel('t (s)').ylabel('G-Loading') \ # .title('G-Loading vs. Time') # plots.add_plot().line('theta*re/1000','h/1000',label='Foo') \ # .line('theta*re/1000','h/1000',label='Bar',step=1,sol=5) \ # .xlabel('Downrange (km)') \ # .ylabel('h (km)') \ # .title('Altitude vs. Downrange') plots.render()