-
Notifications
You must be signed in to change notification settings - Fork 0
/
removeUselessPoints.py
42 lines (35 loc) · 1023 Bytes
/
removeUselessPoints.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
import binarisationVariables as BV
import json
def removeUselessPoints():
with open("cutPoints.txt") as fileObj: cutPointsList = json.load(fileObj)
attributeNum = 0
uselessPointsNum = 0
uselessPointsSize = len(BV.uselessPoints)
tempCutPointsList = []
markedList = []
for cutPoints in cutPointsList:
marked = []
for point in cutPoints:
if uselessPointsNum < uselessPointsSize and attributeNum == BV.uselessPoints[uselessPointsNum]:
marked.append(1)
uselessPointsNum = uselessPointsNum + 1
else:
marked.append(0)
attributeNum = attributeNum + 1
markedList.append(marked)
cutpointRow = 0
i = 0
for marked in markedList:
vec = []
cutpointCol = 0
for var in marked:
i = i + 1
if var == 0:
vec.append(cutPointsList[cutpointRow][cutpointCol])
cutpointCol = cutpointCol + 1
cutpointRow = cutpointRow + 1
tempCutPointsList.append(vec)
cutPointsList = tempCutPointsList
fileObj = open("reducedCutpoints.txt","w")
json.dump(cutPointsList,fileObj)
fileObj.close()