Zusammentragen
This commit is contained in:
2
.idea/Masterprojekt-Campusnetz.iml
generated
2
.idea/Masterprojekt-Campusnetz.iml
generated
@@ -4,7 +4,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.14" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.14 (Masterprojekt)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -3,5 +3,5 @@
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.14" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.14 (Masterprojekt)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
2566
Campusnetz.ipynb
2566
Campusnetz.ipynb
File diff suppressed because one or more lines are too long
35
Export.py
35
Export.py
@@ -24,3 +24,38 @@ class Export:
|
||||
eintrag_text = str(eintrag)
|
||||
zeile_als_text.append(eintrag_text)
|
||||
writer.writerow(zeile_als_text)
|
||||
|
||||
@staticmethod
|
||||
def ausgleichung_to_datei(dateiname, dict_ausgleichung):
|
||||
with open(dateiname, "w", newline="", encoding="utf-8") as csvfile:
|
||||
writer = csv.writer(csvfile, delimiter=";")
|
||||
|
||||
writer.writerow(["Parameter", "Wert"])
|
||||
|
||||
for key, value in dict_ausgleichung.items():
|
||||
|
||||
if hasattr(value, "tolist"):
|
||||
rows = value.rows
|
||||
cols = value.cols
|
||||
|
||||
writer.writerow([key, f"Matrix {rows}x{cols}"])
|
||||
|
||||
for i, zeile in enumerate(value.tolist()):
|
||||
zeile_als_text = [f"{key}_zeile_{i+1}"]
|
||||
for eintrag in zeile:
|
||||
try:
|
||||
eintrag_float = float(eintrag)
|
||||
eintrag_text = f"{eintrag_float}".replace(".", ",")
|
||||
except Exception:
|
||||
eintrag_text = str(eintrag)
|
||||
zeile_als_text.append(eintrag_text)
|
||||
writer.writerow(zeile_als_text)
|
||||
|
||||
else:
|
||||
try:
|
||||
value_float = float(value)
|
||||
value_text = f"{value_float}".replace(".", ",")
|
||||
except Exception:
|
||||
value_text = str(value)
|
||||
|
||||
writer.writerow([key, value_text])
|
||||
@@ -200,7 +200,7 @@ class FunktionalesModell:
|
||||
else:
|
||||
print("Koordinaten noch nicht implementiert!")
|
||||
|
||||
def beobachtungsvektor(self, liste_beobachtungsvektor_symbolisch):
|
||||
def beobachtungsvektor_numerisch(self, liste_beobachtungsvektor_symbolisch):
|
||||
liste_beobachtungsvektor_numerisch = []
|
||||
for beobachtung_symbolisch in liste_beobachtungsvektor_symbolisch:
|
||||
liste_beobachtungsvektor_numerisch.append(self.substitutionen_dict[sp.Symbol(beobachtung_symbolisch)])
|
||||
@@ -264,6 +264,10 @@ class FunktionalesModell:
|
||||
|
||||
return beobachtungsvektor_naeherung_numerisch_iteration0
|
||||
|
||||
def berechnung_dl(self, beobachtungsvektor_numerisch, beobachtungsvektor_naeherung_numerisch):
|
||||
dl = beobachtungsvektor_numerisch - beobachtungsvektor_naeherung_numerisch
|
||||
return dl
|
||||
|
||||
def dict_substitutionen_naeherungen_us(self):
|
||||
db_zugriff = Datenbankzugriff(self.pfad_datenbank)
|
||||
dict_koordinaten_B_L = self.berechnungen.geometrische_breite_laenge(db_zugriff.get_koordinaten("naeherung_us"))
|
||||
|
||||
@@ -2,15 +2,19 @@ from dataclasses import dataclass
|
||||
from typing import Sequence, List, Dict
|
||||
import sympy as sp
|
||||
import numpy as np
|
||||
import decimal as dec
|
||||
from decimal import Decimal
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
@dataclass
|
||||
class Genauigkeitsmaße:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def s0apost(v, P, r):
|
||||
s0apost = (dec((v.T * P * v)[0, 0]) / r) ** 0.5
|
||||
vv = (v.T * P * v)[0, 0]
|
||||
s0apost = (Decimal(str(vv)) / Decimal(r)) ** Decimal("0.5")
|
||||
return s0apost
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
from Stochastisches_Modell import StochastischesModell
|
||||
import sympy as sp
|
||||
import Export
|
||||
import Netzqualität_Genauigkeit
|
||||
|
||||
def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
||||
|
||||
Q_ll, P = stoch_modell.berechne_Qll_P() #Kofaktormatrix und P-Matrix
|
||||
#Q_ll, P = stoch_modell.berechne_Qll_P() #Kofaktormatrix und P-Matrix
|
||||
P = sp.eye(A.shape[0])
|
||||
N = A.T * P * A #Normalgleichungsmatrix N
|
||||
Q_xx = N.inv() #Kofaktormatrix der Unbekannten Qxx
|
||||
n = A.T * P * dl #Absolutgliedvektor n
|
||||
@@ -15,8 +19,10 @@ def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
||||
Q_vv = stoch_modell.berechne_Qvv(A, P, Q_xx) #Kofaktormatrix der Verbesserungen Qvv
|
||||
R = stoch_modell.berechne_R(Q_vv, P) #Redundanzmatrix R
|
||||
r = stoch_modell.berechne_r(R) #Redundanzanteile als Vektor r
|
||||
redundanzanteile = A.shape[0] - A.shape[1] #n-u+d
|
||||
soaposteriori = Netzqualität_Genauigkeit.Genauigkeitsmaße.s0apost(v, P, redundanzanteile)
|
||||
|
||||
return {
|
||||
dict_ausgleichung = {
|
||||
"dx": dx,
|
||||
"v": v,
|
||||
"P": P,
|
||||
@@ -26,4 +32,9 @@ def ausgleichung(A, dl, stoch_modell: StochastischesModell):
|
||||
"Q_vv": Q_vv,
|
||||
"R": R,
|
||||
"r": r,
|
||||
"soaposteriori": soaposteriori,
|
||||
}
|
||||
|
||||
Export.Export.ausgleichung_to_datei(r"Zwischenergebnisse\Ausgleichung_Iteration0.csv", dict_ausgleichung)
|
||||
|
||||
return dict_ausgleichung
|
||||
@@ -4,29 +4,38 @@ from typing import Dict, Tuple, Iterable
|
||||
|
||||
@dataclass
|
||||
class StochastischesModell:
|
||||
sigma_beob: Iterable[float] #σ a priori der einzelnen Beobachtung
|
||||
gruppe_beob: Iterable[int] #Gruppenzugehörigkeit jeder Beobachtung (Distanz, Richtung, GNSS, Nivellement,...,)
|
||||
n_beob: int
|
||||
sigma_beob: Iterable[float] =None #σ a priori der einzelnen Beobachtung
|
||||
gruppe_beob: Iterable[int] =None #Gruppenzugehörigkeit jeder Beobachtung (Distanz, Richtung, GNSS, Nivellement,...,)
|
||||
sigma0_gruppe: Dict[int, float] = field(default_factory=dict) #σ0² für jede Gruppe
|
||||
|
||||
|
||||
def __post_init__(self):
|
||||
self.sigma_beob = sp.Matrix(list(self.sigma_beob)) #Spaltenvektor
|
||||
self.gruppe_beob = sp.Matrix(list(self.gruppe_beob)) #Spaltenvektor
|
||||
# Defaults setzen
|
||||
if self.sigma_beob is None:
|
||||
self.sigma_beob = [1.0] * int(self.n_beob)
|
||||
|
||||
if self.gruppe_beob is None:
|
||||
self.gruppe_beob = [1] * int(self.n_beob)
|
||||
|
||||
# In SymPy-Spaltenvektoren umwandeln
|
||||
self.sigma_beob = sp.Matrix(list(self.sigma_beob))
|
||||
self.gruppe_beob = sp.Matrix(list(self.gruppe_beob))
|
||||
|
||||
# Dimension prüfen
|
||||
if self.sigma_beob.rows != self.gruppe_beob.rows:
|
||||
raise ValueError("sigma_obs und group_ids müssen gleich viele Einträge haben.")
|
||||
raise ValueError("sigma_beob und gruppe_beob müssen gleich viele Einträge haben.")
|
||||
|
||||
unique_groups = sorted({int(g) for g in self.gruppe_beob}) #jede Beobachtungsgruppe wird genau einmal berücksichtigt
|
||||
if self.sigma_beob.rows != int(self.n_beob):
|
||||
raise ValueError("n_beob passt nicht zur Länge von sigma_beob / gruppe_beob.")
|
||||
|
||||
# Fehlende Gruppen mit sigma0_sq = 1.0 ergänzen
|
||||
unique_groups = sorted({int(g) for g in self.gruppe_beob})
|
||||
for g in unique_groups:
|
||||
if g not in self.sigma0_gruppe: #Fehlende Gruppen mit σ_0j^2 = 1.0
|
||||
if g not in self.sigma0_gruppe:
|
||||
self.sigma0_gruppe[g] = 1.0
|
||||
|
||||
|
||||
@property
|
||||
def n_beob(self) -> int:
|
||||
return int(self.sigma_beob.rows)
|
||||
|
||||
|
||||
def berechne_Qll_P(self) -> Tuple[sp.Matrix, sp.Matrix]:
|
||||
n = self.n_beob
|
||||
Q_ll = sp.zeros(n, n)
|
||||
|
||||
5798
Zwischenergebnisse/Ausgleichung_Iteration0.csv
Normal file
5798
Zwischenergebnisse/Ausgleichung_Iteration0.csv
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user