In [38]:
import csv
import matplotlib.pylab as plt
fileName = "formatted_data/no_movement_channel_%s.csv"
# plot data
"""
channels 0 and 1: right motor cortex
channels 2 and 3: left motor cortex
"""
for i in range(0,4):
with open(fileName % i, 'rb') as csvFile:
csvReader = csv.reader(csvFile)
# skip and keep the first 3 header lines for later
header = csvReader.next()
unit = csvReader.next()
stuff = csvReader.next()
# format data for smoothing
t = []
x = []
timestamp = 0
for row in csvReader:
x.append(float(row[0]))
t.append(timestamp)
timestamp +=1
plt.figure(figsize=(20,5))
plt.title("channel_%s" % i)
plt.plot(t,x)
plt.legend()
plt.show()
In [4]:
import pandas as pd
In [41]:
for i in range(0,4):
raw_df = pd.read_csv(fileName % i)
df = pd.DataFrame([float(data) for data in raw_df['channel_value'][2:6000]])
df.plot(title="channel_%s" % i, figsize=(20,5))
In [ ]: