Script ART vs IndLoc plotting + Tested Ferrite Recordings

I wrote a script that can plot and compare the IndLoc system with the ART system quite quickly.

But I think the old Recorded data is corrupted from the calibration mistake.
This commit is contained in:
seyffejn 2021-02-01 17:21:55 +01:00
parent 0bd07c630a
commit 036ec76155
251 changed files with 48646 additions and 82 deletions

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

View File

@ -2,84 +2,56 @@ import matplotlib.pyplot as plt
import numpy as np import numpy as np
import re import re
"""--------------- Open, format and save ART positions from text files---------------------------------------------"""
# Opening a recording
art_recording = open('ART_IndLoc precision tests/Recording_1.txt', 'r')
art_recording = art_recording.read()
# Formatting a recording class ART_plotting:
art_recording = re.split(' |\n', art_recording) # split string at whitespace and linebreak def __init__(self):
art_recording = np.array(art_recording) # list -> np.array self.bla = 0
# Count the total number of recorded positions
total_pos_counter = 0
for i in art_recording:
if i == '6d': # this is the flag marking a 6d position (Syntax of the ART guys in the txt files)
total_pos_counter += 1
# Create an empty array which will store the ART measurement infos def plot_art(self, recording_number):
art_info = np.zeros((total_pos_counter, 7)) # [t, x, y, z, alpha, beta, gamma] """
:param recording_name: int, Choose which recording to print e.g. Recording_!1! , Recording_!2!, etc.
:return: void it just plots
"""
# Fill the empty numpy array with the information's of the art_recording """--------------- Open, format and save ART positions from text files---------------------------------------"""
pos_counter = 0 # Opening a recording
for i in range(len(art_recording)): art_recording = open('ART_IndLoc precision tests/Recording_'+str(recording_number)+'.txt', 'r')
if art_recording[i] == 'ts': # following entry is timestamp art_recording = art_recording.read()
art_info[pos_counter] = float(art_recording[i+1])
if art_recording[i] == '6d': # following entries are x,y,z,alpha,beta,gamma
art_info[pos_counter, 1] = float(art_recording[i+3].split('[')[1]) # x (had to delete some excess text)
art_info[pos_counter, 2] = float(art_recording[i+4]) # y
art_info[pos_counter, 3] = float(art_recording[i+5]) # z
art_info[pos_counter, 4] = float(art_recording[i+6]) # alpha # Formatting a recording
art_info[pos_counter, 5] = float(art_recording[i+7]) # beta art_recording = re.split(' |\n', art_recording) # split string at whitespace and linebreak
art_info[pos_counter, 6] = float(art_recording[i+8].split(']')[0]) # gamma (had to delete some excess text art_recording = np.array(art_recording) # list -> np.array
# Count the total number of recorded positions
total_pos_counter = 0
for i in art_recording:
if i == '6d': # this is the flag marking a 6d position (Syntax of the ART guys in the txt files)
total_pos_counter += 1
pos_counter += 1 # Create an empty array which will store the ART measurement infos
art_info = np.zeros((total_pos_counter, 7)) # [t, x, y, z, alpha, beta, gamma]
# Fill the empty numpy array with the information's of the art_recording
pos_counter = 0
for i in range(len(art_recording)):
if art_recording[i] == 'ts': # following entry is timestamp
art_info[pos_counter] = float(art_recording[i+1])
if art_recording[i] == '6d': # following entries are x,y,z,alpha,beta,gamma
art_info[pos_counter, 1] = float(art_recording[i+3].split('[')[1]) # x (had to delete some excess text)
art_info[pos_counter, 2] = float(art_recording[i+4]) # y
art_info[pos_counter, 3] = float(art_recording[i+5]) # z
"""------------------- Plotting (First ART, then IndLoc)------------------------------------------------------""" art_info[pos_counter, 4] = float(art_recording[i+6]) # alpha
font = {"family":"serif", art_info[pos_counter, 5] = float(art_recording[i+7]) # beta
"color":"black", art_info[pos_counter, 6] = float(art_recording[i+8].split(']')[0]) # gamma (had to delete some excess text
"size":15}
plt.plot(art_info[:, 1], art_info[:, 2], color="g", label="ART System") pos_counter += 1
print("x=", art_info[:, 1]) """------------------- Plotting ART ----------------------------------------------------"""
print("y=", art_info[:, 2]) font = {"family":"serif",
"color":"black",
"size":15}
plt.grid() plt.plot(art_info[:, 1], art_info[:, 2], color="lightgreen", label="ART System", linewidth=5, marker="x")
positions = np.load("calculated_positions/current_positions.npy")
positions = positions*1000 # from metre to millimetre
plt.plot(positions[:, 0], positions[:, 1], label="Ind Loc")
#
# positions = np.load("calculated_positions/Positions_1.9.npy")
# positions = positions*1000 # from metre to millimetre
# plt.plot(positions[:, 0], positions[:, 1], label="1.9")
#
# positions = np.load("calculated_positions/Positions_1.10.npy")
# positions = positions*1000 # from metre to millimetre
# plt.plot(positions[:, 0], positions[:, 1], label="1.10")
#
# positions = np.load("calculated_positions/Positions_1.11.npy")
# positions = positions*1000 # from metre to millimetre
# plt.plot(positions[:, 0], positions[:, 1], label="1.11")
plt.legend() print("x=", art_info[:, 1])
plt.show() print("y=", art_info[:, 2])
""" ------------------------ Analyzing one Recording ---------------------------------------------------------------"""
data = np.load("recorded_data\ART Recordings\Recording_17.npy")
print(np.shape(data))
print("sample 1000:", data[1000]) # x,y,z, f1,f2,f3,...,m1,m2,m3,...,m8
for i in range(16):
ant_averaged = np.average(data[:, 3+i])
if i <= 7:
print("Frame", i+1, " averaged [V] =", ant_averaged)
else:
print("Main", i+1-8, " averaged [V] =", ant_averaged)
print("avg_main8 * Faktor =", ant_averaged*88.74017567)

Some files were not shown because too many files have changed in this diff Show More