In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import obtener as ob
In [2]:
cd /home/rodrigo/dataTritiumWS22/
In [3]:
listaEnc = ['time', 'errors', 'limiters', 'current_sp', \
'velocity_sp', 'idc_sp', 'misc_sp', 'bus_voltage','bus_current',\
'velocity_m/s', 'motor_rpm', 'pc_current', 'pb_current', 'odometer',\
'bus_charge', 'bemf','vout_d', 'vout_q', 'iout_d', 'iout_q', '15v',\
'1.9v', '3.3v', 'motor_temp', 'dsp_temp', 'phase_a_temp', 'phase_b_temp',\
'phase_c_temp', 'can_trans_err', 'can_rec_err', 'slip_speed']
In [4]:
cd dia2
In [5]:
import glob
archivos = glob.glob("*.csv")
archivos.sort()
In [6]:
listofDF = []
for i in xrange(0,len(archivos)):
datos = pd.read_csv(archivos[i], names=listaEnc, header=0)
listofDF.append(datos)
In [7]:
motor1 = []
motor2 = []
for x in listofDF:
if str(x['errors'].values[0]) == str(' 0x0'):
motor1.append(x)
elif x['errors'].values[0] == ' 0x40':
motor2.append(x)
In [8]:
motor1total = pd.concat(motor1,axis =0)
motor2total = pd.concat(motor2,axis =0)
In [9]:
current1=motor1total['busCurrent'].values
current2=motor2total['busCurrent'].values
In [10]:
tiempo1 = 0.2*arange(0, len(current1))/3600
tiempo2 = 0.2*arange(0, len(current2))/3600
In [12]:
plt.plot(tiempo1+9,current1)
plt.plot(tiempo2+9,current2)
Out[12]:
In [22]:
from bokeh.plotting import *
output_notebook()
#prepare some data
x = tiempo1+9
y = current1
w = tiempo2+9
z = current2
# output to static HTML file
output_file("lines.html", title="Bus Voltage")
# Plot a `line` renderer setting the color, line thickness, title, and legend value.
p = figure(title="corriente1")
p.line(x, y, legend="Bus Voltage", x_axis_label='Segundos', y_axis_label='Voltaje')
p.line(w,z, line_color = 'red')
show(p)