Abgabe fertig

This commit is contained in:
2026-02-11 12:08:46 +01:00
parent 5a293a823a
commit 59ad560f36
38 changed files with 3419 additions and 8763 deletions

View File

@@ -1,11 +1,12 @@
import random
from typing import List
import winkelumrechnungen as wu
from typing import List, Tuple
import numpy as np
from ellipsoide import EllipsoidTriaxial
from GHA_triaxial.gha1_ES import jacobi_konstante
from GHA_triaxial.utils import jacobi_konstante
from ellipsoid_triaxial import EllipsoidTriaxial
ell = EllipsoidTriaxial.init_name("KarneyTest2024")
file_path = r"Karney_2024_Testset.txt"
def line2example(line: str) -> List:
"""
@@ -31,7 +32,7 @@ def get_random_examples(num: int, seed: int = None) -> List:
"""
if seed is not None:
random.seed(seed)
with open(r"C:\Users\moell\OneDrive\Desktop\Vorlesungen\Master-Projekt\Python_Masterprojekt\GHA_triaxial\Karney_2024_Testset.txt") as datei:
with open(file_path) as datei:
lines = datei.readlines()
examples = []
for i in range(num):
@@ -46,7 +47,7 @@ def get_examples(l_i: List) -> List:
:param l_i: Liste von Indizes
:return: Liste mit Beispielen
"""
with open("Karney_2024_Testset.txt") as datei:
with open(file_path) as datei:
lines = datei.readlines()
examples = []
for i in l_i:
@@ -54,53 +55,21 @@ def get_examples(l_i: List) -> List:
examples.append(example)
return examples
# beta0, lamb0, alpha0_ell, beta1, lamb1, alpha1_ell, s
def get_random_examples_simple_short(num: int, seed: int = None) -> List:
if seed is not None:
random.seed(seed)
with open(r"C:\Users\moell\OneDrive\Desktop\Vorlesungen\Master-Projekt\Python_Masterprojekt\GHA_triaxial\Karney_2024_Testset.txt") as datei:
lines = datei.readlines()
examples = []
while len(examples) < num:
example = line2example(lines[random.randint(0, len(lines) - 1)])
beta0, lamb0, alpha0_ell, beta1, lamb1, alpha1_ell, s = example
if s < 1 and abs(abs(beta0) - np.pi/2) > 1e-5 and lamb0 != 0 and abs(abs(lamb0) - np.pi) > 1e-5:
examples.append(example)
return examples
def get_random_examples_umbilics_start(num: int, seed: int = None) -> List:
if seed is not None:
random.seed(seed)
with open(r"C:\Users\moell\OneDrive\Desktop\Vorlesungen\Master-Projekt\Python_Masterprojekt\GHA_triaxial\Karney_2024_Testset.txt") as datei:
lines = datei.readlines()
examples = []
while len(examples) < num:
example = line2example(lines[random.randint(0, len(lines) - 1)])
beta0, lamb0, alpha0_ell, beta1, lamb1, alpha1_ell, s = example
if abs(abs(beta0) - np.pi/2) < 1e-5 and (lamb0 == 0 or abs(abs(lamb0) - np.pi) < 1e-5):
examples.append(example)
return examples
def get_random_examples_umbilics_end(num: int, seed: int = None) -> List:
if seed is not None:
random.seed(seed)
with open(r"C:\Users\moell\OneDrive\Desktop\Vorlesungen\Master-Projekt\Python_Masterprojekt\GHA_triaxial\Karney_2024_Testset.txt") as datei:
lines = datei.readlines()
examples = []
while len(examples) < num:
example = line2example(lines[random.randint(0, len(lines) - 1)])
beta0, lamb0, alpha0_ell, beta1, lamb1, alpha1_ell, s = example
if abs(abs(beta1) - np.pi/2) < 1e-5 and (lamb1 == 0 or abs(abs(lamb1) - np.pi) < 1e-5):
examples.append(example)
return examples
def get_random_examples_gamma(group: str, num: int, seed: int = None, length: str = None) -> List:
"""
Zufällige Beispiele aus Karney in Gruppen nach Einteilung anhand der Jacobi-Konstanten
:param group: Gruppe
:param num: Anzahl
:param seed: Random-Seed
:param length: long oder short, sond egal
:return: Liste mit Beispielen
"""
eps = 1e-20
long_short = 2
if seed is not None:
random.seed(seed)
with open(r"C:\Users\moell\OneDrive\Desktop\Vorlesungen\Master-Projekt\Python_Masterprojekt\GHA_triaxial\Karney_2024_Testset.txt") as datei:
with open(file_path) as datei:
lines = datei.readlines()
examples = []
i = 0