-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocessing.py
More file actions
59 lines (50 loc) · 1.29 KB
/
preprocessing.py
File metadata and controls
59 lines (50 loc) · 1.29 KB
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
import tqdm
import argparse
import os
from glob import glob
import json
def main():
checkPrevious()
def checkPrevious():
if os.path.isdir("files/temp"):
result = glob("files/temp/*/")
if len(result) == 0:
askMain()
else:
os.mkdir("files/temp")
askMain()
def askMain(error = None):
print("***************************************************************")
print("Type '1' to start a new iteration")
print("Type '0' to exit")
print("***************************************************************")
grids = getGrids()
if grids != None:
print("Grids loaded: %s" % len(grids))
else:
clearScreen()
print("Grids are missing!")
exit()
if error != None:
print("Invalid Option")
res = input("Enter command to proceed: ")
try:
res = int(res)
except:
clearScreen()
askMain(error = "Invalid Option")
if res == 0:
exit()
elif res == 1:
startIteration(grids)
def startIteration(grids):
def getGrids():
if os.path.isdir("grids"):
res = glob("grids/*/")
return res
else:
return None
def clearScreen():
os.system('cls' if os.name == 'nt' else 'clear')
if __name__ == "__main__":
main()