-
Notifications
You must be signed in to change notification settings - Fork 4
/
preprocess.py
63 lines (52 loc) · 1.1 KB
/
preprocess.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
59
60
61
62
63
import re
import numpy as np
import sys
DATA = 50000
F_no = 8
G_no = 12
def feautures_ssl(filename,size):
array = np.zeros(shape = (size,F_no))
obs = open(filename,"r")
i = 0
for line in obs:
lineSplit = line.split(" ")
#lineSplit = lineSplit[:-1]
for cor in range(F_no):
array[i][cor] = (lineSplit[(cor)])
i+=1
return array
def potential(filename,size):
pot = open(filename,"r")
array = np.zeros(shape = (size,G_no))
i = 0
for line in pot:
lineSplit=line.split(" ")
for k in range(G_no):
array[i][k]=(lineSplit[k])
i+=1
return array
def func_num(filename):
num = open(filename,"r")
number = []
i = 0
for line in num:
#lineSplit=line.split(" ")
#print(str(len(line)) + " "+str(i))
i+=1
number.append(int(line[0]+line[1]))
if(i>49999):
break
#print(int(line[0]+line[1]))
return number
def features(filename):
obs = open(filename,"r")
# x_centre = []
# y_centre = []
area = []
for line in obs:
lineSplit=line.split(" ")
# x_centre.append(lineSplit[0])
# y_centre.append(lineSplit[1])
area.append(lineSplit[2])
return area
#all_circles("data/obst.txt")