Compare commits

...

2 Commits

Author SHA1 Message Date
Tammo.Weber
020d282420 Merge remote-tracking branch 'origin/main' 2026-02-09 10:17:11 +01:00
Tammo.Weber
cefa98e3b7 Zweiter Parameter bei GHA1 ana 2026-02-09 10:16:57 +01:00

View File

@@ -59,7 +59,7 @@ def inputfeld(left_text, input_id, right_text="", width=200, min=None, max=None)
)
# Erzeugen der Checklisten inkl. Eingabefelder
def method_row(label, cb_id, input_id=None, value="", info=""):
def method_row(label, cb_id, input_id=None, value="", info="", input_id2=None, value2="", info2="",):
base_row_style = {
"display": "flex",
"alignItems": "center",
@@ -79,31 +79,37 @@ def method_row(label, cb_id, input_id=None, value="", info=""):
label_span = html.Span(
label,
style={
"marginLeft": "4px",
"minWidth": "130px",
},
style={"marginLeft": "4px", "minWidth": "130px"},
)
if not info:
if not info and not info2 and not input_id and not input_id2:
return html.Div([checkbox, label_span], style=base_row_style)
input_box = dcc.Input(
id=input_id,
type="number",
value=value,
#placeholder=placeholder,
style={
"width": "90px",
"marginLeft": "2px",
},
disabled=True,
persistence=True,
persistence_type="memory",
)
def _input_box(_id, _value, width_px):
return dcc.Input(
id=_id,
type="number",
value=_value,
style={"width": f"{width_px}px", "marginLeft": "2px"},
disabled=True,
persistence=True,
persistence_type="memory",
)
use_two_inputs = bool(input_id2)
if use_two_inputs:
w = 45
input_box_1 = _input_box(input_id, value, w)
input_box_2 = _input_box(input_id2, value2, w)
else:
w = 96
input_box_1 = _input_box(input_id, value, w)
input_box_2 = None
info_parts = [s for s in (info, info2) if s]
info_text = html.Span(
info,
" | ".join(info_parts),
style={
"marginLeft": "6px",
"fontSize": "12px",
@@ -111,13 +117,17 @@ def method_row(label, cb_id, input_id=None, value="", info=""):
"lineHeight": "1.1",
"whiteSpace": "nowrap",
},
)
children = [checkbox, label_span, input_box]
if info:
) if info_parts else None
children = [checkbox, label_span, input_box_1]
if input_box_2 is not None:
children.append(input_box_2)
if info_text is not None:
children.append(info_text)
return html.Div(children, style=base_row_style)
def method_failed(method_label: str, exc: Exception):
return html.Div([
html.Strong(f"{method_label}: "),
@@ -288,7 +298,7 @@ pane_gha1 = html.Div(
inputfeld("s", "input-GHA1-s", "m"),
inputfeld("α₀", "input-GHA1-a", "°"),
method_row("Analytisch", "cb-ana-1", "input-ana-1", "70", info="Ordnung"),
method_row("Analytisch", "cb-ana-1", "input-ana-1", "70", info="Ordnung", input_id2="input-ana-1-2", value2="4", info2="max. Unterteilung"),
method_row("Numerisch", "cb-num-1", "input-num-n-1", "2000", info="Anzahl Schritte"),
method_row("Stochastisch (ES)", "cb-stoch-1", "input-stoch-n-1", "1000", info="Länge Streckensegment [m]"),
method_row("Approximiert", "cb-approx-1", "input-approx-ds-1", "1000", info="Länge Streckensegment [m]"),
@@ -504,6 +514,13 @@ def switch_tabs(tab):
def toggle_ds(v):
return "on" not in (v or [])
@app.callback(
Output("input-ana-1-2", "disabled"),
Input("cb-ana-1", "value"),
)
def toggle_ds(v):
return "on" not in (v or [])
@app.callback(
Output("input-num-n-1", "disabled"),
Input("cb-num-1", "value"),
@@ -622,8 +639,8 @@ def gha1_method_hint(n, a, nu, st, ap, beta0, lamb0, s, a0, ax, ay, b):
return html.Span("λ₀ muss im Bereich [-180°, 180°] liegen.", style={"color": "red"})
if s_f <= 0:
return html.Span("s muss > 0 sein.", style={"color": "red"})
if not (0 <= a0_f <= 360):
return html.Span("α₀ muss im Bereich [0°, 360°] liegen.", style={"color": "red"})
if not (-180 <= lamb0_f <= 360):
return html.Span("α₀ muss im Bereich [-180°, 360°] liegen.", style={"color": "red"})
return ""
@@ -635,6 +652,7 @@ def gha1_method_hint(n, a, nu, st, ap, beta0, lamb0, s, a0, ax, ay, b):
Input("calc-token-gha1", "data"),
State("cb-ana-1", "value"),
State("input-ana-1", "value"),
State("input-ana-1-2", "value"),
State("input-GHA1-beta0", "value"),
State("input-GHA1-lamb0", "value"),
State("input-GHA1-s", "value"),
@@ -644,13 +662,14 @@ def gha1_method_hint(n, a, nu, st, ap, beta0, lamb0, s, a0, ax, ay, b):
State("input-b", "value"),
prevent_initial_call=True,
)
def compute_gha1_ana(n1, cb_ana, n_in, beta0, lamb0, s, a0, ax, ay, b):
def compute_gha1_ana(n1, cb_ana, max_M, maxPartCircum, beta0, lamb0, s, a0, ax, ay, b):
if not n1:
return no_update, no_update
if "on" not in (cb_ana or []):
return "", None
n_in = int(n_in) if n_in else 70
max_M = int(max_M) if max_M else 70
maxPartCircum = int(maxPartCircum) if maxPartCircum else 4
try:
ell = EllipsoidTriaxial(ax, ay, b)
@@ -661,7 +680,7 @@ def compute_gha1_ana(n1, cb_ana, n_in, beta0, lamb0, s, a0, ax, ay, b):
s_val = float(s)
P0 = ell.ell2cart(beta_rad, lamb_rad)
P1_ana, alpha2_para = gha1_ana(ell, P0, alpha_rad_para, s_val, n_in)
P1_ana, alpha2_para = gha1_ana(ell, P0, alpha_rad_para, s_val, max_M, maxPartCircum)
u1, v1 = ell.cart2para(P1_ana)
alpha2 = alpha_para2ell(ell, u1, v1, alpha2_para)
beta2_ana, lamb2_ana = ell.cart2ell(P1_ana)