Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 59 additions & 49 deletions dashboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,43 +105,10 @@ def update(
ctrl.figure_update(fig)


@state.change("experiment")
def update_on_change_experiment(**kwargs):
# skip if triggered on server ready (all state variables marked as modified)
if len(state.modified_keys) == 1:
print("Experiment changed...")
update(
reset_model=True,
reset_output=True,
reset_parameters=True,
reset_calibration=True,
reset_plots=True,
reset_gui_route_home=True,
reset_gui_route_nersc=False,
reset_gui_route_chat=False,
reset_gui_layout=False,
)


@state.change("model_type", "model_training_time")
def update_on_change_model(**kwargs):
# skip if triggered on server ready (all state variables marked as modified)
if len(state.modified_keys) == 1:
print("Model type changed...")
update(
reset_model=True,
reset_output=False,
reset_parameters=False,
reset_calibration=False,
reset_plots=True,
reset_gui_route_home=True,
reset_gui_route_nersc=False,
reset_gui_route_chat=False,
reset_gui_layout=False,
)


@state.change(
"experiment",
"model_type",
"model_training_time",
"displayed_output",
"parameters",
"opacity",
Expand All @@ -151,21 +118,64 @@ def update_on_change_model(**kwargs):
"simulation_calibration",
"use_inferred_calibration",
)
def update_on_change_others(**kwargs):
def reset(**kwargs):
# skip if triggered on server ready (all state variables marked as modified)
if len(state.modified_keys) == 1:
print("Parameters, opacity changed...")
update(
reset_model=False,
reset_output=False,
reset_parameters=False,
reset_calibration=False,
reset_plots=True,
reset_gui_route_home=False,
reset_gui_route_nersc=False,
reset_gui_route_chat=False,
reset_gui_layout=False,
)
print(f"Reacting to state change in {state.modified_keys}...")
if "experiment" in state.modified_keys:
update(
reset_model=True,
reset_output=True,
reset_parameters=True,
reset_calibration=True,
reset_plots=True,
reset_gui_route_home=True,
reset_gui_route_nersc=False,
reset_gui_route_chat=False,
reset_gui_layout=False,
)
elif any(
key in state.modified_keys
for key in [
"model_type",
"model_training_time",
]
):
update(
reset_model=True,
reset_output=False,
reset_parameters=False,
reset_calibration=False,
reset_plots=True,
reset_gui_route_home=True,
reset_gui_route_nersc=False,
reset_gui_route_chat=False,
reset_gui_layout=False,
)
elif any(
key in state.modified_keys
for key in [
"displayed_output",
"parameters",
"opacity",
"parameters_min",
"parameters_max",
"parameters_show_all",
"simulation_calibration",
"use_inferred_calibration",
]
):
update(
reset_model=False,
reset_output=False,
reset_parameters=False,
reset_calibration=False,
reset_plots=True,
reset_gui_route_home=False,
reset_gui_route_nersc=False,
reset_gui_route_chat=False,
reset_gui_layout=False,
)


def find_simulation(event, db):
Expand Down