-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plot.py
59 lines (48 loc) · 2.04 KB
/
Plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import numpy as np
import pandas as pd
import math
import matplotlib.pyplot as plt
from matplotlib import style
import sys
style.use('fivethirtyeight')
def input_file_csv(filename, file_label, file_color):
normalize_csv(filename)
df = pd.read_csv(filename, low_memory=False)
df.replace('?', -99999, inplace=True)
df.fillna(-99999, inplace=True)
xs = np.array(df['id'])
df.drop(['id'], 1, inplace=True)
ys = np.array(df.mean(axis=1))
plt.plot(xs,ys, color=file_color, label=file_label)
def normalize_csv(filename):
needToNorm = True
read = open(filename).read()
if 'id,' in read:
needToNorm = False
if needToNorm:
newText=read.replace(',','.')
newText=newText.replace(';',',')
with open(filename, "w") as f:
f.write(newText)
input_file_csv('data/medidas/H1N.csv', 'H1N', 'g')
input_file_csv('data/medidas/H1D10.csv', 'H1D10', 'b')
input_file_csv('data/medidas/H1D15.csv', 'H1D15', 'r')
input_file_csv('data/medidas/H1D25.csv', 'H1D25', 'k')
input_file_csv('data/medidas/H1D30-20.csv', 'H1D30-20', 'm')
input_file_csv('data/medidas/H1D50-20.csv', 'H1D50-20', 'c')
input_file_csv('data/medidas/H1D65.csv', 'H1D65', 'y')
input_file_csv('data/medidas/H1D75.csv', 'H1D75', 'yellow')
input_file_csv('data/medidas/H1D80.csv', 'H1D80', 'darkgray')
##input_file_csv('data/medidas/H1N_FASE.csv', 'H1N_FASE', 'g')
##input_file_csv('data/medidas/H1D10_FASE.csv', 'H1D10_FASE', 'b')
##input_file_csv('data/medidas/H1D15_FASE.csv', 'H1D15_FASE', 'r')
##input_file_csv('data/medidas/H1D25_FASE.csv', 'H1D25_FASE', 'k')
##input_file_csv('data/medidas/H1D30-20_FASE.csv', 'H1D30-20_FASE', 'm')
##input_file_csv('data/medidas/H1D50-20_FASE.csv', 'H1D50-20_FASE', 'c')
##input_file_csv('data/medidas/H1D65_FASE.csv', 'H1D65_FASE', 'y')
##input_file_csv('data/medidas/H1D75_FASE.csv', 'H1D75_FASE', 'yellow')
##input_file_csv('data/medidas/H1D80_FASE.csv', 'H1D80_FASE', 'darkgray')
plt.xlabel('Frequency (MHz)')
plt.ylabel('|S111| Means')
plt.legend()
plt.show()