Spaces:
Sleeping
Sleeping
dzs commited on
Commit ·
cab891c
1
Parent(s): e161839
added debug mechanism
Browse files
main.py
CHANGED
|
@@ -7,6 +7,8 @@ from transportEqs import *
|
|
| 7 |
import numpy as np
|
| 8 |
from Kps_function.read_Kps_model import *
|
| 9 |
import os
|
|
|
|
|
|
|
| 10 |
|
| 11 |
app = Dash(
|
| 12 |
__name__,
|
|
@@ -587,6 +589,19 @@ app.layout = html.Div(
|
|
| 587 |
),
|
| 588 |
],
|
| 589 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 590 |
],
|
| 591 |
),
|
| 592 |
],
|
|
@@ -630,6 +645,7 @@ def toggle_condition2_inputs(mode):
|
|
| 630 |
|
| 631 |
@app.callback(
|
| 632 |
Output("mm0_chart", "figure"),
|
|
|
|
| 633 |
Input("calculate", "n_clicks"),
|
| 634 |
State("matrix", "value"),
|
| 635 |
State("tg", "value"),
|
|
@@ -733,7 +749,15 @@ def update_chart(n_clicks,
|
|
| 733 |
df['Cond2_err_plus'] = uppers - medians
|
| 734 |
df['Cond2_err_minus'] = medians - lowers
|
| 735 |
|
| 736 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 737 |
|
| 738 |
def ConservativeMonteCarlo(soluteData, CHRIS_category, L, time, N):
|
| 739 |
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
from Kps_function.read_Kps_model import *
|
| 9 |
import os
|
| 10 |
+
from dash import no_update
|
| 11 |
+
import traceback, time
|
| 12 |
|
| 13 |
app = Dash(
|
| 14 |
__name__,
|
|
|
|
| 589 |
),
|
| 590 |
],
|
| 591 |
),
|
| 592 |
+
html.Pre(
|
| 593 |
+
id="mm0_debug",
|
| 594 |
+
style={
|
| 595 |
+
"whiteSpace": "pre-wrap",
|
| 596 |
+
"fontSize": "12px",
|
| 597 |
+
"maxHeight": "260px",
|
| 598 |
+
"overflowY": "auto",
|
| 599 |
+
"border": "1px solid #ddd",
|
| 600 |
+
"padding": "8px",
|
| 601 |
+
"marginTop": "10px",
|
| 602 |
+
"backgroundColor": "#fafafa",
|
| 603 |
+
},
|
| 604 |
+
),
|
| 605 |
],
|
| 606 |
),
|
| 607 |
],
|
|
|
|
| 645 |
|
| 646 |
@app.callback(
|
| 647 |
Output("mm0_chart", "figure"),
|
| 648 |
+
Output("mm0_debug", "children"),
|
| 649 |
Input("calculate", "n_clicks"),
|
| 650 |
State("matrix", "value"),
|
| 651 |
State("tg", "value"),
|
|
|
|
| 749 |
df['Cond2_err_plus'] = uppers - medians
|
| 750 |
df['Cond2_err_minus'] = medians - lowers
|
| 751 |
|
| 752 |
+
t0 = time.time()
|
| 753 |
+
try:
|
| 754 |
+
# your current code
|
| 755 |
+
fig = build_figure(df)
|
| 756 |
+
return fig, f"OK in {time.time() - t0:.2f}s"
|
| 757 |
+
except Exception:
|
| 758 |
+
return no_update, traceback.format_exc()
|
| 759 |
+
|
| 760 |
+
#return build_figure(df)
|
| 761 |
|
| 762 |
def ConservativeMonteCarlo(soluteData, CHRIS_category, L, time, N):
|
| 763 |
|