Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import random
|
||||
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
|
||||
|
||||
ell = EllipsoidTriaxial.init_name("KarneyTest2024")
|
||||
|
||||
def line2example(line: str) -> List:
|
||||
"""
|
||||
@@ -49,6 +54,116 @@ 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:
|
||||
eps = 1e-20
|
||||
long_short = 1.5
|
||||
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
|
||||
gamma = jacobi_konstante(beta0, lamb0, alpha0_ell, ell)
|
||||
if group == "a":
|
||||
if 1 >= gamma >= 0.1:
|
||||
if length == "short":
|
||||
if example[6] < long_short:
|
||||
examples.append(example)
|
||||
elif length == "long":
|
||||
if example[6] >= long_short:
|
||||
examples.append(example)
|
||||
else:
|
||||
examples.append(example)
|
||||
if group == "b":
|
||||
if 0.1 > gamma > eps:
|
||||
if length == "short":
|
||||
if example[6] < long_short:
|
||||
examples.append(example)
|
||||
elif length == "long":
|
||||
if example[6] >= long_short:
|
||||
examples.append(example)
|
||||
else:
|
||||
examples.append(example)
|
||||
if group == "c":
|
||||
if abs(gamma) <= eps:
|
||||
if length == "short":
|
||||
if example[6] < long_short:
|
||||
examples.append(example)
|
||||
elif length == "long":
|
||||
if example[6] >= long_short:
|
||||
examples.append(example)
|
||||
else:
|
||||
examples.append(example)
|
||||
if group == "de":
|
||||
if eps > gamma > -1e-17:
|
||||
if length == "short":
|
||||
if example[6] < long_short:
|
||||
examples.append(example)
|
||||
elif length == "long":
|
||||
if example[6] >= long_short:
|
||||
examples.append(example)
|
||||
else:
|
||||
examples.append(example)
|
||||
if group == "e":
|
||||
if -1e-17 >= gamma >= -1:
|
||||
if length == "short":
|
||||
if example[6] < long_short:
|
||||
examples.append(example)
|
||||
elif length == "long":
|
||||
if example[6] >= long_short:
|
||||
examples.append(example)
|
||||
else:
|
||||
examples.append(example)
|
||||
return examples
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_random_examples(10)
|
||||
examples_a = get_random_examples_gamma("a", 10, 42)
|
||||
examples_b = get_random_examples_gamma("b", 10, 42)
|
||||
examples_c = get_random_examples_gamma("c", 10, 42)
|
||||
examples_d = get_random_examples_gamma("d", 10, 42)
|
||||
examples_e = get_random_examples_gamma("e", 10, 42)
|
||||
pass
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user