Skip to content

Commit

Permalink
Merge branch 'main' into fix/error-element-equality
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaeltimbo authored Sep 19, 2024
2 parents fc4c2f8 + fa13ef3 commit 69a747f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions ross/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,7 @@ def plot(
self,
harmonics=[1],
frequency_units="RPM",
speed_units="RPM",
damping_parameter="log_dec",
frequency_range=None,
damping_range=None,
Expand All @@ -1452,6 +1453,9 @@ def plot(
frequency_units : str, optional
Frequency units.
Default is "RPM".
speed_units : str, optional
Speed units.
Default is "RPM".
damping_parameter : str, optional
Define which value to show for damping. We can use "log_dec" or "damping_ratio".
Default is "log_dec".
Expand Down Expand Up @@ -1489,7 +1493,8 @@ def plot(
... damping_parameter="damping_ratio",
... frequency_range=Q_((2000, 10000), "RPM"),
... damping_range=(-0.1, 100),
... frequency_units="RPM",
... frequency_units="Hz",
... speed_units="RPM",
... )
"""
if damping_parameter == "log_dec":
Expand Down Expand Up @@ -1550,15 +1555,15 @@ def plot(
if len(crit_x) and len(crit_y):
fig.add_trace(
go.Scatter(
x=Q_(crit_x, "rad/s").to(frequency_units).m,
x=Q_(crit_x, "rad/s").to(speed_units).m,
y=Q_(crit_y, "rad/s").to(frequency_units).m,
mode="markers",
marker=dict(symbol="x", color="black"),
name="Crit. Speed",
legendgroup="Crit. Speed",
showlegend=True,
hovertemplate=(
f"Frequency ({frequency_units}): %{{y:.2f}}<br>Critical Speed ({frequency_units}): %{{x:.2f}}"
f"Frequency ({frequency_units}): %{{y:.2f}}<br>Critical Speed ({speed_units}): %{{x:.2f}}"
),
)
)
Expand Down Expand Up @@ -1607,7 +1612,7 @@ def plot(
if any(check for check in mask):
fig.add_trace(
go.Scatter(
x=Q_(speed_range[mask], "rad/s").to(frequency_units).m,
x=Q_(speed_range[mask], "rad/s").to(speed_units).m,
y=Q_(w_i[mask], "rad/s").to(frequency_units).m,
marker=dict(
symbol=mark,
Expand All @@ -1627,7 +1632,7 @@ def plot(
for j, h in enumerate(harmonics):
fig.add_trace(
go.Scatter(
x=Q_(speed_range, "rad/s").to(frequency_units).m,
x=Q_(speed_range, "rad/s").to(speed_units).m,
y=h * Q_(speed_range, "rad/s").to(frequency_units).m,
mode="lines",
line=dict(dash="dashdot", color=list(tableau_colors)[j]),
Expand All @@ -1650,10 +1655,10 @@ def plot(
)

fig.update_xaxes(
title_text=f"Rotor Speed ({frequency_units})",
title_text=f"Rotor Speed ({speed_units})",
range=[
np.min(Q_(speed_range, "rad/s").to(frequency_units).m),
np.max(Q_(speed_range, "rad/s").to(frequency_units).m),
np.min(Q_(speed_range, "rad/s").to(speed_units).m),
np.max(Q_(speed_range, "rad/s").to(speed_units).m),
],
exponentformat="none",
)
Expand Down

0 comments on commit 69a747f

Please sign in to comment.