Abgabe fertig
This commit is contained in:
72
dashboard.py
72
dashboard.py
@@ -1,34 +1,31 @@
|
||||
from dash import Dash, dash, html, dcc, Input, Output, State, no_update, ctx
|
||||
import plotly.graph_objects as go
|
||||
import numpy as np
|
||||
import dash_bootstrap_components as dbc
|
||||
|
||||
import builtins
|
||||
from dash.exceptions import PreventUpdate
|
||||
import traceback
|
||||
|
||||
import webbrowser
|
||||
from threading import Timer
|
||||
import dash_bootstrap_components as dbc
|
||||
import numpy as np
|
||||
import plotly.graph_objects as go
|
||||
from dash import Dash, Input, Output, State, dcc, html, no_update
|
||||
from dash.exceptions import PreventUpdate
|
||||
from numpy import pi
|
||||
|
||||
from ellipsoide import EllipsoidTriaxial
|
||||
import winkelumrechnungen as wu
|
||||
import ausgaben as aus
|
||||
from GHA_triaxial.utils import alpha_ell2para, alpha_para2ell
|
||||
|
||||
import winkelumrechnungen as wu
|
||||
from ES.gha1_ES import gha1_ES
|
||||
from ES.gha2_ES import gha2_ES
|
||||
from GHA_triaxial.gha1_ana import gha1_ana
|
||||
from GHA_triaxial.gha1_num import gha1_num
|
||||
from GHA_triaxial.gha1_ES import gha1_ES
|
||||
from GHA_triaxial.gha1_approx import gha1_approx
|
||||
|
||||
from GHA_triaxial.gha2_num import gha2_num
|
||||
from GHA_triaxial.gha2_ES import gha2_ES
|
||||
from GHA_triaxial.gha1_num import gha1_num
|
||||
from GHA_triaxial.gha2_approx import gha2_approx
|
||||
from GHA_triaxial.gha2_num import gha2_num
|
||||
from GHA_triaxial.utils import alpha_ell2para, alpha_para2ell
|
||||
from ellipsoid_triaxial import EllipsoidTriaxial
|
||||
|
||||
|
||||
# Prints von importierten Funktionen unterdücken
|
||||
def _no_print(*args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
builtins.print = _no_print
|
||||
|
||||
|
||||
@@ -39,7 +36,7 @@ app.title = "Geodätische Hauptaufgaben"
|
||||
|
||||
|
||||
# Erzeugen der Eingabefelder
|
||||
def inputfeld(left_text, input_id, right_text="", width=200, min=None, max=None):
|
||||
def inputfeld(left_text, input_id, right_text="", width=200, mini=None, maxi=None):
|
||||
return html.Div(
|
||||
children=[
|
||||
html.Span(f"{left_text} =", style={"minWidth": 36, "textAlign": "right", "marginRight": 5}),
|
||||
@@ -142,7 +139,7 @@ def method_failed(method_label: str, exc: Exception):
|
||||
return html.Div([
|
||||
html.Strong(f"{method_label}: "),
|
||||
html.Span("konnte nicht berechnet werden. ", style={"color": "red"}),
|
||||
#html.Span(f"({type(exc).__name__}: {exc})", style={"color": "#b02a37"}),
|
||||
# html.Span(f"({type(exc).__name__}: {exc})", style={"color": "#b02a37"}),
|
||||
|
||||
html.Details([
|
||||
html.Summary("Details"),
|
||||
@@ -177,7 +174,7 @@ def ellipsoid_figure(ell: EllipsoidTriaxial, title="Dreiachsiges Ellipsoid"):
|
||||
scene=dict(
|
||||
xaxis=dict(
|
||||
range=[-rx, rx],
|
||||
#title="X [m]",
|
||||
# title="X [m]",
|
||||
title="",
|
||||
showgrid=False,
|
||||
zeroline=False,
|
||||
@@ -186,7 +183,7 @@ def ellipsoid_figure(ell: EllipsoidTriaxial, title="Dreiachsiges Ellipsoid"):
|
||||
),
|
||||
yaxis=dict(
|
||||
range=[-ry, ry],
|
||||
#title="Y [m]",
|
||||
# title="Y [m]",
|
||||
title="",
|
||||
showgrid=False,
|
||||
zeroline=False,
|
||||
@@ -195,7 +192,7 @@ def ellipsoid_figure(ell: EllipsoidTriaxial, title="Dreiachsiges Ellipsoid"):
|
||||
),
|
||||
zaxis=dict(
|
||||
range=[-rz, rz],
|
||||
#title="Z [m]",
|
||||
# title="Z [m]",
|
||||
title="",
|
||||
showgrid=False,
|
||||
zeroline=False,
|
||||
@@ -209,8 +206,8 @@ def ellipsoid_figure(ell: EllipsoidTriaxial, title="Dreiachsiges Ellipsoid"):
|
||||
)
|
||||
|
||||
# Ellipsoid
|
||||
u = np.linspace(-np.pi/2, np.pi/2, 80)
|
||||
v = np.linspace(-np.pi, np.pi, 160)
|
||||
u = np.linspace(-pi/2, pi/2, 80)
|
||||
v = np.linspace(-pi, pi, 160)
|
||||
U, V = np.meshgrid(u, v)
|
||||
X, Y, Z = ell.para2cart(U, V)
|
||||
fig.add_trace(go.Surface(
|
||||
@@ -260,7 +257,7 @@ def figure_constant_lines(fig, ell: EllipsoidTriaxial, coordsystem: str = "para"
|
||||
all_beta[-1] -= 1e-8
|
||||
constants_lamb = wu.deg2rad(np.arange(-180, 180, 15))
|
||||
for lamb in constants_lamb:
|
||||
if lamb != 0 and abs(lamb) != np.pi:
|
||||
if lamb != 0 and abs(lamb) != pi:
|
||||
xyz = ell.ell2cart(all_beta, lamb)
|
||||
fig.add_trace(go.Scatter3d(
|
||||
x=xyz[:, 0], y=xyz[:, 1], z=xyz[:, 2], mode="lines",
|
||||
@@ -335,8 +332,10 @@ def figure_lines(fig, line, name, color):
|
||||
))
|
||||
return fig
|
||||
|
||||
|
||||
# HTML der beiden Tabs
|
||||
# Tab 1
|
||||
|
||||
pane_gha1 = html.Div(
|
||||
[
|
||||
html.Div(
|
||||
@@ -468,7 +467,7 @@ app.layout = html.Div(
|
||||
style={"fontFamily": "Arial", "padding": "10px", "width": "95%", "margin": "0 auto"},
|
||||
children=[
|
||||
html.H2("Geodätische Hauptaufgaben für dreiachsige Ellipsoide"),
|
||||
#html.H2("für dreiachsige Ellipsoide"),
|
||||
# html.H2("für dreiachsige Ellipsoide"),
|
||||
|
||||
html.Div(
|
||||
style={
|
||||
@@ -507,9 +506,9 @@ app.layout = html.Div(
|
||||
|
||||
html.Div(
|
||||
[
|
||||
inputfeld("aₓ", "input-ax", "m", min=0, width="clamp(80px, 7vw, 200px)"),
|
||||
inputfeld("aᵧ", "input-ay", "m", min=0, width="clamp(80px, 7vw, 200px)"),
|
||||
inputfeld("b", "input-b", "m", min=0, width="clamp(80px, 7vw, 200px)"),
|
||||
inputfeld("aₓ", "input-ax", "m", mini=0, width="clamp(80px, 7vw, 200px)"),
|
||||
inputfeld("aᵧ", "input-ay", "m", mini=0, width="clamp(80px, 7vw, 200px)"),
|
||||
inputfeld("b", "input-b", "m", mini=0, width="clamp(80px, 7vw, 200px)"),
|
||||
],
|
||||
style={
|
||||
"display": "grid",
|
||||
@@ -520,7 +519,7 @@ app.layout = html.Div(
|
||||
},
|
||||
),
|
||||
|
||||
#html.Br(),
|
||||
# html.Br(),
|
||||
|
||||
dcc.Tabs(
|
||||
id="tabs-GHA",
|
||||
@@ -572,7 +571,7 @@ app.layout = html.Div(
|
||||
dcc.Store(id="calc-token-gha1", data=0),
|
||||
dcc.Store(id="calc-token-gha2", data=0),
|
||||
|
||||
#html.P("© 2026", style={"fontSize": "10px", "color": "gray", "textAlign": "center", "marginTop": "16px"}),
|
||||
# html.P("© 2026", style={"fontSize": "10px", "color": "gray", "textAlign": "center", "marginTop": "16px"}),
|
||||
],
|
||||
|
||||
|
||||
@@ -662,10 +661,8 @@ def toggle_ds(v):
|
||||
return "on" not in (v or [])
|
||||
|
||||
|
||||
|
||||
# Abfrage ob Berechnungsverfahren gewählt
|
||||
from dash.exceptions import PreventUpdate
|
||||
from dash import no_update, html
|
||||
|
||||
|
||||
@app.callback(
|
||||
Output("calc-token-gha1", "data"),
|
||||
@@ -961,7 +958,7 @@ def compute_gha1_ana(n1, cb_ana, max_M, maxPartCircum, beta0, lamb0, s, a0, ax,
|
||||
def compute_gha1_num(n1, cb_num, n_in, beta0, lamb0, s, a0, ax, ay, b):
|
||||
if not n1:
|
||||
return no_update, no_update
|
||||
if "on" not in (cb_num or []):
|
||||
if "on" not in (cb_num or []):
|
||||
return "", None
|
||||
|
||||
n_in = int(n_in) if n_in else 2000
|
||||
@@ -974,7 +971,6 @@ def compute_gha1_num(n1, cb_num, n_in, beta0, lamb0, s, a0, ax, ay, b):
|
||||
alpha_rad = wu.deg2rad(float(a0))
|
||||
s_val = float(s)
|
||||
|
||||
|
||||
P0 = ell.ell2cart(beta_rad, lamb_rad)
|
||||
|
||||
P1_num, alpha1, werte = gha1_num(ell, P0, alpha_rad, s_val, n_in, all_points=True)
|
||||
@@ -1402,7 +1398,7 @@ def clear_all_stores_on_ellipsoid_change(ax, ay, b):
|
||||
if None in (ax, ay, b):
|
||||
return (no_update,)*7
|
||||
|
||||
return (None, None, None, None, None, None, None)
|
||||
return None, None, None, None, None, None, None
|
||||
|
||||
# Funktionen zur Erzeugung der Überschriften
|
||||
@app.callback(
|
||||
@@ -1483,6 +1479,6 @@ if __name__ == "__main__":
|
||||
# Automatisiertes Öffnen der Seite im Browser
|
||||
HOST = "127.0.0.1"
|
||||
PORT = 8050
|
||||
#Timer(1.0, webbrowser.open_new_tab(f"http://{HOST}:{PORT}/")).start
|
||||
# Timer(1.0, webbrowser.open_new_tab(f"http://{HOST}:{PORT}/")).start
|
||||
|
||||
app.run(host=HOST, port=PORT, debug=False)
|
||||
|
||||
Reference in New Issue
Block a user