Commit c1d4509b authored by Lorenz Halt's avatar Lorenz Halt 🔀
Browse files

update data_visualizer

parent 38c8a99d
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#Pfade der Daten\n", "#Pfade der Daten (meas_path für measurement_logger Data / data_path für ilc_rosproxy Data)\n",
"meas_path = local_path + \"/ilc_Meas\"\n", "meas_path = local_path + \"/ilc_Meas\"\n",
"data_path = local_path + \"/test\"\n", "data_path = local_path + \"/test\" \n",
"\n", "\n",
"if os.path.exists(plot_path) == False:\n", "if os.path.exists(plot_path) == False:\n",
" os.makedirs(plot_path)" " os.makedirs(plot_path)"
......
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
import os import os
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
local_path = "/home/ipa325/Documents" local_path = "/home/ipa325/Documents"
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
def read(file): def read(file):
with open(file, 'r') as f: with open(file, 'r') as f:
header_str = f.readline().strip() header_str = f.readline().strip()
data = np.genfromtxt(file, data = np.genfromtxt(file,
delimiter=',', delimiter=',',
autostrip=True, autostrip=True,
skip_header=1) skip_header=1)
return data, header_str return data, header_str
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
def error_convergence(data): def error_convergence(data):
y = np.linalg.norm(data[:,1:], ord=2, axis=0) y = np.linalg.norm(data[:,1:], ord=2, axis=0)
return y return y
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
#Pfade der Daten #Pfade der Daten (meas_path für measurement_logger Data / data_path für ilc_rosproxy Data)
meas_path = local_path + "/ilc_Meas" meas_path = local_path + "/ilc_Meas"
data_path = local_path + "/test" data_path = local_path + "/test"
if os.path.exists(plot_path) == False: if os.path.exists(plot_path) == False:
os.makedirs(plot_path) os.makedirs(plot_path)
``` ```
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
#hacky plots für den Measurement_logger #hacky plots für den Measurement_logger
plt.figure() plt.figure()
num=-1 num=-1
for n in range(0,100): for n in range(0,100):
for i in range(0,100): for i in range(0,100):
for j in range(0,100): for j in range(0,100):
try: try:
if n<10: if n<10:
if i <10: if i <10:
if j<10: if j<10:
err,h = read(meas_path + "/force_meas_2021-03-22_0{}_0{}_0{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_0{}_0{}_0{}.csv".format(n,i,j))
else: else:
err,h = read(meas_path + "/force_meas_2021-03-22_0{}_0{}_{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_0{}_0{}_{}.csv".format(n,i,j))
else: else:
if j<10: if j<10:
err,h = read(meas_path + "/force_meas_2021-03-22_0{}_{}_0{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_0{}_{}_0{}.csv".format(n,i,j))
else: else:
err,h = read(meas_path + "/force_meas_2021-03-22_0{}_{}_{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_0{}_{}_{}.csv".format(n,i,j))
else: else:
if i<10: if i<10:
if j<10: if j<10:
err,h = read(meas_path + "/force_meas_2021-03-22_{}_0{}_0{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_{}_0{}_0{}.csv".format(n,i,j))
else: else:
err,h = read(meas_path + "/force_meas_2021-03-22_{}_0{}_{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_{}_0{}_{}.csv".format(n,i,j))
else: else:
if j<10: if j<10:
err,h = read(meas_path + "/force_meas_2021-03-22_{}_{}_0{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_{}_{}_0{}.csv".format(n,i,j))
else: else:
err,h = read(meas_path + "/force_meas_2021-03-22_{}_{}_{}.csv".format(n,i,j)) err,h = read(meas_path + "/force_meas_2021-03-22_{}_{}_{}.csv".format(n,i,j))
num=num+1 num=num+1
plt.plot(err.T[0],-1*err.T[6], label = num) plt.plot(err.T[0],-1*err.T[6], label = num)
except: except:
pass pass
#plt.legend() #plt.legend()
plt.show() plt.show()
``` ```
%%%% Output: display_data %%%% Output: display_data
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
#plots für daten in data_path (von ilc_rosproxy geschrieben) #plots für daten in data_path (von ilc_rosproxy geschrieben)
plt.figure() plt.figure()
convergence = [] convergence = []
for i in range(0,100): for i in range(0,100):
try: try:
err,h = read(data_path + "/read_error/read_error_{}.csv".format(i)) err,h = read(data_path + "/read_error/read_error_{}.csv".format(i))
convergence.append( np.max( error_convergence(err) ) ) convergence.append( np.max( error_convergence(err) ) )
plt.plot(err.T[0],err.T[1]) plt.plot(err.T[0],err.T[1])
except: except:
pass pass
plt.show() plt.show()
print(convergence) print(convergence)
plt.figure() plt.figure()
plt.plot(convergence) plt.plot(convergence)
plt.show plt.show
``` ```
......
Supports Markdown
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