Skip to content

Commit

Permalink
BUG: discretize source when plotting drag curves if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed May 15, 2024
1 parent 693ffac commit 5f18e45
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions rocketpy/plots/rocket_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,22 @@ def drag_curves(self):
None
"""

x_power_drag_off = self.rocket.power_off_drag.x_array
y_power_drag_off = self.rocket.power_off_drag.y_array
x_power_drag_on = self.rocket.power_on_drag.x_array
y_power_drag_on = self.rocket.power_on_drag.y_array
try:
x_power_drag_on = self.rocket.power_on_drag.x_array
y_power_drag_on = self.rocket.power_on_drag.y_array
except AttributeError:
x_power_drag_on = np.linspace(0, 2, 50)
y_power_drag_on = np.array(

Check warning on line 142 in rocketpy/plots/rocket_plots.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/plots/rocket_plots.py#L140-L142

Added lines #L140 - L142 were not covered by tests
[self.rocket.power_on_drag.source(x) for x in x_power_drag_on]
)
try:
x_power_drag_off = self.rocket.power_off_drag.x_array
y_power_drag_off = self.rocket.power_off_drag.y_array
except AttributeError:
x_power_drag_off = np.linspace(0, 2, 50)
y_power_drag_off = np.array(

Check warning on line 150 in rocketpy/plots/rocket_plots.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/plots/rocket_plots.py#L148-L150

Added lines #L148 - L150 were not covered by tests
[self.rocket.power_off_drag.source(x) for x in x_power_drag_off]
)

fig, ax = plt.subplots()
ax.plot(x_power_drag_on, y_power_drag_on, label="Power on Drag")
Expand Down

0 comments on commit 5f18e45

Please sign in to comment.