diff --git a/pdr_backend/sim/sim_plotter.py b/pdr_backend/sim/sim_plotter.py index 882547874..50db010aa 100644 --- a/pdr_backend/sim/sim_plotter.py +++ b/pdr_backend/sim/sim_plotter.py @@ -3,12 +3,12 @@ import pickle import time from datetime import datetime +from typing import Optional import altair as alt import numpy as np import pandas as pd from enforce_typing import enforce_types -from typing import Optional from pdr_backend.aimodel.aimodel_plotdata import AimodelPlotdata diff --git a/sim_plots.py b/sim_plots.py index e7e0f597e..95aa89d3f 100755 --- a/sim_plots.py +++ b/sim_plots.py @@ -32,10 +32,8 @@ sim_plotter = SimPlotter() -def load_canvas_on_state(sim_plotter, new_ts): - titletext = ( - f"Iter #{st.iter_number} ({new_ts})" if new_ts != "final" else "Final sim state" - ) +def load_canvas_on_state(ts): + titletext = f"Iter #{st.iter_number} ({ts})" if ts != "final" else "Final sim state" title.title(titletext) canvas["pdr_profit_vs_time"].altair_chart( @@ -105,12 +103,12 @@ def load_canvas_on_state(sim_plotter, new_ts): time.sleep(1) continue - load_canvas_on_state(sim_plotter, new_ts) + load_canvas_on_state(new_ts) last_ts = new_ts if last_ts == "final": snapshots = SimPlotter.available_snapshots() - timestamp = inputs.select_slider("Go to snapshot", snapshots) + timestamp = inputs.select_slider("Go to snapshot", snapshots, value="final") st, new_ts = sim_plotter.load_state(timestamp) - load_canvas_on_state(sim_plotter, timestamp) + load_canvas_on_state(timestamp) break