Ruff format

This commit is contained in:
Chris
2024-10-10 15:00:32 +02:00
committed by Andreas
parent b8e7612bde
commit 141257f514
19 changed files with 101 additions and 286 deletions

View File

@@ -141,9 +141,7 @@ def visualisiere_ergebnisse(
label="Grid Consumption (Wh)",
marker="^",
)
plt.plot(
hours, ergebnisse["Verluste_Pro_Stunde"], label="Losses (Wh)", marker="^"
)
plt.plot(hours, ergebnisse["Verluste_Pro_Stunde"], label="Losses (Wh)", marker="^")
plt.title("Energy Flow per Hour")
plt.xlabel("Hour")
plt.ylabel("Energy (Wh)")
@@ -151,18 +149,14 @@ def visualisiere_ergebnisse(
# State of charge for batteries
plt.subplot(3, 2, 2)
plt.plot(
hours, ergebnisse["akku_soc_pro_stunde"], label="PV Battery (%)", marker="x"
)
plt.plot(hours, ergebnisse["akku_soc_pro_stunde"], label="PV Battery (%)", marker="x")
plt.plot(
hours,
ergebnisse["E-Auto_SoC_pro_Stunde"],
label="E-Car Battery (%)",
marker="x",
)
plt.legend(
loc="upper left", bbox_to_anchor=(1, 1)
) # Place legend outside the plot
plt.legend(loc="upper left", bbox_to_anchor=(1, 1)) # Place legend outside the plot
plt.grid(True, which="both", axis="x") # Grid for every hour
ax1 = plt.subplot(3, 2, 3)
@@ -254,18 +248,12 @@ def visualisiere_ergebnisse(
filtered_losses = np.array(
[
v
for v, n in zip(
extra_data["verluste"], extra_data["nebenbedingung"]
)
for v, n in zip(extra_data["verluste"], extra_data["nebenbedingung"])
if n < 0.01
]
)
filtered_balance = np.array(
[
b
for b, n in zip(extra_data["bilanz"], extra_data["nebenbedingung"])
if n < 0.01
]
[b for b, n in zip(extra_data["bilanz"], extra_data["nebenbedingung"]) if n < 0.01]
)
if filtered_losses.size != 0:
best_loss = min(filtered_losses)
@@ -281,15 +269,11 @@ def visualisiere_ergebnisse(
) # Two subplots, separate y-axes
# First violin plot for losses
axs[0].violinplot(
data[0], positions=[1], showmeans=True, showmedians=True
)
axs[0].violinplot(data[0], positions=[1], showmeans=True, showmedians=True)
axs[1].set(title="Losses", xticks=[1], xticklabels=["Losses"])
# Second violin plot for balance
axs[1].violinplot(
data[1], positions=[1], showmeans=True, showmedians=True
)
axs[1].violinplot(data[1], positions=[1], showmeans=True, showmedians=True)
axs[1].set(title="Balance", xticks=[1], xticklabels=["Balance"])
# Fine-tuning