CompareFlights#

class rocketpy.plots.compare.CompareFlights[source]#

A class to compare the results of multiple flights.

Parameters:

flights (list) – A list of Flight objects to be compared.

Variables:

flights (list) – A list of Flight objects to be compared.

__init__(flights)[source]#

Initializes the CompareFlights class.

Parameters:

flights (list) – A list of Flight objects to be compared.

Return type:

None

positions(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the position of the rocket in the three dimensions separately.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

velocities(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the velocity of the rocket in the three dimensions separately.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

stream_velocities(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a stream plot of the free stream velocity of the rocket in the three dimensions separately. The free stream velocity is the velocity of the rocket relative to the air.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10 * 4 / 3), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

accelerations(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the acceleration of the rocket in the three dimensions separately.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

euler_angles(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the euler angles of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

quaternions(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the quaternions of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

attitude_angles(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the attitude angles of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

angular_velocities(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the angular velocities of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

angular_accelerations(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the angular accelerations of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

aerodynamic_forces(figsize=(7, 6.666666666666667), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the aerodynamic forces of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None. Image options are: png, pdf, ps, eps and svg.

Return type:

None

aerodynamic_moments(figsize=(7, 6.666666666666667), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the aerodynamic moments of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

energies(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the energies of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

powers(figsize=(7, 6.666666666666667), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the powers of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

rail_buttons_forces(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the forces acting on the rail buttons of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

angles_of_attack(figsize=(7, 3.3333333333333335), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the angles of attack of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

fluid_mechanics(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots a comparison of the fluid mechanics of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

stability_margin(figsize=(7, 10), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots the stability margin of the rocket for the different flights. The stability margin here is different than the static margin, it is the difference between the center of pressure and the center of gravity of the rocket varying with time.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

attitude_frequency(figsize=(7, 13.333333333333334), x_lim=None, y_lim=None, legend=True, filename=None)[source]#

Plots the frequency of the attitude of the rocket for the different flights.

Parameters:
  • figsize (tuple, optional) – standard matplotlib figsize to be used in the plots, by default (7, 10), where the tuple means (width, height).

  • x_lim (tuple) – A list of two items, where the first item represents the x axis lower limit and second item, the x axis upper limit. If set to None, will be calculated automatically by matplotlib. If the string “apogee” is used as a item for the tuple, the maximum apogee time of all flights will be used instead.

  • y_lim (tuple) – A list of two item, where the first item represents the y axis lower limit and second item, the y axis upper limit. If set to None, will be calculated automatically by matplotlib.

  • legend (bool, optional) – Weather or not to show the legend, by default True

  • filename (str, optional) – If a filename is provided, the plot will be saved to a file, by default None.

Return type:

None

static compare_trajectories_3d(flights, names_list=None, figsize=(7, 7), legend=None, filename=None)[source]#

Creates a trajectory plot combining the trajectories listed. This function was created based two source-codes: - Mateus Stano: RocketPy-Team/Hackathon_2020#123 - Dyllon Preston: Dyllon-P/MBS-Template Also, some of the credits go to Georgia Tech Experimental Rocketry Club (GTXR) as well. The final function was created by the RocketPy Team.

Parameters:
  • flights (list, array) – List of trajectories. Must be in the form of [trajectory_1, trajectory_2, …, trajectory_n] where each element is a list with the arrays regarding positions in x, y, z [x, y, z]. The trajectories must be in the same reference frame. The z coordinate must be referenced to the ground or to the sea level, but it is important that all trajectories are passed in the same reference.

  • names_list (list) – List of strings with the name of each trajectory inputted. The names must be in the same order as the trajectories in flights. If no names are passed, the trajectories will be named as “Trajectory 1”, “Trajectory 2”, …, “Trajectory n”.

  • figsize (tuple, optional) – Tuple with the size of the figure. The default is (7,7).

  • legend (boolean, optional) – Whether legend will or will not be plotted. Default is True

  • filename (string, optional) – If a filename is passed, the figure will be saved in the current directory. The default is None.

Return type:

None

trajectories_3d(figsize=(7, 7), legend=None, filename=None)[source]#

Creates a trajectory plot that is the combination of the trajectories of the Flight objects passed via a Python list.

Parameters:
  • figsize (tuple, optional) – Tuple with the size of the figure. The default is (7, 7). The tuple must be in the form (width, height).

  • legend (boolean, optional) – Whether legend will or will not be included. Default is True

  • savefig (string, optional) – If a string is passed, the figure will be saved in the path passed.

Return type:

None

trajectories_2d(plane='xy', figsize=(7, 7), legend=None, filename=None)[source]#

Creates a 2D trajectory plot that is the combination of the trajectories of the Flight objects passed via a Python list.

Parameters:
  • legend (boolean, optional) – Whether legend will or will not be included. Default is True

  • plane (string, optional) –

    The plane in which the trajectories will be plotted. The default is “xy”. The options are:

    • ”xy”: X-Y plane

    • ”xz”: X-Z plane

    • ”yz”: Y-Z plane

  • filename (string, optional) – If a string is passed, the figure will be saved in the path passed. The image format options are: .png, .jpg, .jpeg, .tiff, .bmp, .pdf, .svg, .pgf, .eps.

  • figsize (tuple, optional) – Tuple with the size of the figure. The default is (7, 7).

Return type:

None

all()[source]#

Prints out all data and graphs available about the Flight.

Return type:

None