Format
This commit is contained in:
parent
06c68c5167
commit
76d890980c
@ -3,16 +3,14 @@ from pathlib import Path
|
|||||||
|
|
||||||
import fire
|
import fire
|
||||||
import matplotlib
|
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.dates as mdates
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import matplotlib.ticker as mtick
|
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():
|
def create_dfs():
|
||||||
@ -30,7 +28,6 @@ def create_dfs():
|
|||||||
|
|
||||||
plot_df = create_plot_df(None, None)
|
plot_df = create_plot_df(None, None)
|
||||||
|
|
||||||
|
|
||||||
return df, df_state, plot_df
|
return df, df_state, plot_df
|
||||||
|
|
||||||
|
|
||||||
@ -62,13 +59,17 @@ def main():
|
|||||||
vals = regression_curve(date_range.to_numpy())
|
vals = regression_curve(date_range.to_numpy())
|
||||||
print(f"Projizierte Teilnahme am {target_time}: {vals[-1]:.2f}")
|
print(f"Projizierte Teilnahme am {target_time}: {vals[-1]:.2f}")
|
||||||
now = pd.Timestamp.now()
|
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()
|
print()
|
||||||
|
|
||||||
for target in [1500, 2500, 3500]:
|
for target in [1500, 2500, 3500]:
|
||||||
target_reached_date = (target - reg.intercept) / reg.slope
|
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
|
num_skipped_days = 2
|
||||||
|
|
||||||
@ -77,10 +78,25 @@ def main():
|
|||||||
|
|
||||||
delta = 3500 - data[-1]
|
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(
|
||||||
plt.plot(date_range[data.index.argmax() + num_skipped_days:], target_line, label="Ziellinie", color="tab:orange", linestyle=":", zorder=1)
|
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().relim() # make sure all the data fits
|
||||||
# plt.gca().autoscale() # auto-scale
|
# plt.gca().autoscale() # auto-scale
|
||||||
plt.xlabel("Zeit in Tagen ab dem 15.08.")
|
plt.xlabel("Zeit in Tagen ab dem 15.08.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user