Last active
October 22, 2018 19:06
-
-
Save psy901/b23b3f977a163148929634c6a5f8041f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import csv | |
import matplotlib.pyplot as plt | |
from plot_data import plot_data | |
def plot_data(data): | |
""" simple plot for x, y """ | |
plt.title('BLE Plot'); | |
# plt.plot([row[0] for row in data], label="x") | |
plt.plot(data, label="rssi") | |
plt.legend(loc='upper right') | |
plt.show() | |
def get_data(file_name): | |
"""reads the file and returns """ | |
inputfile = open(file_name, mode="r") | |
data = [] | |
# start reading | |
for line in inputfile: | |
# print(line) | |
data.append(line.rstrip()) | |
return data | |
def run(): | |
# TODO: place your csv file in the same directory as task1-1.csv | |
file_name = 'task1-1.csv' | |
data = get_data(file_name) | |
print(data) | |
plot_data(data) | |
if __name__ == '__main__': | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment