Skip to content

Commit

Permalink
MNT: post merge fixes and linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
phmbressan committed Nov 8, 2024
1 parent a5938c5 commit b1f3f9f
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 64 deletions.
24 changes: 0 additions & 24 deletions rocketpy/motors/hybrid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,27 +615,3 @@ def draw(self, filename=None):
None
"""
self.plots.draw(filename)

def info(self, filename=None):
"""Prints out basic data about the Motor.
Parameters
----------
filename : str | None, optional
The path the plot should be saved to. By default None, in which case
the plot will be shown instead of saved. Supported file endings are:
eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff
and webp (these are the formats supported by matplotlib).
Returns
-------
None
"""
self.prints.all()
self.plots.thrust(filename=filename)
return None

def all_info(self):
"""Prints out all data and graphs available about the Motor."""
self.prints.all()
self.plots.all()
15 changes: 0 additions & 15 deletions rocketpy/motors/liquid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,3 @@ def draw(self, filename=None):
None
"""
self.plots.draw(filename)

def info(self):
"""Prints out basic data about the Motor."""
self.prints.all()
self.plots.thrust()

def all_info(self):
"""Prints out all data and graphs available about the Motor.
Return
------
None
"""
self.prints.all()
self.plots.all()
4 changes: 0 additions & 4 deletions rocketpy/motors/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,8 +1063,6 @@ def get_attr_value(obj, attr_name, multiplier=1):
# Write last line
file.write(f"{self.thrust.source[-1, 0]:.4f} {0:.3f}\n")

return None

def info(self, filename=None):
"""Prints out a summary of the data and graphs available about the
Motor.
Expand All @@ -1084,9 +1082,7 @@ def info(self, filename=None):
# Print motor details
self.prints.all()
self.plots.thrust(filename=filename)
return None

@abstractmethod
def all_info(self):
"""Prints out all data and graphs available about the Motor."""
self.prints.all()
Expand Down
10 changes: 0 additions & 10 deletions rocketpy/motors/solid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,13 +741,3 @@ def draw(self, filename=None):
None
"""
self.plots.draw(filename)

def info(self):
"""Prints out basic data about the SolidMotor."""
self.prints.all()
self.plots.thrust()

def all_info(self):
"""Prints out all data and graphs available about the SolidMotor."""
self.prints.all()
self.plots.all()
22 changes: 15 additions & 7 deletions rocketpy/plots/aero_surface_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,24 @@ def draw(self, filename=None):
ax.legend(bbox_to_anchor=(1.05, 1.0), loc="upper left")

plt.tight_layout()
plt.show()
show_or_save_plot(filename)


class _FreeFormFinsPlots(_FinsPlots):
"""Class that contains all free form fin plots."""

# pylint: disable=too-many-statements
def draw(self):
"""Draw the fin shape along with some important information, including
the center line, the quarter line and the center of pressure position.
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.
Parameters
----------
filename : str | None, optional
The path the plot should be saved to. By default None, in which case
the plot will be shown instead of saved. Supported file endings are:
eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff
and webp (these are the formats supported by matplotlib).
Returns
-------
Expand Down Expand Up @@ -469,7 +477,7 @@ def draw(self):
ax.legend(bbox_to_anchor=(1.05, 1.0), loc="upper left")

plt.tight_layout()
plt.show()
show_or_save_plot(filename)


class _TailPlots(_AeroSurfacePlots):
Expand Down Expand Up @@ -506,12 +514,12 @@ def all(self):
class _GenericSurfacePlots(_AeroSurfacePlots):
"""Class that contains all generic surface plots."""

def draw(self):
def draw(self, filename=None):
pass


class _LinearGenericSurfacePlots(_AeroSurfacePlots):
"""Class that contains all linear generic surface plots."""

def draw(self):
def draw(self, filename=None):
pass
5 changes: 2 additions & 3 deletions rocketpy/plots/environment_analysis_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def wind_gust_distribution(self, filename=None):
plt.legend()
show_or_save_plot(filename)

def surface10m_wind_speed_distribution(self, wind_speed_limit=False):
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.
Expand Down Expand Up @@ -1369,8 +1369,7 @@ def surface_wind_speed_distribution_grid(
fig.supylabel("Probability")
show_or_save_plot(filename)

return None

# pylint: disable=too-many-statements
def animate_surface_wind_speed_distribution(self, wind_speed_limit=False):
"""Animation of how the sustained surface wind speed distribution varies
throughout the day. Each frame is a histogram of the wind speed distribution
Expand Down
2 changes: 1 addition & 1 deletion rocketpy/plots/rocket_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

from rocketpy.motors import EmptyMotor, HybridMotor, LiquidMotor, SolidMotor
from rocketpy.rocket.aero_surface import Fins, NoseCone, Tail
from rocketpy.rocket.aero_surface.generic_surface import GenericSurface

from .plot_helpers import show_or_save_plot
from rocketpy.rocket.aero_surface.generic_surface import GenericSurface


class _RocketPlots:
Expand Down

0 comments on commit b1f3f9f

Please sign in to comment.