Format
This commit is contained in:
parent
06c68c5167
commit
76d890980c
@ -3,16 +3,14 @@ from pathlib import Path
|
||||
|
||||
import fire
|
||||
import matplotlib
|
||||
import matplotlib.pyplot as plt
|
||||
import scipy
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from wsgi import create_fig, create_plot_df, plot
|
||||
|
||||
import matplotlib.dates as mdates
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.ticker as mtick
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import scipy
|
||||
|
||||
from wsgi import create_fig, create_plot_df, plot
|
||||
|
||||
|
||||
def create_dfs():
|
||||
@ -30,14 +28,13 @@ def create_dfs():
|
||||
|
||||
plot_df = create_plot_df(None, None)
|
||||
|
||||
|
||||
return df, df_state, plot_df
|
||||
|
||||
|
||||
def main():
|
||||
df, df_state, plot_df = create_dfs()
|
||||
|
||||
plot(plot_df, landesbez_str=[None], max_shading_date = "2023-10-02")
|
||||
plot(plot_df, landesbez_str=[None], max_shading_date="2023-10-02")
|
||||
|
||||
plt.gcf().set_size_inches(10, 5)
|
||||
|
||||
@ -62,13 +59,17 @@ def main():
|
||||
vals = regression_curve(date_range.to_numpy())
|
||||
print(f"Projizierte Teilnahme am {target_time}: {vals[-1]:.2f}")
|
||||
now = pd.Timestamp.now()
|
||||
print(f"Projizierte Teilnahme jetzt: {regression_curve(pd.Series([now]).to_numpy()).item():.2f}")
|
||||
print(
|
||||
f"Projizierte Teilnahme jetzt: {regression_curve(pd.Series([now]).to_numpy()).item():.2f}"
|
||||
)
|
||||
|
||||
print()
|
||||
|
||||
for target in [1500, 2500, 3500]:
|
||||
target_reached_date = (target - reg.intercept) / reg.slope
|
||||
print(f"Ziel {target} erreicht am {pd.Timestamp(target_reached_date).strftime('%Y-%m-%d %X')}")
|
||||
print(
|
||||
f"Ziel {target} erreicht am {pd.Timestamp(target_reached_date).strftime('%Y-%m-%d %X')}"
|
||||
)
|
||||
|
||||
num_skipped_days = 2
|
||||
|
||||
@ -77,10 +78,25 @@ def main():
|
||||
|
||||
delta = 3500 - data[-1]
|
||||
|
||||
target_line = data[-1] + delta / (x[-1] - curr_time) * (x[data.index.argmax() + num_skipped_days:] - curr_time)
|
||||
target_line = data[-1] + delta / (x[-1] - curr_time) * (
|
||||
x[data.index.argmax() + num_skipped_days :] - curr_time
|
||||
)
|
||||
|
||||
plt.plot(date_range, vals, label=f"Lineare Regression ($R^2={reg.rvalue**2:.3f}$)", color="tab:blue", zorder=1)
|
||||
plt.plot(date_range[data.index.argmax() + num_skipped_days:], target_line, label="Ziellinie", color="tab:orange", linestyle=":", zorder=1)
|
||||
plt.plot(
|
||||
date_range,
|
||||
vals,
|
||||
label=f"Lineare Regression ($R^2={reg.rvalue**2:.3f}$)",
|
||||
color="tab:blue",
|
||||
zorder=1,
|
||||
)
|
||||
plt.plot(
|
||||
date_range[data.index.argmax() + num_skipped_days :],
|
||||
target_line,
|
||||
label="Ziellinie",
|
||||
color="tab:orange",
|
||||
linestyle=":",
|
||||
zorder=1,
|
||||
)
|
||||
# plt.gca().relim() # make sure all the data fits
|
||||
# plt.gca().autoscale() # auto-scale
|
||||
plt.xlabel("Zeit in Tagen ab dem 15.08.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user