-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patha.py
More file actions
30 lines (25 loc) · 641 Bytes
/
a.py
File metadata and controls
30 lines (25 loc) · 641 Bytes
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
import numpy as np
from glob import glob
import pickle
cs = ['F' , 'N' , 'O' , 'S' , 'Z']
x = []
y = []
for ind in range(len(cs)):
data_dir = './data/' + cs[ind] + '/*.txt'
all_f = glob(data_dir)
if(len(all_f) == 0):
data_dir = './data/' + cs[ind] + '/*.TXT'
all_f = glob(data_dir)
# print(all_f)
for f in all_f:
a = open(f,'r')
data = [float(i) for i in a.readlines()]
x.append(data)
y.append(ind)
# print(data)
# print(len(data))
x = np.array(x)
y = np.array(y)
print(x.shape)
pickle.dump(x, open('x.pkl' , 'wb'))
pickle.dump(y, open('y.pkl' , 'wb'))