NuMRI/kalman/other/theta_plot.py

43 lines
1.3 KiB
Python
Executable File

import matplotlib.pyplot as plt
import numpy as np
import os
from matplotlib import rc
#rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
if 'Zion' in os.popen('hostname').read():
user = 'yeye'
np.set_printoptions(threshold=5)
if 'fwn-bborg-5-166' in os.popen('hostname').read():
user = 'p283370'
Tf = 0.9
masterpath = '/home/'+user+'/Desktop/kalman/results/'
######################################################################
theta1 = np.loadtxt( masterpath + 'theta.txt')
t = np.linspace(0,Tf,theta1.size)
theta_real = t*0 - 60
#theta1 = 2**(theta1)
#theta2 = 2**(ltheta2)
#theta3 = 2**(ltheta3)
plt.figure(figsize=(10, 6), dpi=100)
plt.plot(t,theta1,'-',linewidth=2,label= r'$\theta_1 = $' + str(round(theta1[-1],2)) )
#plt.plot(t,theta1_s,'o-',linewidth=2,label= r'$\theta_1 stokes = $' + str(round(theta1_s[-1],2)) )
#plt.plot(t,theta2,'o-',linewidth=2,label= r'$\theta_2 = $' + str(round(theta2[-1],2)) )
#plt.plot(t,theta3,'o-',linewidth=2,label= r'$\theta_3 = $' + str(round(theta3[-1],2)) )
plt.plot(t,theta_real,'-k',linewidth=2,label= r'$real = $' + str( theta_real[-1] ) )
plt.xlabel(r'$time \ \ \ (s)$',fontsize=20)
plt.ylabel(r'$ \theta $',fontsize=20)
plt.legend(fontsize=14)
#plt.title(r'$\sigma = 0.101 $',fontsize =20 )
plt.show()