-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_all.py
61 lines (40 loc) · 1.28 KB
/
run_all.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
import os
from run_download import check_current
from rotations import get_sign, get_rotations, final
from clean import clean
from write import write, status
from dump import dump_data
from settings import Settings
def get_insts():
return [x.strip() for x in Settings.INSTS.split('\n') if x != "" and x.strip() != ""]
def update(insts):
# update all things
for inst in insts:
print(inst)
if inst not in os.listdir(Settings.PATH_DATA):
os.mkdir('{}/{}'.format(Settings.PATH_DATA, inst))
check_current(inst)
# consider making some meta-file that keeps last updated date instead of concatting everytime
return
def do_thing(inst, interval):
print("Running calculations: {}".format(inst))
data = clean(inst, interval)
data = data['mid']
data = get_sign(data)
r = get_rotations(data)
r = final(inst, r)
return r
def main():
status()
dump_data()
# Updates everything
insts = get_insts()
update(insts)
for inst in insts:
r = do_thing(inst, Settings.INTERVAL)
r.to_csv('{}/{}.csv'.format(Settings.PATH_RESULTS, inst), index=False)
for inst in insts:
write(inst, '{}/{}.csv'.format(Settings.PATH_RESULTS, inst))
status()
if __name__ == '__main__':
main()