Files
Masterprojekt/Tests/algorithms_test.ipynb
2026-02-08 16:28:59 +01:00

2988 lines
86 KiB
Plaintext

{
"cells": [
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T14:37:43.639183Z",
"start_time": "2026-02-08T14:37:41.363837Z"
}
},
"cell_type": "code",
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
],
"id": "89aa93e9dbedd113",
"outputs": [],
"execution_count": 1
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T14:37:44.991629Z",
"start_time": "2026-02-08T14:37:43.654255Z"
}
},
"cell_type": "code",
"source": [
"%reload_ext autoreload\n",
"%autoreload 2\n",
"import time\n",
"from numpy import nan\n",
"import numpy as np\n",
"import math\n",
"import winkelumrechnungen as wu\n",
"import os\n",
"from contextlib import contextmanager, redirect_stdout, redirect_stderr\n",
"import plotly.graph_objects as go\n",
"import warnings\n",
"import pickle\n",
"import random\n",
"\n",
"from ellipsoide import EllipsoidTriaxial\n",
"from GHA_triaxial.utils import alpha_para2ell, alpha_ell2para\n",
"\n",
"from GHA_triaxial.gha1_num import gha1_num\n",
"from GHA_triaxial.gha1_ana import gha1_ana\n",
"from GHA_triaxial.gha1_ES import gha1_ES\n",
"from GHA_triaxial.gha1_approx import gha1_approx\n",
"\n",
"from GHA_triaxial.gha2_num import gha2_num\n",
"from GHA_triaxial.gha2_ES import gha2_ES\n",
"from GHA_triaxial.gha2_approx import gha2_approx\n",
"\n",
"from GHA_triaxial.numeric_examples_panou import get_tables as get_tables_panou\n",
"from GHA_triaxial.numeric_examples_karney import get_random_examples as get_examples_karney"
],
"id": "2005e5a8854eea1e",
"outputs": [],
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T09:56:48.946285Z",
"start_time": "2026-02-08T09:56:48.479496Z"
}
},
"cell_type": "code",
"source": [
"@contextmanager\n",
"def suppress_print():\n",
" with open(os.devnull, 'w') as fnull:\n",
" with redirect_stdout(fnull), redirect_stderr(fnull):\n",
" yield"
],
"id": "90f107a11ff0de7e",
"outputs": [],
"execution_count": 3
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-07T21:21:03.628386Z",
"start_time": "2026-02-07T21:21:03.410822Z"
}
},
"cell_type": "code",
"source": [
"# dsPart = [60, 125, 600, 1250, 6000, 60000] entspricht bei der Erde ca. 100km, 50km, 10km, 5km, 1km, 100m\n",
"\n",
"steps_gha1_num = [200, 500, 1000, 5000, 10000, 20000, 50000]\n",
"maxM_gha1_ana = [20, 50, 80]\n",
"parts_gha1_ana = [2, 8, 32]\n",
"dsPart_gha1_ES = [60, 600, 1250]\n",
"dsPart_gha1_approx = [600, 1250, 6000]\n",
"\n",
"steps_gha2_num = [200, 500, 1000, 5000, 10000]\n",
"dsPart_gha2_ES = [60, 600, 1250]\n",
"dsPart_gha2_approx = [600, 1250, 6000]"
],
"id": "fc6c39b8d358e54b",
"outputs": [],
"execution_count": 7
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-07T21:22:30.400129Z",
"start_time": "2026-02-07T21:22:30.193713Z"
}
},
"cell_type": "code",
"source": [
"test = \"Karney\"\n",
"# test = \"Panou\"\n",
"# test = \"Random\"\n",
"\n",
"def build_examples(test):\n",
" if test == \"Karney\":\n",
" ell: EllipsoidTriaxial = EllipsoidTriaxial.init_name(\"KarneyTest2024\")\n",
" examples = get_examples_karney(20, seed=42)\n",
" elif test == \"Panou\":\n",
" ell: EllipsoidTriaxial = EllipsoidTriaxial.init_name(\"BursaSima1980round\")\n",
" tables = get_tables_panou()\n",
" table_indices = []\n",
" examples = []\n",
" for i, table in enumerate(tables):\n",
" for example in table:\n",
" table_indices.append(i+1)\n",
" examples.append(example)\n",
" examples = examples[:14]\n",
" elif test == \"Random\":\n",
" ell: EllipsoidTriaxial = EllipsoidTriaxial.init_name(\"BursaSima1980round\")\n",
" examples = []\n",
" random.seed(42)\n",
" for _ in range(50):\n",
" beta0 = wu.deg2rad(random.randint(-90, 90))\n",
" lamb0 = wu.deg2rad(random.randint(-179, 180))\n",
" alpha0_ell = wu.deg2rad(random.randint(0, 359))\n",
" s = random.randint(10000, int(np.pi*ell.b))\n",
" examples.append([beta0, lamb0, alpha0_ell, s])\n",
" pass\n",
" return ell, examples\n",
"# ell, examples = build_examples(test)"
],
"id": "6770dbd57d475127",
"outputs": [],
"execution_count": 15
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-07T21:22:03.254266Z",
"start_time": "2026-02-07T21:22:03.046527Z"
}
},
"cell_type": "code",
"source": [
"def execute_results(test, ell, examples):\n",
" results = {}\n",
" for i, example in enumerate(examples):\n",
" print(f\"----- Beispiel {i+1}/{len(examples)}\")\n",
" example_results = {}\n",
"\n",
" if test != \"Random\":\n",
" beta0, lamb0, alpha0_ell, beta1, lamb1, alpha1_ell, s = example\n",
" P0 = ell.ell2cart(beta0, lamb0)\n",
" P1 = ell.ell2cart(beta1, lamb1)\n",
" _, _, alpha0_para = alpha_ell2para(ell, beta0, lamb0, alpha0_ell)\n",
" else:\n",
" beta0, lamb0, alpha0_ell, s = example\n",
" P0 = ell.ell2cart(beta0, lamb0)\n",
" _, _, alpha0_para = alpha_ell2para(ell, beta0, lamb0, alpha0_ell)\n",
"\n",
" # try:\n",
" # P1, alpha1_para = gha1_ana(ell, P0, alpha0_para, s, maxM=80, maxPartCircum=8)\n",
" # beta1, lamb1 = ell.cart2ell(P1)\n",
" # u1, v1 = ell.cart2para(P1)\n",
" # _, _, alpha1_ell = alpha_para2ell(ell, u1, v1, alpha1_para)\n",
" # except Exception as e:\n",
" # print(\"Referenz-Berechnung analytisch fehlgeschlagen: \", e)\n",
" # continue\n",
"\n",
" try:\n",
" P1, alpha1_ell = gha1_num(ell, P0, alpha0_ell, s, num=10000)\n",
" beta1, lamb1 = ell.cart2ell(P1)\n",
" except Exception as e:\n",
" print(\"Referenz-Berechnung numerisch fehlgeschlagen: \", e)\n",
" continue\n",
"\n",
" for steps in steps_gha1_num:\n",
" start = time.perf_counter()\n",
" try:\n",
" P1_num, alpha1_num_1 = gha1_num(ell, P0, alpha0_ell, s, num=steps)\n",
" end = time.perf_counter()\n",
" beta1_num, lamb1_num = ell.cart2ell(P1_num)\n",
" d_beta1 = abs(beta1_num - beta1)\n",
" d_lamb1 = abs(lamb1_num - lamb1)\n",
" d_alpha1 = abs(alpha1_num_1 - alpha1_ell)\n",
" d_time = end - start\n",
" example_results[f\"GHA1_num_{steps}\"] = (d_beta1, d_lamb1, d_alpha1, d_time)\n",
" except Exception as e:\n",
" print(e)\n",
" example_results[f\"GHA1_num_{steps}\"] = (nan, nan, nan, nan)\n",
"\n",
" # for maxM in maxM_gha1_ana:\n",
" # for parts in parts_gha1_ana:\n",
" # start = time.perf_counter()\n",
" # try:\n",
" # P1_ana, alpha1_ana_para = gha1_ana(ell, P0, alpha0_para, s, maxM=maxM, maxPartCircum=parts)\n",
" # end = time.perf_counter()\n",
" # beta1_ana, lamb1_ana = ell.cart2ell(P1_ana)\n",
" # u1_ana, v1_ana = ell.cart2para(P1_ana)\n",
" # _, _, alpha1_ana_ell = alpha_para2ell(ell, u1_ana, v1_ana, alpha1_ana_para)\n",
" # d_beta1 = abs(beta1_ana - beta1)\n",
" # d_lamb1 = abs(lamb1_ana - lamb1)\n",
" # d_alpha1 = abs(alpha1_ana_ell - alpha1_ell)\n",
" # d_time = end - start\n",
" # example_results[f\"GHA1_ana_{maxM}_{parts}\"] = (d_beta1, d_lamb1, d_alpha1, d_time)\n",
" # except Exception as e:\n",
" # print(e)\n",
" # example_results[f\"GHA1_ana_{maxM}_{parts}\"] = (nan, nan, nan, nan)\n",
" #\n",
" # for dsPart in dsPart_gha1_ES:\n",
" # ds = ell.ax/dsPart\n",
" # start = time.perf_counter()\n",
" # try:\n",
" # P1_ES, alpha1_ES = gha1_ES(ell, beta0, lamb0, alpha0_ell, s, maxSegLen=ds)\n",
" # end = time.perf_counter()\n",
" # beta1_ES, lamb1_ES = ell.cart2ell(P1_ES)\n",
" # d_beta1 = abs(beta1_ES - beta1)\n",
" # d_lamb1 = abs(lamb1_ES - lamb1)\n",
" # d_alpha1 = abs(alpha1_ES - alpha1_ell)\n",
" # d_time = end - start\n",
" # example_results[f\"GHA1_ES_{dsPart}\"] = (d_beta1, d_lamb1, d_alpha1, d_time)\n",
" # except Exception as e:\n",
" # print(e)\n",
" # example_results[f\"GHA1_ES_{dsPart}\"] = (nan, nan, nan, nan)\n",
" #\n",
" # for dsPart in dsPart_gha1_approx:\n",
" # ds = ell.ax/dsPart\n",
" # start = time.perf_counter()\n",
" # try:\n",
" # P1_approx, alpha1_approx = gha1_approx(ell, P0, alpha0_ell, s, ds=ds)\n",
" # end = time.perf_counter()\n",
" # beta1_approx, lamb1_approx = ell.cart2ell(P1_approx)\n",
" # d_beta1 = abs(beta1_approx - beta1)\n",
" # d_lamb1 = abs(lamb1_approx - lamb1)\n",
" # d_alpha1 = abs(alpha1_approx - alpha1_ell)\n",
" # d_time = end - start\n",
" # example_results[f\"GHA1_approx_{dsPart}\"] = (d_beta1, d_lamb1, d_alpha1, d_time)\n",
" # except Exception as e:\n",
" # print(e)\n",
" # example_results[f\"GHA1_approx_{dsPart}\"] = (nan, nan, nan, nan)\n",
" #\n",
" # # ----------------------------------------------\n",
" #\n",
" # for steps in steps_gha2_num:\n",
" # start = time.perf_counter()\n",
" # try:\n",
" # with warnings.catch_warnings():\n",
" # warnings.simplefilter(\"ignore\", RuntimeWarning)\n",
" # alpha0_num, alpha1_num_2, s_num = gha2_num(ell, beta0, lamb0, beta1, lamb1, n=steps)\n",
" # print(alpha0_num, alpha1_num_2, s_num)\n",
" # end = time.perf_counter()\n",
" # d_alpha0 = abs(alpha0_num - alpha0_ell)\n",
" # d_alpha1 = abs(alpha1_num_2 - alpha1_ell)\n",
" # d_s = abs(s_num - s)\n",
" # d_time = end - start\n",
" # example_results[f\"GHA2_num_{steps}\"] = (d_alpha0, d_alpha1, d_s, d_time)\n",
" # except Exception as e:\n",
" # print(e)\n",
" # example_results[f\"GHA2_num_{steps}\"] = (nan, nan, nan, nan)\n",
" #\n",
" # for dsPart in dsPart_gha2_ES:\n",
" # ds = ell.ax/dsPart\n",
" # start = time.perf_counter()\n",
" # try:\n",
" # with suppress_print():\n",
" # alpha0_ES, alpha1_ES, s_ES = gha2_ES(ell, P0, P1, maxSegLen=ds)\n",
" # end = time.perf_counter()\n",
" # d_alpha0 = abs(alpha0_ES - alpha0_ell)\n",
" # d_alpha1 = abs(alpha1_ES - alpha1_ell)\n",
" # d_s = abs(s_ES - s)\n",
" # d_time = end - start\n",
" # example_results[f\"GHA2_ES_{dsPart}\"] = (d_alpha0, d_alpha1, d_s, d_time)\n",
" # except Exception as e:\n",
" # print(e)\n",
" # example_results[f\"GHA2_ES_{dsPart}\"] = (nan, nan, nan, nan)\n",
" #\n",
" # for dsPart in dsPart_gha2_approx:\n",
" # ds = ell.ax/dsPart\n",
" # start = time.perf_counter()\n",
" # try:\n",
" # alpha0_approx, alpha1_approx, s_approx = gha2_approx(ell, P0, P1, ds=ds)\n",
" # end = time.perf_counter()\n",
" # d_alpha0 = abs(alpha0_approx - alpha0_ell)\n",
" # d_alpha1 = abs(alpha1_approx - alpha1_ell)\n",
" # d_s = abs(s_approx - s)\n",
" # d_time = end - start\n",
" # example_results[f\"GHA2_approx_{dsPart}\"] = (d_alpha0, d_alpha1, d_s, d_time)\n",
" # except Exception as e:\n",
" # print(e)\n",
" # example_results[f\"GHA2_approx_{dsPart}\"] = (nan, nan, nan, nan)\n",
"\n",
" results[f\"beta0: {wu.rad2deg(beta0):.3f}, lamb0: {wu.rad2deg(lamb0):.3f}, alpha0: {wu.rad2deg(alpha0_ell):.3f}, s: {s}\"] = example_results\n",
" return results\n",
"# results = execute_results(test, ell, examples)"
],
"id": "fc45e0f618a0e4d8",
"outputs": [],
"execution_count": 12
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-07T21:22:06.184091Z",
"start_time": "2026-02-07T21:22:05.991850Z"
}
},
"cell_type": "code",
"source": [
"def save_results(test, results):\n",
" with open(f\"gha_results{test}.pkl\", \"wb\") as f:\n",
" pickle.dump(results, f)\n",
"# save_results(test, results)"
],
"id": "74fbd4d33c288839",
"outputs": [],
"execution_count": 13
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"test = \"Panou\"\n",
"ell_panou, examples_panou = build_examples(test)\n",
"results_panou = execute_results(test, ell_panou, examples_panou)\n",
"save_results(test, results_panou)"
],
"id": "58697308664fa539"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-07T21:31:04.829637Z",
"start_time": "2026-02-07T21:29:14.982823Z"
}
},
"cell_type": "code",
"source": [
"test = \"Karney\"\n",
"ell_karney, examples_karney = build_examples(test)\n",
"results_karney = execute_results(test, ell_karney, examples_karney)\n",
"save_results(test, results_karney)"
],
"id": "5d35a01ba8d6e2b1",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"----- Beispiel 1/20\n",
"----- Beispiel 2/20\n",
"----- Beispiel 3/20\n",
"----- Beispiel 4/20\n",
"----- Beispiel 5/20\n",
"----- Beispiel 6/20\n",
"----- Beispiel 7/20\n",
"----- Beispiel 8/20\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\moell\\OneDrive\\Desktop\\Vorlesungen\\Master-Projekt\\Python_Masterprojekt\\GHA_triaxial\\utils.py:138: RuntimeWarning: invalid value encountered in sqrt\n",
" t2 = (-c1 + sqrt(c1 ** 2 - 4 * c0)) / 2\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"----- Beispiel 9/20\n",
"----- Beispiel 10/20\n",
"----- Beispiel 11/20\n",
"----- Beispiel 12/20\n",
"----- Beispiel 13/20\n",
"----- Beispiel 14/20\n",
"----- Beispiel 15/20\n",
"----- Beispiel 16/20\n",
"----- Beispiel 17/20\n",
"----- Beispiel 18/20\n",
"----- Beispiel 19/20\n",
"----- Beispiel 20/20\n"
]
}
],
"execution_count": 20
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"test = \"Random\"\n",
"ell_random, examples_random = build_examples(test)\n",
"results_random = execute_results(test, ell_random, examples_random)\n",
"save_results(test, results_random)"
],
"id": "848eab44283945c6"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T15:00:05.614272Z",
"start_time": "2026-02-08T15:00:05.349014Z"
}
},
"cell_type": "code",
"source": "test = \"Karney\"",
"id": "8be408707e46f165",
"outputs": [],
"execution_count": 48
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "results = results_karney",
"id": "3a7c0416e1667b84"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T15:00:06.544175Z",
"start_time": "2026-02-08T15:00:06.215465Z"
}
},
"cell_type": "code",
"source": [
"with open(f\"gha_results{test}.pkl\", \"rb\") as f:\n",
" results = pickle.load(f)"
],
"id": "4c20a0579c0f7038",
"outputs": [],
"execution_count": 49
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T15:00:28.798843Z",
"start_time": "2026-02-08T15:00:28.527486Z"
}
},
"cell_type": "code",
"source": [
"metrics_gha1 = ['dBeta [\"]', 'dLambda [\"]', 'dAlpha1 [\"]', 'time [s]']\n",
"metrics_gha2 = ['dAlpha0 [\"]', 'dAlpha1 [\"]', 'dStrecke [m]', 'time [s]']\n",
"for example, example_metrics in results.items():\n",
" for method, method_metrics in example_metrics.items():\n",
" results[example][method] = list(results[example][method])\n",
" if \"GHA1\" in method:\n",
" for i, metric in enumerate(method_metrics):\n",
" if '[\"]' in metrics_gha1[i]:\n",
" if not np.isnan(metric):\n",
" metric %= (2*np.pi)\n",
" if not \"beta\" in metrics_gha1[i]:\n",
" metric = min(metric, abs(metric - 2*np.pi))\n",
" results[example][method][i] = metric\n",
" if \"GHA2\" in method:\n",
" for i, metric in enumerate(method_metrics):\n",
" if abs(metric - np.pi) < 0.1:\n",
" metric -= np.pi\n",
" if '[\"]' in metrics_gha2[i]:\n",
" if not np.isnan(metric):\n",
" metric %= (2*np.pi)\n",
" metric = min(metric, abs(metric - 2*np.pi))\n",
" results[example][method][i] = metric\n",
" pass"
],
"id": "24ee93abe040e707",
"outputs": [],
"execution_count": 50
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T15:26:22.209167Z",
"start_time": "2026-02-08T15:00:31.424013Z"
}
},
"cell_type": "code",
"source": [
"metrics_gha1 = ['dBeta [\"]', 'dLambda [\"]', 'dAlpha1 [\"]', 'time [s]']\n",
"metrics_gha2 = ['dAlpha0 [\"]', 'dAlpha1 [\"]', 'dStrecke [m]', 'time [s]']\n",
"listed_results = {}\n",
"for example, example_metrics in results.items():\n",
" for method, method_metrics in example_metrics.items():\n",
" if \"GHA1\" in method:\n",
" if method not in listed_results.keys():\n",
" listed_results[method] = {metric: [] for metric in metrics_gha1}\n",
" for i, metric in enumerate(method_metrics):\n",
" if '[\"]' in metrics_gha1[i]:\n",
" metric = wu.rad2deg(metric)*3600\n",
" listed_results[method][metrics_gha1[i]].append(metric)\n",
" if \"GHA2\" in method:\n",
" if method not in listed_results.keys():\n",
" listed_results[method] = {metric: [] for metric in metrics_gha2}\n",
" for i, metric in enumerate(method_metrics):\n",
" if '[\"]' in metrics_gha2[i]:\n",
" metric = wu.rad2deg(metric)*3600\n",
" listed_results[method][metrics_gha2[i]].append(metric)\n",
" pass"
],
"id": "2086b5bcd8416e33",
"outputs": [],
"execution_count": null
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T14:55:39.908336Z",
"start_time": "2026-02-08T14:55:39.447742Z"
}
},
"cell_type": "code",
"source": [
"def format_max(values, is_angle=False):\n",
" arr = np.array(values, dtype=float)\n",
" if arr.size==0:\n",
" return np.nan\n",
" maxi = np.nanmax(np.abs(arr))\n",
" if maxi is None or (isinstance(maxi,float) and (math.isnan(maxi))):\n",
" return \"nan\"\n",
" if is_angle:\n",
" maxi = wu.rad2deg(maxi)*3600\n",
" if f\"{maxi:.3g}\" == 0:\n",
" pass\n",
" return f\"{maxi:.3g}\"\n",
"\n",
"\n",
"def build_max_table(gha_prefix, title, group_value = None):\n",
" if gha_prefix==\"GHA1\":\n",
" metrics = ['dBeta [\"]', 'dLambda [\"]', 'dAlpha1 [\"]', 'time [s]']\n",
" angle_mask = [True, True, True, False]\n",
" else:\n",
" metrics = ['dAlpha0 [\"]', 'dAlpha1 [\"]', 'dStrecke [m]', 'time [s]']\n",
" angle_mask = [True, True, False, False]\n",
"\n",
" if group_value is None:\n",
" example_keys = [example_key for example_key in list(results.keys())]\n",
" else:\n",
" example_keys = [example_key for example_key, group_index in zip(results.keys(), table_indices) if group_index==group_value]\n",
"\n",
" algorithms = sorted({algorithm for example_key in example_keys for algorithm in results[example_key].keys() if algorithm.startswith(gha_prefix)})\n",
"\n",
" header = [\"Algorithmus\", \"Parameter\", \"NaN\"] + list(metrics)\n",
" cells = [[] for i in range(len(metrics) + 3)]\n",
" for algorithm in algorithms:\n",
"\n",
" ghaNr, variant, params = algorithm.split(\"_\", 2)\n",
" cells[0].append(variant)\n",
" cells[1].append(params)\n",
" nan_values = []\n",
" for example_key in example_keys:\n",
" nan_values.append(results[example_key][algorithm][0])\n",
" cells[2].append(np.sum(np.isnan(nan_values)))\n",
" for i, metric in enumerate(metrics):\n",
" values = []\n",
" for example_key in example_keys:\n",
" values.append(results[example_key][algorithm][i])\n",
" cells[i+3].append(format_max(values, is_angle=angle_mask[i]))\n",
"\n",
" header = dict(\n",
" values=header,\n",
" align=\"center\",\n",
" fill_color=\"lightgrey\",\n",
" font=dict(size=13)\n",
" )\n",
" cells = dict(\n",
" values=cells,\n",
" align=\"center\"\n",
" )\n",
"\n",
" fig = go.Figure(data=[go.Table(header=header, cells=cells)])\n",
" fig.update_layout(title=title,\n",
" template=\"simple_white\",\n",
" width=800,\n",
" height=280,\n",
" margin=dict(l=20, r=20, t=60, b=20))\n",
" return fig\n",
"\n",
"figs = []\n",
"# if test == \"Panou\":\n",
"# for table_index in sorted(set(table_indices)):\n",
"# fig1 = build_max_table(\"GHA1\", f\"{test} - Gruppe {table_index} - GHA1\", table_index)\n",
"# fig2 = build_max_table(\"GHA2\", f\"{test} - Gruppe {table_index} - GHA2\", table_index)\n",
"# figs.append(fig1)\n",
"# figs.append(fig2)\n",
"# elif test == \"Karney\":\n",
"fig1 = build_max_table(\"GHA1\", f\"{test} - GHA1\")\n",
"fig2 = build_max_table(\"GHA2\", f\"{test} - GHA2\")\n",
"figs.append(fig1)\n",
"figs.append(fig2)\n",
"\n",
"for fig in figs:\n",
" fig.show()"
],
"id": "eeb5a204cc4bbf7d",
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"cells": {
"align": "center",
"values": [
[
"ES",
"ES",
"ES",
"ana",
"ana",
"ana",
"ana",
"ana",
"ana",
"ana",
"ana",
"ana",
"approx",
"approx",
"approx",
"num",
"num",
"num",
"num",
"num"
],
[
"1250",
"60",
"600",
"20_2",
"20_32",
"20_8",
"50_2",
"50_32",
"50_8",
"80_2",
"80_32",
"80_8",
"1250",
"600",
"6000",
"1000",
"10000",
"200",
"500",
"5000"
],
[
0,
0,
0,
32,
0,
0,
0,
0,
0,
0,
0,
0,
3,
3,
3,
0,
0,
27,
4,
0
],
[
"1.89e+03",
"3.35e+04",
"1.37e+04",
"1.04e-08",
"4.77e-09",
"4e-09",
"3.96e-09",
"4.77e-09",
"4e-09",
"3.96e-09",
"4.77e-09",
"4e-09",
"126",
"1.08e+03",
"1.38",
"4.54e-07",
"0",
"2.62e-06",
"5.94e-06",
"4.35e-09"
],
[
"1.63e+04",
"3.01e+05",
"6.35e+04",
"5.63e-09",
"1.08e-08",
"1.13e-08",
"7.1e-09",
"1.08e-08",
"1.13e-08",
"7.1e-09",
"1.08e-08",
"1.13e-08",
"8.47e+03",
"1.89e+04",
"99.5",
"1.97e-06",
"0",
"3.98e-06",
"7.77e-06",
"2e-08"
],
[
"6.48e+05",
"6.48e+05",
"6.48e+05",
"3.3e-09",
"9.53e-09",
"9.98e-09",
"7.79e-09",
"9.53e-09",
"9.98e-09",
"7.79e-09",
"9.53e-09",
"9.98e-09",
"1.14e+03",
"1.52e+03",
"13.2",
"1.8e-06",
"0",
"3.05e-06",
"6.36e-06",
"1.8e-08"
],
[
"91.7",
"7.97",
"52.7",
"0.00917",
"0.179",
"0.0512",
"0.118",
"1.71",
"0.517",
"0.43",
"7.03",
"1.76",
"3.18",
"1.48",
"14.6",
"0.0677",
"0.573",
"0.0126",
"0.0323",
"0.294"
]
]
},
"header": {
"align": "center",
"fill": {
"color": "lightgrey"
},
"font": {
"size": 13
},
"values": [
"Algorithmus",
"Parameter",
"NaN",
"dBeta [\"]",
"dLambda [\"]",
"dAlpha1 [\"]",
"time [s]"
]
},
"type": "table"
}
],
"layout": {
"template": {
"data": {
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"bar": [
{
"error_x": {
"color": "rgb(36,36,36)"
},
"error_y": {
"color": "rgb(36,36,36)"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"baxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "choropleth"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "contourcarpet"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "contour"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "heatmap"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "histogram2dcontour"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "histogram2d"
}
],
"histogram": [
{
"marker": {
"line": {
"color": "white",
"width": 0.6
}
},
"type": "histogram"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattermapbox"
}
],
"scattermap": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattermap"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolargl"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolar"
}
],
"scatter": [
{
"fillpattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
},
"type": "scatter"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "rgb(237,237,237)"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "rgb(217,217,217)"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"colorscale": {
"diverging": [
[
0.0,
"rgb(103,0,31)"
],
[
0.1,
"rgb(178,24,43)"
],
[
0.2,
"rgb(214,96,77)"
],
[
0.3,
"rgb(244,165,130)"
],
[
0.4,
"rgb(253,219,199)"
],
[
0.5,
"rgb(247,247,247)"
],
[
0.6,
"rgb(209,229,240)"
],
[
0.7,
"rgb(146,197,222)"
],
[
0.8,
"rgb(67,147,195)"
],
[
0.9,
"rgb(33,102,172)"
],
[
1.0,
"rgb(5,48,97)"
]
],
"sequential": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"sequentialminus": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
]
},
"colorway": [
"#1F77B4",
"#FF7F0E",
"#2CA02C",
"#D62728",
"#9467BD",
"#8C564B",
"#E377C2",
"#7F7F7F",
"#BCBD22",
"#17BECF"
],
"font": {
"color": "rgb(36,36,36)"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
},
"shapedefaults": {
"fillcolor": "black",
"line": {
"width": 0
},
"opacity": 0.3
},
"ternary": {
"aaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"baxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"caxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
}
},
"margin": {
"l": 20,
"r": 20,
"t": 60,
"b": 20
},
"title": {
"text": "Random - GHA1"
},
"width": 800,
"height": 280
},
"config": {
"plotlyServerURL": "https://plot.ly"
}
}
},
"metadata": {},
"output_type": "display_data",
"jetTransient": {
"display_id": null
}
},
{
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"cells": {
"align": "center",
"values": [
[
"ES",
"ES",
"ES",
"approx",
"approx",
"approx",
"num",
"num",
"num",
"num",
"num"
],
[
"1250",
"60",
"600",
"1250",
"600",
"6000",
"1000",
"10000",
"200",
"500",
"5000"
],
[
0,
0,
0,
0,
0,
0,
3,
3,
4,
3,
3
],
[
"7.17e+03",
"7.17e+03",
"7.17e+03",
"8.03e+03",
"8.03e+03",
"8.03e+03",
"6.01e+05",
"6.01e+05",
"6.01e+05",
"6.01e+05",
"6.01e+05"
],
[
"7.17e+03",
"7.17e+03",
"7.17e+03",
"8.04e+03",
"8.04e+03",
"8.04e+03",
"6e+05",
"6e+05",
"6e+05",
"6e+05",
"6e+05"
],
[
"138",
"153",
"137",
"174",
"173",
"175",
"4.01e+07",
"4.01e+07",
"4.01e+07",
"4.01e+07",
"4.01e+07"
],
[
"104",
"5.21",
"53.7",
"0.524",
"0.251",
"3.81",
"1.47",
"6.79",
"0.25",
"0.877",
"6"
]
]
},
"header": {
"align": "center",
"fill": {
"color": "lightgrey"
},
"font": {
"size": 13
},
"values": [
"Algorithmus",
"Parameter",
"NaN",
"dAlpha0 [\"]",
"dAlpha1 [\"]",
"dStrecke [m]",
"time [s]"
]
},
"type": "table"
}
],
"layout": {
"template": {
"data": {
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"bar": [
{
"error_x": {
"color": "rgb(36,36,36)"
},
"error_y": {
"color": "rgb(36,36,36)"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"baxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "choropleth"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "contourcarpet"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "contour"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "heatmap"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "histogram2dcontour"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "histogram2d"
}
],
"histogram": [
{
"marker": {
"line": {
"color": "white",
"width": 0.6
}
},
"type": "histogram"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattermapbox"
}
],
"scattermap": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattermap"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolargl"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolar"
}
],
"scatter": [
{
"fillpattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
},
"type": "scatter"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "rgb(237,237,237)"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "rgb(217,217,217)"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"colorscale": {
"diverging": [
[
0.0,
"rgb(103,0,31)"
],
[
0.1,
"rgb(178,24,43)"
],
[
0.2,
"rgb(214,96,77)"
],
[
0.3,
"rgb(244,165,130)"
],
[
0.4,
"rgb(253,219,199)"
],
[
0.5,
"rgb(247,247,247)"
],
[
0.6,
"rgb(209,229,240)"
],
[
0.7,
"rgb(146,197,222)"
],
[
0.8,
"rgb(67,147,195)"
],
[
0.9,
"rgb(33,102,172)"
],
[
1.0,
"rgb(5,48,97)"
]
],
"sequential": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
],
"sequentialminus": [
[
0.0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1.0,
"#fde725"
]
]
},
"colorway": [
"#1F77B4",
"#FF7F0E",
"#2CA02C",
"#D62728",
"#9467BD",
"#8C564B",
"#E377C2",
"#7F7F7F",
"#BCBD22",
"#17BECF"
],
"font": {
"color": "rgb(36,36,36)"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
},
"shapedefaults": {
"fillcolor": "black",
"line": {
"width": 0
},
"opacity": 0.3
},
"ternary": {
"aaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"baxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"caxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
}
},
"margin": {
"l": 20,
"r": 20,
"t": 60,
"b": 20
},
"title": {
"text": "Random - GHA2"
},
"width": 800,
"height": 280
},
"config": {
"plotlyServerURL": "https://plot.ly"
}
}
},
"metadata": {},
"output_type": "display_data",
"jetTransient": {
"display_id": null
}
}
],
"execution_count": 46
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T14:58:35.295970Z",
"start_time": "2026-02-08T14:58:34.968668Z"
}
},
"cell_type": "code",
"source": [
"from collections import defaultdict\n",
"\n",
"def to_latex_sci(x, decimals=3, exp_digits=2):\n",
" \"\"\"\n",
" Immer wissenschaftliche Schreibweise in LaTeX mit:\n",
" - fester Mantisse (z.B. 1.234)\n",
" - Exponent immer mit Vorzeichen (+/-)\n",
" - Exponent immer feste Stellenzahl (z.B. +03, -01)\n",
"\n",
" Beispiel:\n",
" 0.216 -> $2.160\\\\cdot10^{-01}$\n",
" 12.3 -> $1.230\\\\cdot10^{+01}$\n",
" \"\"\"\n",
"\n",
" if x is None:\n",
" return \"nan\"\n",
" try:\n",
" xf = float(x)\n",
" except Exception:\n",
" return str(x)\n",
"\n",
" if math.isnan(xf):\n",
" return \"nan\"\n",
"\n",
" if xf == 0.0:\n",
" exp_fmt = f\"+{0:0{exp_digits}d}\"\n",
" mant = f\"{0:.{decimals}f}\"\n",
" return f\"${mant}\\\\cdot10^{{{exp_fmt}}}$\"\n",
"\n",
" s = f\"{xf:.{decimals}e}\" # z.B. 2.160e-01\n",
" mant, exp = s.split(\"e\")\n",
" exp = int(exp)\n",
"\n",
" # Exponent formatieren: Vorzeichen + feste Länge\n",
" sign = \"+\" if exp >= 0 else \"-\"\n",
" exp_abs = abs(exp)\n",
" exp_fmt = f\"{sign}{exp_abs:0{exp_digits}d}\"\n",
"\n",
" return f\"${mant}\\\\cdot10^{{{exp_fmt}}}$\"\n",
"\n",
"\n",
"def nan_count_for_algorithm(results, example_keys, algorithm):\n",
" vals = []\n",
" for k in example_keys:\n",
" vals.append(results[k][algorithm][0])\n",
" return int(np.sum(np.isnan(np.array(vals, dtype=float))))\n",
"\n",
"\n",
"def max_abs_metric(results, example_keys, algorithm, metric_index, is_angle=False, wu=None, mask=None):\n",
" \"\"\"\n",
" Echter Max(|...|) über alle example_keys.\n",
" Wenn is_angle=True: Werte werden als rad angenommen und in Bogensekunden umgerechnet.\n",
" \"\"\"\n",
" arr = []\n",
" for i, k in enumerate(example_keys):\n",
" if mask is not None and not mask[i]:\n",
" continue\n",
" arr.append(results[k][algorithm][metric_index])\n",
" arr = np.array(arr, dtype=float)\n",
"\n",
" if arr.size == 0:\n",
" return np.nan\n",
" m = np.nanmax(np.abs(arr))\n",
" if is_angle:\n",
" if wu is None:\n",
" raise ValueError(\"wu wird benötigt für rad2deg, wenn is_angle=True\")\n",
" m = wu.rad2deg(m) * 3600.0\n",
" return m\n",
"\n",
"\n",
"def parse_variant_params(algorithm_key):\n",
" \"\"\"\n",
" Erwartet: GHA1_ana_20_4 -> variant='ana', params='20_4'\n",
" Gibt zusätzlich eine hübsche Parameterdarstellung zurück.\n",
" \"\"\"\n",
" ghaNr, variant, params = algorithm_key.split(\"_\", 2)\n",
"\n",
" # Standard: params 그대로\n",
" pretty = params\n",
"\n",
" # Für deine Tabellen: ana hat z.B. '20_4' -> '4, 20' (Segmentgröße, Ordnung)\n",
" if variant == \"ana\":\n",
" # bei dir: params = '20_4' oder '50_8' -> Ordnung_Segment\n",
" # du willst aber: Segment, Ordnung -> '4, 20'\n",
" a, b = params.split(\"_\")\n",
" order = a\n",
" seg = b\n",
" pretty = f\"{seg}, {order}\"\n",
" else:\n",
" # num: '2000' bleibt '2000'\n",
" # approx/ES: oft eine Zahl mit Punkt/Unterstrich? -> 그대로\n",
" pretty = params.replace(\"_\", \", \")\n",
"\n",
" return variant, params, pretty\n",
"\n",
"\n",
"def build_latex_table_from_results(\n",
" results,\n",
" gha_prefix=\"GHA1\",\n",
" example_keys=None,\n",
" caption=\"\",\n",
" label=\"tab:results_algorithms\",\n",
" include_nan_col=False,\n",
" wu=None\n",
"):\n",
" \"\"\"\n",
" Erzeugt LaTeX Tabular (inkl. table-Umgebung) im gewünschten Stil.\n",
" \"\"\"\n",
"\n",
" if example_keys is None:\n",
" example_keys = list(results.keys())\n",
"\n",
" # Metriken & Winkel-Maske wie bei dir\n",
" if gha_prefix == \"GHA1\":\n",
" metric_headers = [\n",
" r\"$\\max(|\\Delta \\beta|)$ [$''$]\",\n",
" r\"$\\max(|\\Delta \\lambda|)$ [$''$]\",\n",
" r\"$\\max(|\\Delta \\alpha_1|)$ [$''$]\",\n",
" r\"time [s]\"\n",
" ]\n",
" angle_mask = [True, True, True, False]\n",
" else:\n",
" metric_headers = [\n",
" r\"$\\max(|\\Delta \\alpha_0|)$ [$''$]\",\n",
" r\"$\\max(|\\Delta \\alpha_1|)$ [$''$]\",\n",
" r\"$\\max(|\\Delta s|)$ [m]\",\n",
" r\"time [s]\"\n",
" ]\n",
" angle_mask = [True, True, False, False]\n",
"\n",
" # Alle Algorithmen sammeln\n",
" algorithms = sorted({\n",
" alg for k in example_keys\n",
" for alg in results[k].keys()\n",
" if alg.startswith(gha_prefix)\n",
" })\n",
"\n",
" # Gruppieren nach variant (ana, num, approx, ES, ...)\n",
" grouped = defaultdict(list)\n",
" for alg in algorithms:\n",
" variant, raw_params, pretty = parse_variant_params(alg)\n",
" grouped[variant].append((alg, pretty))\n",
"\n",
" # gewünschte Reihenfolge (falls vorhanden)\n",
" variant_order = [\"ana\", \"num\", \"approx\", \"ES\"]\n",
" ordered_variants = [v for v in variant_order if v in grouped] + [v for v in grouped.keys() if v not in variant_order]\n",
"\n",
" # LaTeX Header\n",
" cols = 2 + (1 if include_nan_col else 0) + len(metric_headers)\n",
" colspec = \"|\" + \"|\".join([\"c\"] * cols) + \"|\"\n",
"\n",
" header_cells = [\"Methode\", \"Parameterwerte\"]\n",
" if include_nan_col:\n",
" header_cells.append(\"NaN\")\n",
" header_cells += metric_headers\n",
"\n",
" lines = []\n",
" lines.append(r\"\\begin{table}[H]\")\n",
" lines.append(r\"\\centering\")\n",
" if caption:\n",
" lines.append(rf\"\\caption{{{caption}}}\")\n",
" lines.append(rf\"\\label{{{label}}}\")\n",
" lines.append(rf\"\\begin{{tabular}}{{{colspec}}}\")\n",
" lines.append(r\"\\hline\")\n",
" lines.append(\" & \".join(header_cells) + r\" \\\\\")\n",
" lines.append(r\"\\Xhline{1.5pt}\")\n",
"\n",
" # Zeilen bauen\n",
" for variant in ordered_variants:\n",
" rows = grouped[variant]\n",
" # für stable output: sort by pretty param (numerisch)\n",
" # (du kannst das ändern, wenn du eine andere Reihenfolge willst)\n",
" def sort_key(t):\n",
" _, pretty = t\n",
" # versuche numerisch zu sortieren\n",
" try:\n",
" parts = [float(p.strip()) for p in pretty.split(\",\")]\n",
" return parts\n",
" except Exception:\n",
" return [pretty]\n",
" rows = sorted(rows, key=sort_key)\n",
"\n",
" multi_n = len(rows)\n",
" method_name = {\n",
" \"ana\": \"analytisch\",\n",
" \"num\": \"numerisch\",\n",
" \"approx\": \"approximiert\"\n",
" }.get(variant, variant)\n",
"\n",
" for idx, (alg, pretty_param) in enumerate(rows):\n",
" row_cells = []\n",
"\n",
" if multi_n > 1:\n",
" if idx == 0:\n",
" row_cells.append(rf\"\\multirow{{{multi_n}}}{{*}}{{{method_name}}}\")\n",
" else:\n",
" row_cells.append(\"\") # Multirow fortsetzen\n",
" else:\n",
" row_cells.append(method_name)\n",
"\n",
" row_cells.append(pretty_param)\n",
"\n",
" if include_nan_col:\n",
" nans = nan_count_for_algorithm(results, example_keys, alg)\n",
" row_cells.append(str(nans))\n",
"\n",
" # Metriken\n",
" for mi in range(len(metric_headers)):\n",
" other_GL_mask = None\n",
" if gha_prefix == \"GHA2\" and variant == \"num\":\n",
" other_GL_mask = [\n",
" (\n",
" np.isfinite(results[k][alg][2]) and\n",
" abs(results[k][alg][2]) <= 10.0\n",
" )\n",
" for k in example_keys\n",
" ]\n",
" if other_GL_mask is not None:\n",
" print(f\"{alg}: {other_GL_mask.count(False)} falsche Linien\")\n",
" m = max_abs_metric(results, example_keys, alg, mi, is_angle=angle_mask[mi], wu=wu, mask=other_GL_mask)\n",
" if mi == 3:\n",
" row_cells.append(f\"${m:.2f}$\")\n",
" else:\n",
" row_cells.append(to_latex_sci(m))\n",
"\n",
" # Zeile + Linienlogik wie in deinem Beispiel\n",
" latex_row = \" & \".join(row_cells) + r\" \\\\\"\n",
"\n",
" # nach letzter Zeile einer Methode eine \\hline (wie bei dir)\n",
" if idx == multi_n - 1:\n",
" latex_row += r\"\\hline\"\n",
" lines.append(latex_row)\n",
"\n",
" lines.append(r\"\\end{tabular}\")\n",
" lines.append(r\"\\end{table}\")\n",
" lines.append(r\"\\noindent\")\n",
"\n",
" return \"\\n\".join(lines)\n",
"\n",
"\n",
"# --- Beispielaufruf ---\n",
"example_keys = list(key for i, key in enumerate(results.keys()))\n",
"if test == \"Panou\":\n",
" example_keys = example_keys[:14]\n",
"gha = \"GHA1\"\n",
"# example_keys = list(key for i, key in enumerate(results.keys()) if table_indices[i] == 3) # gefiltert auf Panou Gruppe etc.\n",
"latex = build_latex_table_from_results(\n",
" results,\n",
" gha_prefix=gha,\n",
" example_keys=example_keys,\n",
" caption=f\"Ergebnisse der Lösungsmethoden der {gha[3]}. GHA ({test})\",\n",
" label=f\"tab:results_{test}_{gha}\",\n",
" include_nan_col=True, # True, wenn du NaN-Spalte willst\n",
" wu=wu # wichtig, falls Winkelwerte rad sind\n",
")\n",
"print(latex)"
],
"id": "12591c3b707da905",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\\begin{table}[H]\n",
"\\centering\n",
"\\caption{Ergebnisse der Lösungsmethoden der 1. GHA (Random)}\n",
"\\label{tab:results_Random_GHA1}\n",
"\\begin{tabular}{|c|c|c|c|c|c|c|}\n",
"\\hline\n",
"Methode & Parameterwerte & NaN & $\\max(|\\Delta \\beta|)$ [$''$] & $\\max(|\\Delta \\lambda|)$ [$''$] & $\\max(|\\Delta \\alpha_1|)$ [$''$] & time [s] \\\\\n",
"\\Xhline{1.5pt}\n",
"\\multirow{9}{*}{analytisch} & 2, 20 & 32 & $1.037\\cdot10^{-08}$ & $5.633\\cdot10^{-09}$ & $3.298\\cdot10^{-09}$ & $0.01$ \\\\\n",
" & 2, 50 & 0 & $3.962\\cdot10^{-09}$ & $7.099\\cdot10^{-09}$ & $7.786\\cdot10^{-09}$ & $0.12$ \\\\\n",
" & 2, 80 & 0 & $3.962\\cdot10^{-09}$ & $7.099\\cdot10^{-09}$ & $7.786\\cdot10^{-09}$ & $0.43$ \\\\\n",
" & 8, 20 & 0 & $3.996\\cdot10^{-09}$ & $1.127\\cdot10^{-08}$ & $9.984\\cdot10^{-09}$ & $0.05$ \\\\\n",
" & 8, 50 & 0 & $3.996\\cdot10^{-09}$ & $1.127\\cdot10^{-08}$ & $9.984\\cdot10^{-09}$ & $0.52$ \\\\\n",
" & 8, 80 & 0 & $3.996\\cdot10^{-09}$ & $1.127\\cdot10^{-08}$ & $9.984\\cdot10^{-09}$ & $1.76$ \\\\\n",
" & 32, 20 & 0 & $4.775\\cdot10^{-09}$ & $1.081\\cdot10^{-08}$ & $9.526\\cdot10^{-09}$ & $0.18$ \\\\\n",
" & 32, 50 & 0 & $4.775\\cdot10^{-09}$ & $1.081\\cdot10^{-08}$ & $9.526\\cdot10^{-09}$ & $1.71$ \\\\\n",
" & 32, 80 & 0 & $4.775\\cdot10^{-09}$ & $1.081\\cdot10^{-08}$ & $9.526\\cdot10^{-09}$ & $7.03$ \\\\\\hline\n",
"\\multirow{5}{*}{numerisch} & 200 & 27 & $2.617\\cdot10^{-06}$ & $3.985\\cdot10^{-06}$ & $3.046\\cdot10^{-06}$ & $0.01$ \\\\\n",
" & 500 & 4 & $5.939\\cdot10^{-06}$ & $7.774\\cdot10^{-06}$ & $6.358\\cdot10^{-06}$ & $0.03$ \\\\\n",
" & 1000 & 0 & $4.543\\cdot10^{-07}$ & $1.972\\cdot10^{-06}$ & $1.796\\cdot10^{-06}$ & $0.07$ \\\\\n",
" & 5000 & 0 & $4.351\\cdot10^{-09}$ & $2.001\\cdot10^{-08}$ & $1.795\\cdot10^{-08}$ & $0.29$ \\\\\n",
" & 10000 & 0 & $0.000\\cdot10^{+00}$ & $0.000\\cdot10^{+00}$ & $0.000\\cdot10^{+00}$ & $0.57$ \\\\\\hline\n",
"\\multirow{3}{*}{approximiert} & 600 & 3 & $1.084\\cdot10^{+03}$ & $1.889\\cdot10^{+04}$ & $1.524\\cdot10^{+03}$ & $1.48$ \\\\\n",
" & 1250 & 3 & $1.257\\cdot10^{+02}$ & $8.470\\cdot10^{+03}$ & $1.136\\cdot10^{+03}$ & $3.18$ \\\\\n",
" & 6000 & 3 & $1.380\\cdot10^{+00}$ & $9.948\\cdot10^{+01}$ & $1.325\\cdot10^{+01}$ & $14.56$ \\\\\\hline\n",
"\\multirow{3}{*}{ES} & 60 & 0 & $3.354\\cdot10^{+04}$ & $3.007\\cdot10^{+05}$ & $6.480\\cdot10^{+05}$ & $7.97$ \\\\\n",
" & 600 & 0 & $1.372\\cdot10^{+04}$ & $6.354\\cdot10^{+04}$ & $6.480\\cdot10^{+05}$ & $52.69$ \\\\\n",
" & 1250 & 0 & $1.894\\cdot10^{+03}$ & $1.633\\cdot10^{+04}$ & $6.480\\cdot10^{+05}$ & $91.68$ \\\\\\hline\n",
"\\end{tabular}\n",
"\\end{table}\n",
"\\noindent\n"
]
}
],
"execution_count": 47
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-02-08T12:45:27.798160Z",
"start_time": "2026-02-08T12:45:27.247424Z"
}
},
"cell_type": "code",
"source": [
"def count_large_ds(results, example_keys, algorithm=\"GHA2_num\", threshold=10.0):\n",
" \"\"\"\n",
" Zählt Fälle, bei denen |Δs| > threshold ist.\n",
" \"\"\"\n",
" count = 0\n",
" for k in example_keys:\n",
" val = results[k][algorithm][2] # Δs\n",
" try:\n",
" if np.isfinite(val) and abs(val) > threshold:\n",
" count += 1\n",
" except Exception:\n",
" pass\n",
" return count\n",
"\n",
"example_keys = list(key for i, key in enumerate(results.keys()))\n",
"n_bad = count_large_ds(results, example_keys, algorithm=\"GHA2_num\", threshold=10.0)\n",
"print(f\"GHA2_num: |Δs| > 10 m in {n_bad} Fällen\")"
],
"id": "44f20396e6c5493c",
"outputs": [
{
"ename": "KeyError",
"evalue": "'GHA2_num'",
"output_type": "error",
"traceback": [
"\u001B[31m---------------------------------------------------------------------------\u001B[39m",
"\u001B[31mKeyError\u001B[39m Traceback (most recent call last)",
"\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[106]\u001B[39m\u001B[32m, line 16\u001B[39m\n\u001B[32m 13\u001B[39m \u001B[38;5;28;01mreturn\u001B[39;00m count\n\u001B[32m 15\u001B[39m example_keys = \u001B[38;5;28mlist\u001B[39m(key \u001B[38;5;28;01mfor\u001B[39;00m i, key \u001B[38;5;129;01min\u001B[39;00m \u001B[38;5;28menumerate\u001B[39m(results.keys()))\n\u001B[32m---> \u001B[39m\u001B[32m16\u001B[39m n_bad = \u001B[43mcount_large_ds\u001B[49m\u001B[43m(\u001B[49m\u001B[43mresults\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mexample_keys\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43malgorithm\u001B[49m\u001B[43m=\u001B[49m\u001B[33;43m\"\u001B[39;49m\u001B[33;43mGHA2_num\u001B[39;49m\u001B[33;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mthreshold\u001B[49m\u001B[43m=\u001B[49m\u001B[32;43m10.0\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[32m 17\u001B[39m \u001B[38;5;28mprint\u001B[39m(\u001B[33mf\u001B[39m\u001B[33m\"\u001B[39m\u001B[33mGHA2_num: |Δs| > 10 m in \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mn_bad\u001B[38;5;132;01m}\u001B[39;00m\u001B[33m Fällen\u001B[39m\u001B[33m\"\u001B[39m)\n",
"\u001B[36mCell\u001B[39m\u001B[36m \u001B[39m\u001B[32mIn[106]\u001B[39m\u001B[32m, line 7\u001B[39m, in \u001B[36mcount_large_ds\u001B[39m\u001B[34m(results, example_keys, algorithm, threshold)\u001B[39m\n\u001B[32m 5\u001B[39m count = \u001B[32m0\u001B[39m\n\u001B[32m 6\u001B[39m \u001B[38;5;28;01mfor\u001B[39;00m k \u001B[38;5;129;01min\u001B[39;00m example_keys:\n\u001B[32m----> \u001B[39m\u001B[32m7\u001B[39m val = \u001B[43mresults\u001B[49m\u001B[43m[\u001B[49m\u001B[43mk\u001B[49m\u001B[43m]\u001B[49m\u001B[43m[\u001B[49m\u001B[43malgorithm\u001B[49m\u001B[43m]\u001B[49m[\u001B[32m2\u001B[39m] \u001B[38;5;66;03m# Δs\u001B[39;00m\n\u001B[32m 8\u001B[39m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[32m 9\u001B[39m \u001B[38;5;28;01mif\u001B[39;00m np.isfinite(val) \u001B[38;5;129;01mand\u001B[39;00m \u001B[38;5;28mabs\u001B[39m(val) > threshold:\n",
"\u001B[31mKeyError\u001B[39m: 'GHA2_num'"
]
}
],
"execution_count": 106
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}