diff --git a/CHANGELOG.md b/CHANGELOG.md index 57974eb04..b1197708a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ Attention: The newest changes should be on top --> ### Changed -- +- MNT: Place filename save parameter to the end. [#739](https://github.com/RocketPy-Team/RocketPy/pull/739) ### Fixed diff --git a/rocketpy/mathutils/function.py b/rocketpy/mathutils/function.py index 314e6415b..ca6005cf3 100644 --- a/rocketpy/mathutils/function.py +++ b/rocketpy/mathutils/function.py @@ -1498,6 +1498,7 @@ def plot_1d( # pylint: disable=too-many-statements force_points=False, return_object=False, equal_axis=False, + *, filename=None, ): """Plot 1-Dimensional Function, from a lower limit to an upper limit, @@ -1597,6 +1598,7 @@ def plot_2d( # pylint: disable=too-many-statements disp_type="surface", alpha=0.6, cmap="viridis", + *, filename=None, ): """Plot 2-Dimensional Function, from a lower limit to an upper limit, @@ -1729,6 +1731,7 @@ def compare_plots( # pylint: disable=too-many-statements force_points=False, return_object=False, show=True, + *, filename=None, ): """Plots N 1-Dimensional Functions in the same plot, from a lower diff --git a/rocketpy/motors/hybrid_motor.py b/rocketpy/motors/hybrid_motor.py index b3527c604..58c2fab8e 100644 --- a/rocketpy/motors/hybrid_motor.py +++ b/rocketpy/motors/hybrid_motor.py @@ -601,7 +601,7 @@ def add_tank(self, tank, position): ) reset_funcified_methods(self) - def draw(self, filename=None): + def draw(self, *, filename=None): """Draws a representation of the HybridMotor. Parameters diff --git a/rocketpy/motors/liquid_motor.py b/rocketpy/motors/liquid_motor.py index cc7bf5027..d99d0165b 100644 --- a/rocketpy/motors/liquid_motor.py +++ b/rocketpy/motors/liquid_motor.py @@ -463,7 +463,7 @@ def add_tank(self, tank, position): self.positioned_tanks.append({"tank": tank, "position": position}) reset_funcified_methods(self) - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw a representation of the LiquidMotor. Parameters diff --git a/rocketpy/motors/motor.py b/rocketpy/motors/motor.py index 558c9f9a2..93571b879 100644 --- a/rocketpy/motors/motor.py +++ b/rocketpy/motors/motor.py @@ -1083,7 +1083,7 @@ def get_attr_value(obj, attr_name, multiplier=1): # Write last line file.write(f"{self.thrust.source[-1, 0]:.4f} {0:.3f}\n") - def info(self, filename=None): + def info(self, *, filename=None): """Prints out a summary of the data and graphs available about the Motor. diff --git a/rocketpy/motors/solid_motor.py b/rocketpy/motors/solid_motor.py index 09a930522..9f8622cea 100644 --- a/rocketpy/motors/solid_motor.py +++ b/rocketpy/motors/solid_motor.py @@ -727,7 +727,7 @@ def propellant_I_13(self): def propellant_I_23(self): return 0 - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw a representation of the SolidMotor. Parameters diff --git a/rocketpy/motors/tank.py b/rocketpy/motors/tank.py index 418124cf0..14511eab0 100644 --- a/rocketpy/motors/tank.py +++ b/rocketpy/motors/tank.py @@ -476,7 +476,7 @@ def underfill_height_exception(param_name, param): elif (height < bottom_tolerance).any(): underfill_height_exception(name, height) - def draw(self, filename=None): + def draw(self, *, filename=None): """Draws the tank geometry. Parameters diff --git a/rocketpy/plots/aero_surface_plots.py b/rocketpy/plots/aero_surface_plots.py index a0b7d4c4b..d501d1352 100644 --- a/rocketpy/plots/aero_surface_plots.py +++ b/rocketpy/plots/aero_surface_plots.py @@ -25,7 +25,7 @@ def __init__(self, aero_surface): self.aero_surface = aero_surface @abstractmethod - def draw(self, filename=None): + def draw(self, *, filename=None): pass def lift(self): @@ -54,7 +54,7 @@ class _NoseConePlots(_AeroSurfacePlots): """Class that contains all nosecone plots. This class inherits from the _AeroSurfacePlots class.""" - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw the nosecone shape along with some important information, including the center line and the center of pressure position. @@ -140,7 +140,7 @@ class _FinsPlots(_AeroSurfacePlots): _AeroSurfacePlots class.""" @abstractmethod - def draw(self, filename=None): + def draw(self, *, filename=None): pass def airfoil(self): @@ -201,7 +201,7 @@ class _TrapezoidalFinsPlots(_FinsPlots): """Class that contains all trapezoidal fin plots.""" # pylint: disable=too-many-statements - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw the fin shape along with some important information, including the center line, the quarter line and the center of pressure position. @@ -330,7 +330,7 @@ class _EllipticalFinsPlots(_FinsPlots): """Class that contains all elliptical fin plots.""" # pylint: disable=too-many-statements - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw the fin shape along with some important information. These being: the center line and the center of pressure position. @@ -409,7 +409,7 @@ class _FreeFormFinsPlots(_FinsPlots): """Class that contains all free form fin plots.""" # pylint: disable=too-many-statements - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw the fin shape along with some important information. These being: the center line and the center of pressure position. @@ -483,7 +483,7 @@ def draw(self, filename=None): class _TailPlots(_AeroSurfacePlots): """Class that contains all tail plots.""" - def draw(self, filename=None): + def draw(self, *, filename=None): # This will de done in the future pass @@ -498,7 +498,7 @@ def drag_coefficient_curve(self): else: return self.aero_surface.drag_coefficient.plot() - def draw(self, filename=None): + def draw(self, *, filename=None): raise NotImplementedError def all(self): @@ -514,12 +514,12 @@ def all(self): class _GenericSurfacePlots(_AeroSurfacePlots): """Class that contains all generic surface plots.""" - def draw(self, filename=None): + def draw(self, *, filename=None): pass class _LinearGenericSurfacePlots(_AeroSurfacePlots): """Class that contains all linear generic surface plots.""" - def draw(self, filename=None): + def draw(self, *, filename=None): pass diff --git a/rocketpy/plots/environment_analysis_plots.py b/rocketpy/plots/environment_analysis_plots.py index b5b63642c..010ae5c06 100644 --- a/rocketpy/plots/environment_analysis_plots.py +++ b/rocketpy/plots/environment_analysis_plots.py @@ -74,7 +74,7 @@ def __beaufort_wind_scale(self, units, max_wind_speed=None): # Surface level plots - def wind_gust_distribution(self, filename=None): + def wind_gust_distribution(self, *, filename=None): """Get all values of wind gust speed (for every date and hour available) and plot a single distribution. Expected result is a Weibull distribution, however, the result is not always a perfect fit, and sometimes it may @@ -124,7 +124,9 @@ def wind_gust_distribution(self, filename=None): plt.legend() show_or_save_plot(filename) - def surface10m_wind_speed_distribution(self, wind_speed_limit=False, filename=None): + def surface10m_wind_speed_distribution( + self, wind_speed_limit=False, *, filename=None + ): """Get all values of sustained surface wind speed (for every date and hour available) and plot a single distribution. Expected result is a Weibull distribution. The wind speed limit is plotted as a vertical line. @@ -190,6 +192,7 @@ def surface10m_wind_speed_distribution(self, wind_speed_limit=False, filename=No def average_surface_temperature_evolution( self, + *, filename=None, ): # pylint: disable=too-many-statements """Plots average temperature progression throughout the day, including @@ -265,7 +268,7 @@ def average_surface_temperature_evolution( show_or_save_plot(filename) def average_surface10m_wind_speed_evolution( - self, wind_speed_limit=False, filename=None + self, wind_speed_limit=False, *, filename=None ): # pylint: disable=too-many-statements """Plots average surface wind speed progression throughout the day, including sigma contours. @@ -366,6 +369,7 @@ def average_surface10m_wind_speed_evolution( def average_surface100m_wind_speed_evolution( self, + *, filename=None, ): # pylint: disable=too-many-statements """Plots average surface wind speed progression throughout the day, including @@ -449,7 +453,7 @@ def average_surface100m_wind_speed_evolution( # Average profiles plots (pressure level data) - def average_wind_speed_profile(self, clear_range_limits=False, filename=None): + def average_wind_speed_profile(self, clear_range_limits=False, *, filename=None): """Average wind speed for all datetimes available. The plot also includes sigma contours. @@ -554,7 +558,9 @@ def average_wind_speed_profile(self, clear_range_limits=False, filename=None): ) show_or_save_plot(filename) - def average_wind_velocity_xy_profile(self, clear_range_limits=False, filename=None): + def average_wind_velocity_xy_profile( + self, clear_range_limits=False, *, filename=None + ): """Average wind X and wind Y for all datetimes available. The X component is the wind speed in the direction of East, and the Y component is the wind speed in the direction of North. @@ -621,7 +627,7 @@ def average_wind_velocity_xy_profile(self, clear_range_limits=False, filename=No plt.grid() show_or_save_plot(filename) - def average_wind_heading_profile(self, clear_range_limits=False, filename=None): + def average_wind_heading_profile(self, clear_range_limits=False, *, filename=None): """Average wind heading for all datetimes available. Parameters @@ -679,7 +685,7 @@ def average_wind_heading_profile(self, clear_range_limits=False, filename=None): plt.legend() show_or_save_plot(filename) - def average_pressure_profile(self, clear_range_limits=False, filename=None): + def average_pressure_profile(self, clear_range_limits=False, *, filename=None): """Average pressure profile for all datetimes available. The plot also includes sigma contours. @@ -772,7 +778,7 @@ def average_pressure_profile(self, clear_range_limits=False, filename=None): ) show_or_save_plot(filename) - def average_temperature_profile(self, clear_range_limits=False, filename=None): + def average_temperature_profile(self, clear_range_limits=False, *, filename=None): """Average temperature profile for all datetimes available. The plot also includes sigma contours. @@ -918,7 +924,7 @@ def plot_wind_rose( ax.yaxis.set_major_formatter(mtick.PercentFormatter(decimals=0)) return ax - def average_wind_rose_specific_hour(self, hour, fig=None, filename=None): + def average_wind_rose_specific_hour(self, hour, fig=None, *, filename=None): """Plot a specific hour of the average windrose Parameters @@ -952,7 +958,7 @@ def average_wind_rose_specific_hour(self, hour, fig=None, filename=None): show_or_save_plot(filename) def average_wind_rose_grid( - self, filename=None + self, *, filename=None ): # pylint: disable=too-many-statements """Plot wind roses for all hours of a day, in a grid like plot. @@ -1088,7 +1094,7 @@ def animate_average_wind_rose(self, figsize=(5, 5), filename="wind_rose.gif"): # More plots and animations def wind_gust_distribution_grid( - self, filename=None + self, *, filename=None ): # pylint: disable=too-many-statements """Plots shown in the animation of how the wind gust distribution varies throughout the day. @@ -1264,7 +1270,7 @@ def update(frame): return HTML(animation.to_jshtml()) def surface_wind_speed_distribution_grid( - self, wind_speed_limit=False, filename=None + self, wind_speed_limit=False, *, filename=None ): # pylint: disable=too-many-statements """Plots shown in the animation of how the sustained surface wind speed distribution varies throughout the day. The plots are histograms of the @@ -1493,7 +1499,7 @@ def update(frame): return HTML(animation.to_jshtml()) def wind_speed_profile_grid( - self, clear_range_limits=False, filename=None + self, clear_range_limits=False, *, filename=None ): # pylint: disable=too-many-statements """Creates a grid of plots with the wind profile over the average day. Each subplot represents a different hour of the day. @@ -1592,7 +1598,7 @@ def wind_speed_profile_grid( show_or_save_plot(filename) def wind_heading_profile_grid( - self, clear_range_limits=False, filename=None + self, clear_range_limits=False, *, filename=None ): # pylint: disable=too-many-statements """Creates a grid of plots with the wind heading profile over the average day. Each subplot represents a different hour of the day. diff --git a/rocketpy/plots/environment_plots.py b/rocketpy/plots/environment_plots.py index f15d066af..4b8a91e15 100644 --- a/rocketpy/plots/environment_plots.py +++ b/rocketpy/plots/environment_plots.py @@ -173,7 +173,7 @@ def __pressure_temperature(self, ax): return ax - def gravity_model(self, filename=None): + def gravity_model(self, *, filename=None): """Plots the gravity model graph that represents the gravitational acceleration as a function of height. @@ -204,7 +204,7 @@ def gravity_model(self, filename=None): show_or_save_plot(filename) - def atmospheric_model(self, filename=None): + def atmospheric_model(self, *, filename=None): """Plots all atmospheric model graphs available. This includes wind speed and wind direction, density and speed of sound, wind u and wind v, and pressure and temperature. @@ -245,7 +245,7 @@ def atmospheric_model(self, filename=None): show_or_save_plot(filename) # pylint: disable=too-many-statements - def ensemble_member_comparison(self, filename=None): + def ensemble_member_comparison(self, *, filename=None): """Plots ensemble member comparisons. It requires that the environment model has been set as Ensemble. @@ -352,7 +352,7 @@ def ensemble_member_comparison(self, filename=None): # Clean up self.environment.select_ensemble_member(current_member) - def info(self, filename=None): + def info(self, *, filename=None): """Plots a summary of the atmospheric model, including wind speed and wind direction, density and speed of sound. This is important for the Environment.info() method. diff --git a/rocketpy/plots/flight_plots.py b/rocketpy/plots/flight_plots.py index edc30b956..9ece84cdd 100644 --- a/rocketpy/plots/flight_plots.py +++ b/rocketpy/plots/flight_plots.py @@ -54,7 +54,7 @@ def first_event_time_index(self): else: return -1 - def trajectory_3d(self, filename=None): # pylint: disable=too-many-statements + def trajectory_3d(self, *, filename=None): # pylint: disable=too-many-statements """Plot a 3D graph of the trajectory Parameters @@ -134,7 +134,7 @@ def trajectory_3d(self, filename=None): # pylint: disable=too-many-statements show_or_save_plot(filename) def linear_kinematics_data( - self, filename=None + self, *, filename=None ): # pylint: disable=too-many-statements """Prints out all Kinematics graphs available about the Flight @@ -215,7 +215,7 @@ def linear_kinematics_data( plt.subplots_adjust(hspace=0.5) show_or_save_plot(filename) - def attitude_data(self, filename=None): # pylint: disable=too-many-statements + def attitude_data(self, *, filename=None): # pylint: disable=too-many-statements """Prints out all Angular position graphs available about the Flight Parameters @@ -273,7 +273,7 @@ def attitude_data(self, filename=None): # pylint: disable=too-many-statements plt.subplots_adjust(hspace=0.5) show_or_save_plot(filename) - def flight_path_angle_data(self, filename=None): + def flight_path_angle_data(self, *, filename=None): """Prints out Flight path and Rocket Attitude angle graphs available about the Flight @@ -324,7 +324,7 @@ def flight_path_angle_data(self, filename=None): show_or_save_plot(filename) def angular_kinematics_data( - self, filename=None + self, *, filename=None ): # pylint: disable=too-many-statements """Prints out all Angular velocity and acceleration graphs available about the Flight @@ -399,7 +399,9 @@ def angular_kinematics_data( plt.subplots_adjust(hspace=0.5) show_or_save_plot(filename) - def rail_buttons_forces(self, filename=None): # pylint: disable=too-many-statements + def rail_buttons_forces( + self, *, filename=None + ): # pylint: disable=too-many-statements """Prints out all Rail Buttons Forces graphs available about the Flight. Parameters @@ -490,7 +492,9 @@ def rail_buttons_forces(self, filename=None): # pylint: disable=too-many-statem plt.subplots_adjust(hspace=0.5) show_or_save_plot(filename) - def aerodynamic_forces(self, filename=None): # pylint: disable=too-many-statements + def aerodynamic_forces( + self, *, filename=None + ): # pylint: disable=too-many-statements """Prints out all Forces and Moments graphs available about the Flight Parameters @@ -578,7 +582,7 @@ def aerodynamic_forces(self, filename=None): # pylint: disable=too-many-stateme plt.subplots_adjust(hspace=0.5) show_or_save_plot(filename) - def energy_data(self, filename=None): # pylint: disable=too-many-statements + def energy_data(self, *, filename=None): # pylint: disable=too-many-statements """Prints out all Energy components graphs available about the Flight Parameters @@ -698,7 +702,7 @@ def energy_data(self, filename=None): # pylint: disable=too-many-statements show_or_save_plot(filename) def fluid_mechanics_data( - self, filename=None + self, *, filename=None ): # pylint: disable=too-many-statements """Prints out a summary of the Fluid Mechanics graphs available about the Flight @@ -798,7 +802,7 @@ def fluid_mechanics_data( show_or_save_plot(filename) def stability_and_control_data( - self, filename=None + self, *, filename=None ): # pylint: disable=too-many-statements """Prints out Rocket Stability and Control parameters graphs available about the Flight @@ -887,7 +891,7 @@ def stability_and_control_data( plt.subplots_adjust(hspace=0.5) show_or_save_plot(filename) - def pressure_rocket_altitude(self, filename=None): + def pressure_rocket_altitude(self, *, filename=None): """Plots out pressure at rocket's altitude. Parameters diff --git a/rocketpy/plots/hybrid_motor_plots.py b/rocketpy/plots/hybrid_motor_plots.py index eb13c4d69..61dc0940e 100644 --- a/rocketpy/plots/hybrid_motor_plots.py +++ b/rocketpy/plots/hybrid_motor_plots.py @@ -14,7 +14,7 @@ class _HybridMotorPlots(_MotorPlots): """ - def grain_inner_radius(self, lower_limit=None, upper_limit=None, filename=None): + def grain_inner_radius(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots grain_inner_radius of the hybrid_motor as a function of time. Parameters @@ -40,7 +40,7 @@ def grain_inner_radius(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def grain_height(self, lower_limit=None, upper_limit=None, filename=None): + def grain_height(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots grain_height of the hybrid_motor as a function of time. Parameters @@ -66,7 +66,7 @@ def grain_height(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def burn_rate(self, lower_limit=None, upper_limit=None, filename=None): + def burn_rate(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots burn_rate of the hybrid_motor as a function of time. Parameters @@ -92,7 +92,7 @@ def burn_rate(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def burn_area(self, lower_limit=None, upper_limit=None, filename=None): + def burn_area(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots burn_area of the hybrid_motor as a function of time. Parameters @@ -118,7 +118,7 @@ def burn_area(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def Kn(self, lower_limit=None, upper_limit=None, filename=None): + def Kn(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots Kn of the hybrid_motor as a function of time. Parameters @@ -144,7 +144,7 @@ def Kn(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw a representation of the HybridMotor. Parameters diff --git a/rocketpy/plots/liquid_motor_plots.py b/rocketpy/plots/liquid_motor_plots.py index 822364fc2..08a385802 100644 --- a/rocketpy/plots/liquid_motor_plots.py +++ b/rocketpy/plots/liquid_motor_plots.py @@ -14,7 +14,7 @@ class _LiquidMotorPlots(_MotorPlots): """ - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw a representation of the LiquidMotor. Parameters diff --git a/rocketpy/plots/motor_plots.py b/rocketpy/plots/motor_plots.py index e7ddb7efa..8ed7e3fd6 100644 --- a/rocketpy/plots/motor_plots.py +++ b/rocketpy/plots/motor_plots.py @@ -29,7 +29,7 @@ def __init__(self, motor): """ self.motor = motor - def thrust(self, lower_limit=None, upper_limit=None, filename=None): + def thrust(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots thrust of the motor as a function of time. Parameters @@ -52,7 +52,7 @@ def thrust(self, lower_limit=None, upper_limit=None, filename=None): """ self.motor.thrust.plot(lower=lower_limit, upper=upper_limit, filename=filename) - def total_mass(self, lower_limit=None, upper_limit=None, filename=None): + def total_mass(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots total_mass of the motor as a function of time. Parameters @@ -77,7 +77,7 @@ def total_mass(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def propellant_mass(self, lower_limit=None, upper_limit=None, filename=None): + def propellant_mass(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots propellant_mass of the motor as a function of time. Parameters @@ -102,7 +102,7 @@ def propellant_mass(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def center_of_mass(self, lower_limit=None, upper_limit=None, filename=None): + def center_of_mass(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots center_of_mass of the motor as a function of time. Parameters @@ -127,7 +127,7 @@ def center_of_mass(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def mass_flow_rate(self, lower_limit=None, upper_limit=None, filename=None): + def mass_flow_rate(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots mass_flow_rate of the motor as a function of time. Parameters @@ -152,7 +152,7 @@ def mass_flow_rate(self, lower_limit=None, upper_limit=None, filename=None): lower=lower_limit, upper=upper_limit, filename=filename ) - def exhaust_velocity(self, lower_limit=None, upper_limit=None, filename=None): + def exhaust_velocity(self, lower_limit=None, upper_limit=None, *, filename=None): """Plots exhaust_velocity of the motor as a function of time. Parameters @@ -178,7 +178,7 @@ def exhaust_velocity(self, lower_limit=None, upper_limit=None, filename=None): ) def inertia_tensor( - self, lower_limit=None, upper_limit=None, show_products=False, filename=None + self, lower_limit=None, upper_limit=None, show_products=False, *, filename=None ): """Plots all inertia tensors (I_11, I_22, I_33, I_12, I_13, I_23) of the motor as a function of time in a single chart. diff --git a/rocketpy/plots/rocket_plots.py b/rocketpy/plots/rocket_plots.py index 9689a257b..f305fcb99 100644 --- a/rocketpy/plots/rocket_plots.py +++ b/rocketpy/plots/rocket_plots.py @@ -54,7 +54,7 @@ def reduced_mass(self): self.rocket.reduced_mass() - def static_margin(self, filename=None): + def static_margin(self, *, filename=None): """Plots static margin of the rocket as a function of time. Parameters @@ -123,7 +123,7 @@ def power_off_drag(self): self.rocket.power_off_drag() # pylint: disable=too-many-statements - def drag_curves(self, filename=None): + def drag_curves(self, *, filename=None): """Plots power off and on drag curves of the rocket as a function of time. Parameters @@ -179,7 +179,7 @@ def thrust_to_weight(self): lower=0, upper=self.rocket.motor.burn_out_time ) - def draw(self, vis_args=None, plane="xz", filename=None): + def draw(self, vis_args=None, plane="xz", *, filename=None): """Draws the rocket in a matplotlib figure. Parameters diff --git a/rocketpy/plots/solid_motor_plots.py b/rocketpy/plots/solid_motor_plots.py index 202220102..cda7bb718 100644 --- a/rocketpy/plots/solid_motor_plots.py +++ b/rocketpy/plots/solid_motor_plots.py @@ -113,7 +113,7 @@ def Kn(self, lower_limit=None, upper_limit=None): self.motor.Kn.plot(lower=lower_limit, upper=upper_limit) - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw a representation of the SolidMotor. Parameters diff --git a/rocketpy/plots/tank_plots.py b/rocketpy/plots/tank_plots.py index a4bc0dd2a..6f1c0e5f2 100644 --- a/rocketpy/plots/tank_plots.py +++ b/rocketpy/plots/tank_plots.py @@ -69,7 +69,7 @@ def _generate_tank(self, translate=(0, 0), csys=1): # Don't set any plot config here. Use the draw methods for that return tank - def draw(self, filename=None): + def draw(self, *, filename=None): """Draws the tank geometry. Parameters diff --git a/rocketpy/rocket/aero_surface/fins/fins.py b/rocketpy/rocket/aero_surface/fins/fins.py index c7973bc69..3c98855d0 100644 --- a/rocketpy/rocket/aero_surface/fins/fins.py +++ b/rocketpy/rocket/aero_surface/fins/fins.py @@ -426,7 +426,7 @@ def compute_forces_and_moments( M3 = M3_forcing - M3_damping return R1, R2, R3, M1, M2, M3 - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw the fin shape along with some important information, including the center line, the quarter line and the center of pressure position. diff --git a/rocketpy/rocket/aero_surface/nose_cone.py b/rocketpy/rocket/aero_surface/nose_cone.py index e9fbe4324..6c295d1c5 100644 --- a/rocketpy/rocket/aero_surface/nose_cone.py +++ b/rocketpy/rocket/aero_surface/nose_cone.py @@ -486,7 +486,7 @@ def evaluate_center_of_pressure(self): self.cp = (self.cpx, self.cpy, self.cpz) return self.cp - def draw(self, filename=None): + def draw(self, *, filename=None): """Draw the nosecone shape along with some important information, including the center of pressure position. diff --git a/rocketpy/rocket/rocket.py b/rocketpy/rocket/rocket.py index 58067a03f..aacf5b4a6 100644 --- a/rocketpy/rocket/rocket.py +++ b/rocketpy/rocket/rocket.py @@ -1839,7 +1839,7 @@ def add_thrust_eccentricity(self, x, y): self.thrust_eccentricity_x = y return self - def draw(self, vis_args=None, plane="xz", filename=None): + def draw(self, vis_args=None, plane="xz", *, filename=None): """Draws the rocket in a matplotlib figure. Parameters @@ -1872,7 +1872,7 @@ def draw(self, vis_args=None, plane="xz", filename=None): eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff and webp (these are the formats supported by matplotlib). """ - self.plots.draw(vis_args, plane, filename) + self.plots.draw(vis_args, plane, filename=filename) def info(self): """Prints out a summary of the data and graphs available about diff --git a/rocketpy/utilities.py b/rocketpy/utilities.py index fb728dbb6..f6e68d162 100644 --- a/rocketpy/utilities.py +++ b/rocketpy/utilities.py @@ -208,6 +208,7 @@ def fin_flutter_analysis( flight, see_prints=True, see_graphs=True, + *, filename=None, ): """Calculate and plot the Fin Flutter velocity using the pressure profile @@ -320,7 +321,7 @@ def _flutter_safety_factor(flight, flutter_mach): return safety_factor -def _flutter_plots(flight, flutter_mach, safety_factor, filename=None): +def _flutter_plots(flight, flutter_mach, safety_factor, *, filename=None): """Plot the Fin Flutter Mach Number and the Safety Factor for the flutter. Parameters