Umbenennung, Umstrukturierung, Doc-Strings
This commit is contained in:
0
Tests/__init__.py
Normal file
0
Tests/__init__.py
Normal file
2655
Tests/algorithms_test.ipynb
Normal file
2655
Tests/algorithms_test.ipynb
Normal file
File diff suppressed because it is too large
Load Diff
130
Tests/alpha_conversion_test.ipynb
Normal file
130
Tests/alpha_conversion_test.ipynb
Normal file
@@ -0,0 +1,130 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "initial_id",
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2026-01-20T15:30:31.978159Z",
|
||||
"start_time": "2026-01-20T15:30:31.835157Z"
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2"
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": 1
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2026-01-20T15:30:33.910807Z",
|
||||
"start_time": "2026-01-20T15:30:32.803089Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"%reload_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
"import winkelumrechnungen as wu\n",
|
||||
"from ellipsoide import EllipsoidTriaxial\n",
|
||||
"from GHA_triaxial.utils import alpha_para2ell, alpha_ell2para\n",
|
||||
"import numpy as np"
|
||||
],
|
||||
"id": "9ad815aea55574e3",
|
||||
"outputs": [],
|
||||
"execution_count": 2
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2026-01-20T15:33:40.785362Z",
|
||||
"start_time": "2026-01-20T15:33:34.296487Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"ell = EllipsoidTriaxial.init_name(\"KarneyTest2024\")\n",
|
||||
"diffs = []\n",
|
||||
"for beta_deg in range(-180, 181, 45):\n",
|
||||
" for lamb_deg in range(-90, 91, 45):\n",
|
||||
" for alpha_deg in range(0, 360, 45):\n",
|
||||
" beta = wu.deg2rad(beta_deg)\n",
|
||||
" lamb = wu.deg2rad(lamb_deg)\n",
|
||||
" u, v = ell.ell2para(beta, lamb)\n",
|
||||
" alpha = wu.deg2rad(alpha_deg)\n",
|
||||
"\n",
|
||||
" alpha_para_1, *_ = alpha_ell2para(ell, beta, lamb, alpha)\n",
|
||||
" alpha_ell_1, *_ = alpha_para2ell(ell, u, v, alpha_para_1)\n",
|
||||
" diff_1 = wu.deg2rad(abs(alpha_ell_1 - alpha))/3600\n",
|
||||
"\n",
|
||||
" alpha_ell_2, *_ = alpha_para2ell(ell, u, v, alpha)\n",
|
||||
" alpha_para_2, *_ = alpha_ell2para(ell, beta, lamb, alpha_ell_2)\n",
|
||||
" diff_2 = wu.deg2rad(abs(alpha_para_2 - alpha))/3600\n",
|
||||
"\n",
|
||||
" diffs.append((beta_deg, lamb_deg, alpha_deg, diff_1, diff_2))\n",
|
||||
"diffs = np.array(diffs)"
|
||||
],
|
||||
"id": "98b9b220118deb3f",
|
||||
"outputs": [],
|
||||
"execution_count": 6
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2026-01-20T15:33:50.497990Z",
|
||||
"start_time": "2026-01-20T15:33:50.261115Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"i_max_ell = np.argmax(diffs[:, 3])\n",
|
||||
"max_ell = diffs[i_max_ell, 3]\n",
|
||||
"point_max_ell = diffs[i_max_ell, :3]\n",
|
||||
"\n",
|
||||
"i_max_para = np.argmax(diffs[:, 4])\n",
|
||||
"max_para = diffs[i_max_para, 4]\n",
|
||||
"point_max_para = diffs[i_max_para, :4]\n",
|
||||
"\n",
|
||||
"print(f'Für elliptisches Alpha = {point_max_ell[2]}° und beta = {point_max_ell[0]}°, lamb = {point_max_ell[1]}°: diff = {max_ell}\"')\n",
|
||||
"print(f'Für parametrisches Alpha = {point_max_para[2]}° und beta = {point_max_para[0]}°, lamb = {point_max_para[1]}°: diff = {max_ell}\"')\n",
|
||||
"pass"
|
||||
],
|
||||
"id": "3c74b65b0e85e3c2",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Für elliptisches Alpha = 315.0° und beta = -90.0°, lamb = -90.0°: diff = 3.426945967752335e-05\"\n",
|
||||
"Für parametrisches Alpha = 315.0° und beta = -90.0°, lamb = -90.0°: diff = 3.426945967752335e-05\"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"execution_count": 7
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
245
Tests/conversions_test.ipynb
Normal file
245
Tests/conversions_test.ipynb
Normal file
@@ -0,0 +1,245 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2"
|
||||
],
|
||||
"id": "746c5b9e4c0226e7",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "initial_id",
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"source": [
|
||||
"%reload_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
"import pickle\n",
|
||||
"import numpy as np\n",
|
||||
"import winkelumrechnungen as wu\n",
|
||||
"from itertools import product\n",
|
||||
"import pandas as pd\n",
|
||||
"from ellipsoide import EllipsoidTriaxial\n",
|
||||
"import plotly.graph_objects as go"
|
||||
],
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# ellips = \"KarneyTest2024\"\n",
|
||||
"ellips = \"BursaSima1980\"\n",
|
||||
"# ellips = \"Fiction\"\n",
|
||||
"ell: EllipsoidTriaxial = EllipsoidTriaxial.init_name(ellips)"
|
||||
],
|
||||
"id": "7b05ca89fcd7b331",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"def deg_range(start, stop, step):\n",
|
||||
" return [float(x) for x in range(start, stop + step, step)]\n",
|
||||
"\n",
|
||||
"def asymptotic_range(start, direction=\"up\", max_decimals=4):\n",
|
||||
" values = []\n",
|
||||
" for d in range(0, max_decimals + 1):\n",
|
||||
" step = 10 ** -d\n",
|
||||
" if direction == \"up\":\n",
|
||||
" values.append(start + (1 - step))\n",
|
||||
" else:\n",
|
||||
" values.append(start - (1 - step))\n",
|
||||
" return values"
|
||||
],
|
||||
"id": "61a6b14fef0180ad",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"beta_5_85 = deg_range(5, 85, 5)\n",
|
||||
"lambda_5_85 = deg_range(5, 85, 5)\n",
|
||||
"beta_5_90 = deg_range(5, 90, 5)\n",
|
||||
"lambda_5_90 = deg_range(5, 90, 5)\n",
|
||||
"beta_0_90 = deg_range(0, 90, 5)\n",
|
||||
"lambda_0_90 = deg_range(0, 90, 5)\n",
|
||||
"beta_90 = [90.0]\n",
|
||||
"lambda_90 = [90.0]\n",
|
||||
"beta_0 = [0.0]\n",
|
||||
"lambda_0 = [0.0]\n",
|
||||
"beta_asym_89 = asymptotic_range(89.0, direction=\"up\")\n",
|
||||
"lambda_asym_0 = asymptotic_range(1.0, direction=\"down\")"
|
||||
],
|
||||
"id": "f7184980a4b930b7",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"groups = {\n",
|
||||
" 1: list(product(beta_5_85, lambda_5_85)),\n",
|
||||
" 2: list(product(beta_0, lambda_0_90)),\n",
|
||||
" 3: list(product(beta_5_85, lambda_0)),\n",
|
||||
" 4: list(product(beta_90, lambda_5_90)),\n",
|
||||
" 5: list(product(beta_asym_89, lambda_asym_0)),\n",
|
||||
" 6: list(product(beta_5_85, lambda_90)),\n",
|
||||
" 7: list(product(lambda_asym_0, lambda_0_90)),\n",
|
||||
" 8: list(product(beta_0_90, lambda_asym_0)),\n",
|
||||
" 9: list(product(beta_asym_89, lambda_0_90)),\n",
|
||||
" 10: list(product(beta_0_90, beta_asym_89)),\n",
|
||||
"}"
|
||||
],
|
||||
"id": "cea9fd9cce6a4fd1",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"for nr, points in groups.items():\n",
|
||||
" points_cart = []\n",
|
||||
" for point in points:\n",
|
||||
" beta, lamb = point\n",
|
||||
" cart = ell.ell2cart(wu.deg2rad(beta), wu.deg2rad(lamb))\n",
|
||||
" points_cart.append(cart)\n",
|
||||
" groups[nr] = points_cart"
|
||||
],
|
||||
"id": "17a6a130782a89ce",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"results = {}\n",
|
||||
"\n",
|
||||
"for nr, points in groups.items():\n",
|
||||
" group_results = {\"ell\": [],\n",
|
||||
" \"para\": [],\n",
|
||||
" \"geod\": []}\n",
|
||||
" for point in points:\n",
|
||||
" elli = ell.cart2ell(point)\n",
|
||||
" cart_elli = ell.ell2cart(elli[0], elli[1])\n",
|
||||
" group_results[\"ell\"].append(np.linalg.norm(point - cart_elli, axis=-1))\n",
|
||||
"\n",
|
||||
" para = ell.cart2para(point)\n",
|
||||
" cart_para = ell.para2cart(para[0], para[1])\n",
|
||||
" group_results[\"para\"].append(np.linalg.norm(point - cart_para, axis=-1))\n",
|
||||
"\n",
|
||||
" geod = ell.cart2geod(point, \"ligas3\")\n",
|
||||
" cart_geod = ell.geod2cart(geod[0], geod[1], geod[2])\n",
|
||||
" group_results[\"geod\"].append(np.linalg.norm(point - cart_geod, axis=-1))\n",
|
||||
"\n",
|
||||
" group_results[\"ell\"] = np.array(group_results[\"ell\"])\n",
|
||||
" group_results[\"para\"] = np.array(group_results[\"para\"])\n",
|
||||
" group_results[\"geod\"] = np.array(group_results[\"geod\"])\n",
|
||||
" results[nr] = group_results"
|
||||
],
|
||||
"id": "c3298ea233bca274",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# with open(f\"conversion_results_{ellips}.pkl\", \"wb\") as f:\n",
|
||||
"# pickle.dump(results, f)"
|
||||
],
|
||||
"id": "e1285860be416ad3",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# with open(f\"conversion_results_{ellips}.pkl\", \"rb\") as f:\n",
|
||||
"# results = pickle.load(f)"
|
||||
],
|
||||
"id": "d26720e34595ccbc",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"df = pd.DataFrame({\n",
|
||||
" \"Gruppe\": [nr for nr in results.keys()],\n",
|
||||
" \"max_Δr_ell\": [f\"{max(result[\"ell\"]):.3g}\" for result in results.values()],\n",
|
||||
" \"max_Δr_para\": [f\"{max(result[\"para\"]):.3g}\" for result in results.values()],\n",
|
||||
" \"max_Δr_geod\": [f\"{max(result[\"geod\"]):.3g}\" for result in results.values()]\n",
|
||||
"})"
|
||||
],
|
||||
"id": "4e2e55e4699ec81e",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
},
|
||||
{
|
||||
"metadata": {},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"fig = go.Figure(data=[go.Table(\n",
|
||||
" header=dict(\n",
|
||||
" values=list(df.columns),\n",
|
||||
" fill_color=\"lightgrey\",\n",
|
||||
" align=\"left\"\n",
|
||||
" ),\n",
|
||||
" cells=dict(\n",
|
||||
" values=[df[col] for col in df.columns],\n",
|
||||
" align=\"left\"\n",
|
||||
" )\n",
|
||||
")])\n",
|
||||
"fig.update_layout(\n",
|
||||
" template=\"simple_white\",\n",
|
||||
" width=650,\n",
|
||||
" height=len(groups)*20+80,\n",
|
||||
" margin=dict(l=20, r=20, t=20, b=20))\n",
|
||||
"\n",
|
||||
"fig.show()\n",
|
||||
"# fig.write_image(f\"conversion_results_{ellips}.png\", width=650, height=len(groups)*20+80, scale=2)"
|
||||
],
|
||||
"id": "c2fa82afef2d6e0e",
|
||||
"outputs": [],
|
||||
"execution_count": null
|
||||
}
|
||||
],
|
||||
"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
|
||||
}
|
||||
34
Tests/test_biaxial.py
Normal file
34
Tests/test_biaxial.py
Normal file
@@ -0,0 +1,34 @@
|
||||
import numpy as np
|
||||
from ellipsoide import EllipsoidBiaxial
|
||||
from GHA_biaxial.bessel import gha1 as gha1_bessel
|
||||
from GHA_biaxial.gauss import gha1 as gha1_gauss
|
||||
from GHA_biaxial.rk import gha1 as gha1_rk
|
||||
from GHA_biaxial.gauss import gha2 as gha2_gauss
|
||||
|
||||
re = EllipsoidBiaxial.init_name("Bessel")
|
||||
|
||||
# phi0 = 0.6
|
||||
# lamb0 = 1.2
|
||||
# alpha0 = 0.45
|
||||
# s = 123456
|
||||
#
|
||||
# values_bessel = gha1_bessel(re, phi0, lamb0, alpha0, s)
|
||||
# alpha1_bessel = values_bessel[-1]
|
||||
# p1_bessel = re.bi_ell2cart(values_bessel[0], values_bessel[1], 0)
|
||||
#
|
||||
# values_gauss1 = gha1_gauss(re, phi0, lamb0, alpha0, s)
|
||||
# alpha1_gauss1 = values_gauss1[-1]
|
||||
# p1_gauss = re.bi_ell2cart(values_gauss1[0], values_gauss1[1], 0)
|
||||
#
|
||||
# values_rk = gha1_rk(re, phi0, lamb0 , alpha0, s, 10000)
|
||||
# alpha1_rk = values_rk[-1]
|
||||
# p1_rk = re.bi_ell2cart(values_rk[0], values_rk[1], 0)
|
||||
#
|
||||
# alpha0_gauss, alpha1_gauss2, s_gauss = gha2_gauss(re, phi0, lamb0, values_gauss1[0], values_gauss1[1])
|
||||
|
||||
phi0 = 0.6
|
||||
lamb0 = 1.2
|
||||
|
||||
cart = re.bi_ell2cart(phi0, lamb0, 0)
|
||||
ell = re.bi_cart2ell(cart)
|
||||
pass
|
||||
Reference in New Issue
Block a user