Commit 39580b88 authored by Jadracka's avatar Jadracka
Browse files

Added standard deviation for distances, cartesian coordinates calculated from...

Added standard deviation for distances, cartesian coordinates calculated from polar measurements. Reading in measurements and coordinates is now a function instead of part of the main code.
parent 7fc14814
......@@ -10,7 +10,7 @@ import numpy as np
#import sys
#import string
#import math as m
import math as m
import config as cg
import functions as fc
......@@ -46,11 +46,9 @@ LoS_measured_points_all_good = True
nominal_points_all_measured = True
all_points_in_lines_measured = True
for line in LoS_measurements:
if (cg.Print_typos) and (line not in cg.Lines_of_sight):
# printing which lines are in measurements input but are not in the
# printing which lines are in measurements input but are not in the
# default naming either due to typo or just simply missing in the nominal
# LoS decription
print("Line %s was measured, but not expected." % (line))
......@@ -60,7 +58,7 @@ for line in LoS_measurements:
for point in cg.Lines_of_sight[line]:
if point in LoS_measurements[line].keys():
line_points_sorted.append(point)
sorted_measured_points_in_lines[line] = tuple(line_points_sorted)
sorted_measured_points_in_lines[line] = tuple(line_points_sorted)
if line_points_sorted != list(cg.Lines_of_sight[line]):
all_points_in_lines_measured = False
if cg.Print_typos:
......@@ -88,9 +86,9 @@ for point in Nominal_coords.keys():
if (cg.Print_typos) and (measured_lines_all_good):
print("All measured lines were expected, no typos found.")
if (cg.Print_typos) and (LoS_measured_points_all_good):
print("All measured points are correct, in correct lines, no typos found.")
print("All measured points are correct, in correct lines, no typos found.")
if (cg.Print_typos) and (nominal_points_all_measured):
print("All nominal points were measured at least once.")
print("All nominal points in IFM lines were measured at least once.")
if (cg.Print_typos) and not (all_points_in_lines_measured):
print("Not all points in lines were measured. Continuing in analysis.")
......@@ -98,6 +96,29 @@ if (cg.Print_typos) and not (all_points_in_lines_measured):
del all_measured_points, nominal_points_all_measured, \
all_points_in_lines_measured
Pol_measurements_cart = {}
for instrument in Pol_measurements:
Pol_measurements_cart[instrument] = {}
for point in Pol_measurements[instrument]:
Pol_measurements_cart[instrument][point] = fc.polar2cart3D(
Pol_measurements[instrument][point])
del instrument, point
for instrument in Pol_measurements_cart:
points = tuple(Pol_measurements_cart[instrument].keys())
for i in range (1,len(points)):
Measured = fc.slope_distance(Pol_measurements_cart[instrument][
points[i]],Pol_measurements_cart[instrument][points[i-1]])
if points[i-1] not in Nominal_coords.keys() and cg.Print_typos:
print('Point %s measured by %s is not in Nominals.' %(points[i-1],
instrument))
if (points[i] in Nominal_coords.keys()) and ((points[i-1]) in
Nominal_coords.keys()):
Nominal = fc.slope_distance(Nominal_coords[points[i]],
Nominal_coords[points[i-1]])
delta = Nominal - Measured
del instrument, i
measured_distances_in_lines = {}
if cg.Using_nominal_compare:
nominal_distances_in_line = {}
......@@ -142,9 +163,15 @@ if measured_lines_all_good and LoS_measured_points_all_good:
differences_in_distances[line])
del line
else:
print("Analysis cannot be performed as there are typos and errors in "
print("Analysis cannot be performed as there are typos and errors in "
"input data. Please correct before running the script again. "
"To help troubleshoot, change Print_typos in config.py to True.")
print('End of the script')
\ No newline at end of file
G17 = fc.StDev_XYZ_from_Polar(Nominal_coords['Girder_17'],cg.Dist_StDev,
cg.Ang_StDev,cg.Ang_StDev)
G18 = fc.StDev_XYZ_from_Polar(Nominal_coords['Girder_18'],cg.Dist_StDev,
cg.Ang_StDev,cg.Ang_StDev)
StDev1817 = fc.StDev_distance(Nominal_coords['Girder_17'],
Nominal_coords['Girder_18'],G17,G18)
print(StDev1817)
print('End of the script')
Instrument_0 PQK36_4 2392.232 23.3521 90.8281
Instrument_0 PQL6_6 1827.207 -13.9568 110.3317
Instrument_0 PQK62_11 2344.069 -74.2079 93.8212
Instrument_0 PQK62_5 2114.108 -65.5147 93.1734
Instrument_0 PQK62_6 2123.918 -65.5400 108.8129
Instrument_0 PQK62_12 2352.835 -74.2054 107.9531
Instrument_0 PQK62_10 2264.483 -76.6349 90.1851
Instrument_0 PQK62_4 2025.419 -67.8080 89.0132
Instrument_0 PQK62_3 1735.219 -76.0525 87.1927
Instrument_0 Girder_5 1353.736 -64.0997 114.1327
Instrument_0 Girder_6 1916.134 -52.5513 109.9680
Instrument_0 PQL6_10 1681.989 -38.2288 86.8007
Instrument_0 PQL6_11 1787.300 -37.5281 91.9756
Instrument_0 PQL6_12 1798.910 -37.5453 110.4647
Instrument_0 Girder_10 1826.021 -25.9160 117.3271
Instrument_0 PQL6_4 1711.854 -12.8040 87.0743
Instrument_0 PQL6_5 1815.820 -13.9279 92.1149
Instrument_0 Girder_14 1983.828 0.9049 109.6235
Instrument_0 Girder_13 1449.650 13.8721 113.3478
Instrument_0 PQK36_12 2229.037 13.0390 108.5031
Instrument_0 PQK36_10 2136.028 15.4449 89.7142
Instrument_0 Girder_TP 1738.730 23.3771 118.5032
Instrument_0 PQK36_5 2467.864 20.9053 94.2581
Instrument_0 PQK36_6 2476.091 20.8870 107.6508
Instrument_0 PQK36_9 1862.634 23.8895 88.2036
Instrument_0 Girder_18 2508.625 20.8411 112.3602
Instrument_0 Girder_12 1868.373 -13.9689 116.7243
Instrument_0 Girder_8 1838.661 -37.5476 116.9392
Instrument_0 Girder_4 2157.177 -65.5873 114.3772
Instrument_0 Girder_2 2381.013 -74.2638 112.9809
Instrument_0 PQK36_4 2363.591 -158.7280 90.8781
Instrument_0 PQL6_6 1757.258 -121.1127 110.9655
Instrument_0 PQK62_11 2531.752 -65.2616 94.4307
Instrument_0 PQK62_5 2271.077 -72.6262 93.8145
Instrument_0 PQK62_6 2280.384 -72.5751 108.3722
Instrument_0 PQK62_12 2539.593 -65.2245 107.5157
Instrument_0 PQK62_10 2634.789 -67.5495 91.7185
Instrument_0 PQK62_4 2386.061 -74.8644 90.8474
Instrument_0 PQK62_3 2691.754 -80.4576 91.9189
Instrument_0 Girder_5 2587.016 -91.6872 107.4990
Instrument_0 Girder_6 2017.729 -83.7600 109.6521
Instrument_0 PQL6_10 1967.968 -98.7982 88.9364
Instrument_0 PQL6_11 1828.650 -97.5094 92.3667
Instrument_0 PQL6_12 1839.019 -97.4705 110.4431
Instrument_0 Girder_10 1811.928 -108.7484 117.6826
Instrument_0 PQL6_4 1892.119 -120.8705 88.5241
Instrument_0 PQL6_5 1746.445 -121.1280 92.0186
Instrument_0 Girder_14 1845.907 -137.5454 110.5566
Instrument_0 Girder_13 2456.700 -132.3316 107.9943
Instrument_0 PQK36_12 2039.507 -151.6646 109.4864
Instrument_0 PQK36_10 2156.362 -149.6938 89.9899
Instrument_0 Girder TP 2562.140 -140.8100 112.6112
Instrument_0 PQK36_5 2248.003 -160.9545 93.8639
Instrument_0 PQK36_6 2257.214 -160.9639 108.5660
Instrument_0 PQK36_9 2491.704 -144.8951 91.3580
Instrument_0 Girder_18 2287.774 -161.0508 113.7402
Instrument_0 Girder_12 1798.485 -121.1119 117.6092
Instrument_0 Girder_8 1879.817 -97.4793 116.7682
Instrument_0 Girder_4 2314.763 -72.5949 113.5505
Instrument_0 Girder_2 2570.907 -65.2934 112.1601
Instrument_1 PQK62_8 1912.868 -88.4077 92.4529
Instrument_1 PQL6_7 1184.455 -42.6261 116.0673
Instrument_1 PQK36_9 1862.621 23.8894 88.2035
......@@ -37,7 +37,7 @@ Instrument_1 PQK36_3 2152.053 31.6737 89.8183
Instrument_1 PQK36_2 2063.496 34.8810 93.1692
Instrument_1 PQK36_1 2072.912 34.8412 109.2065
Instrument_1 PQK36_7 1770.548 27.2686 110.7741
Instrument_1 Girder_TP 1738.710 23.3771 118.5030
Instrument_1 Girder TP 1738.710 23.3771 118.5030
Instrument_1 Girder_13 1449.653 13.8719 113.3475
Instrument_1 Girder_14 1983.839 0.9051 109.6234
Instrument_1 PQL6_1 1226.675 -6.2772 115.5865
......
Instrument_0 PQK62_8 1912.86809 -88.40767 92.45291
Instrument_0 PQL6_7 1184.45469 -42.62611 116.06730
Instrument_0 PQK36_9 1862.62094 23.88942 88.20346
Instrument_0 PQK36_10 2136.02809 15.44465 89.71481
Instrument_0 PQK36_8 1759.26612 27.31425 91.96341
Instrument_0 PQK36_3 2152.05306 31.67367 89.81835
Instrument_0 PQK36_2 2063.49642 34.88101 93.16916
Instrument_0 PQK36_1 2072.91161 34.84122 109.20647
Instrument_0 PQK36_7 1770.54822 27.26860 110.77409
Instrument_0 Girder_TP 1738.71020 23.37715 118.50298
Instrument_0 Girder_13 1449.65323 13.87187 113.34746
Instrument_0 Girder_14 1983.83878 0.90508 109.62344
Instrument_0 PQL6_1 1226.67474 -6.27720 115.58649
Instrument_0 PQL6_2 1210.55245 -6.18715 88.19100
Instrument_0 PQL6_3 1355.80640 -8.32103 83.65735
Instrument_0 PQL6_9 1317.69650 -41.14335 83.11779
Instrument_0 PQL6_8 1167.82710 -42.56189 87.70787
Instrument_0 Girder_9 1224.32379 -24.36572 126.33381
Instrument_0 Girder_5 1353.73530 -64.09899 114.13223
Instrument_0 Girder_6 1916.13449 -52.55106 109.96772
Instrument_0 PQK62_4 2025.40795 -67.80790 89.01306
Instrument_0 PQK62_3 1735.21245 -76.05287 87.19327
Instrument_0 PQK62_2 1623.35862 -79.52447 91.12121
Instrument_0 PQK62_1 1636.24541 -79.53321 111.54320
Instrument_0 PQK62_7 1923.89270 -88.38956 109.76652
Instrument_0 PQK62_9 2009.04066 -85.06726 88.94282
Instrument_0 Girder_1 1957.04071 -88.60608 115.82545
Instrument_0 Girder_3 1675.76006 -79.76229 118.59533
Instrument_0 Girder_7 1240.51945 -42.77665 125.55832
Instrument_0 Girder_11 1281.45902 -6.18411 124.77302
Instrument_0 Girder_17 2107.86117 34.87740 114.83997
Instrument_1 PQK36_4 2363.59145 -158.72804 90.87809
Instrument_1 PQL6_6 1757.25765 -121.11275 110.96550
Instrument_1 PQK62_11 2531.75172 -65.26162 94.43072
Instrument_1 PQK62_5 2271.07749 -72.62617 93.81448
Instrument_1 PQK62_6 2280.38396 -72.57507 108.37220
Instrument_1 PQK62_12 2539.59279 -65.22455 107.51571
Instrument_1 PQK62_10 2634.78894 -67.54949 91.71847
Instrument_1 PQK62_4 2386.06063 -74.86437 90.84739
Instrument_1 PQK62_3 2691.75398 -80.45765 91.91885
Instrument_1 Girder_5 2587.01599 -91.68722 107.49898
Instrument_1 Girder_6 2017.72871 -83.75999 109.65208
Instrument_1 PQL6_10 1967.96811 -98.79821 88.93639
Instrument_1 PQL6_11 1828.65001 -97.50943 92.36667
Instrument_1 PQL6_12 1839.01868 -97.47052 110.44312
Instrument_1 Girder_10 1811.92782 -108.74837 117.68257
Instrument_1 PQL6_4 1892.11938 -120.87048 88.52410
Instrument_1 PQL6_5 1746.44455 -121.12797 92.01859
Instrument_1 Girder_14 1845.90716 -137.54538 110.55659
Instrument_1 Girder_13 2456.69965 -132.33162 107.99426
Instrument_1 PQK36_12 2039.50740 -151.66456 109.48637
Instrument_1 PQK36_10 2156.36184 -149.69379 89.98990
Instrument_1 Girder_TP 2562.14019 -140.80996 112.61118
Instrument_1 PQK36_5 2248.00305 -160.95448 93.86393
Instrument_1 PQK36_6 2257.21365 -160.96388 108.56599
Instrument_1 PQK36_9 2491.70363 -144.89509 91.35796
Instrument_1 Girder_18 2287.77439 -161.05084 113.74024
Instrument_1 Girder_12 1798.48510 -121.11191 117.60923
Instrument_1 Girder_8 1879.81726 -97.47928 116.76819
Instrument_1 Girder_4 2314.76322 -72.59490 113.55053
Instrument_1 Girder_2 2570.90714 -65.29341 112.16010
......@@ -17,16 +17,19 @@ Created on Thu Feb 11 10:54:43 2021
"""
"""Data analysis tools"""
"""CAN BE CHANGED"""
Which_epochs = (0,) #the comma must stay, otherwise the variable will be just int
Which_epochs = (0,) #the comma must stay, otherwise the variable will be int
Using_nominal_compare = True
Line_differences_checking = False
IFM_StDev_sys = 0.0004 #mm, +- 0,2um based on Leica's white paper
IFM_StDev_ppm = 0.00015 #mm, 0,15um based on Leica's white paper
ADM_StDev = 0.010 #mm, from 2-5m based on Leica's typical errors
Ang_StDev =
Print_FIDs = False
Print_typos = False
Print_real2nominal_checks = True
IFM_StDev_sys = (0.0004,0.00015) #mm, +- 0,2um based on Leica's white paper
ADM_StDev = 0.010 #mm, from 2-5m based on Leica's typical errors
Ang_StDev = (0.015,0.003) #mm, needs to be calculated for each angle separately
Dist_StDev = (IFM_StDev_sys[0]+ADM_StDev,IFM_StDev_sys[1])
"""Nominal CAD coordinates of Fiducials
Standard SA format with spaces as delimiters and no comments:
......@@ -42,7 +45,7 @@ Group aka Line name 'space' Point name 'space' Sd [mm] 'space' Hz [gon] 'space'
Epochs_dictionary = {'LoS':{},'Pol':{}}
Epochs_dictionary['LoS'][0] = "Testing_measurements_Epoch0.txt"
Epochs_dictionary['LoS'][1] = "Testing_measurements_Epoch1.txt"
Epochs_dictionary['Pol'][0] = "Polar_measurements_0.txt"
Epochs_dictionary['Pol'][0] = "Polar_measurements_1.txt"
"""Which Epochs gonna be used and adding the data into the code"""
if len(Which_epochs) == 1:
......
......@@ -58,18 +58,18 @@ def sing(angle):
return result
def polar2cart3D(S, Hz, Z):
return [
S * sing(Hz) * cosg(Z),
S * sing(Hz) * sing(Z),
S * cosg(Hz)
]
return (
S * sing(Z) * cosg(Hz),
S * sing(Z) * sing(Hz),
S * cosg(Z)
)
def polar2cart3D(PointID):
return [
PointID[0] * sing(PointID[1]) * cosg(PointID[2]),
PointID[0] * sing(PointID[1]) * sing(PointID[2]),
PointID[0] * cosg(PointID[1])
]
def polar2cart3D(Point):
return (
Point[0] * sing(Point[2]) * cosg(Point[1]),
Point[0] * sing(Point[2]) * sing(Point[1]),
Point[0] * cosg(Point[2])
)
def Measurements_read_in(Meas_filename):
Meas_file = open(Meas_filename,'r')
......@@ -112,4 +112,44 @@ def Coords_read_in(Coords_file_name):
float(words[3]))
del line, words
Coords_file.close()
return Coords
\ No newline at end of file
return Coords
def StDev_sys_ppm(Value,StDev_tuple):
return float(StDev_tuple[0] + Value * StDev_tuple[1]/1000000)
def StDev_XYZ_from_Polar(Point, StDev_S, StDev_Hz, StDev_Z):
'''takes in Point measured in Polar coordinates and outputs tuple of
standard deviations for the XYZ components using config.py's values for
standard deviations of the measurements.'''
S = Point[0]/1000
Hz = Point[1]
Z = Point[2]
StDev_S = StDev_sys_ppm(S,StDev_S)
StDev_Hz = gon2rad(StDev_sys_ppm(Hz,StDev_Hz))
StDev_Z = gon2rad(StDev_sys_ppm(Z,StDev_Z))
StDev_X = m.sqrt(m.pow(StDev_S,2) * m.pow(cosg(Hz) * sing(Z),2)\
+ m.pow(StDev_Hz,2) * m.pow(-S * sing(Hz) * sing(Z),2)\
+ m.pow(StDev_Z,2) * m.pow(S * cosg(Hz) * cosg(Z),2))
StDev_Y = m.sqrt(m.pow(StDev_S,2) * m.pow(sing(Hz) * sing(Z),2)\
+ m.pow(StDev_Hz,2) * m.pow(S * cosg(Hz) * sing(Z),2)\
+ m.pow(StDev_Z,2) * m.pow(S * sing(Hz) * cosg(Z),2))
StDev_Zz = m.sqrt(m.pow(StDev_S,2) * m.pow(cosg(Z),2)\
+ m.pow(StDev_Z,2) * m.pow(-S * sing(Z),2))
return (StDev_X,StDev_Y,StDev_Zz)
def StDev_distance(Point_From, Point_To, StDevXYZ_From, StDevXYZ_To):
sd = slope_distance(Point_From, Point_To)
StDev_S = m.sqrt(m.pow(StDevXYZ_From[0],2) * m.pow((Point_To[0] \
- Point_From[0])/sd,2)
+ m.pow(StDevXYZ_To[0],2) * m.pow((Point_To[0] \
- Point_From[0])/-sd,2)
+ m.pow(StDevXYZ_From[1],2) * m.pow((Point_To[1] \
- Point_From[1])/sd,2)
+ m.pow(StDevXYZ_To[1],2) * m.pow((Point_To[1] \
- Point_From[1])/-sd,2)
+ m.pow(StDevXYZ_From[2],2) * m.pow((Point_To[2] \
- Point_From[2])/sd,2)
+ m.pow(StDevXYZ_To[2],2) * m.pow((Point_To[2] \
- Point_From[2])/-sd,2)
)
return StDev_S
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment