-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_transit.py
executable file
·48 lines (35 loc) · 1.26 KB
/
start_transit.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
#!/home/ubuntu/anaconda3/envs/casa38/bin/python
import sys
import os
import time as pytime
from time import sleep
from datetime import datetime
#from datetime import timezone
import numpy as np
from dsautils import dsa_store
def get_datestring():
val = datetime.now()
datestring = str(val.year)+'_'+str(val.month)+'_'+str(val.day)+'_'+str(val.hour)+'_'+str(val.minute)+'_'+str(val.second)
return datestring
def exec_action(a,d):
if a == 'start':
d.put_dict('/cmd/corr/docopy','True')
os.system('/home/ubuntu/anaconda3/envs/casa38/bin/dsacon corr start')
pytime.sleep(480)
os.system('/home/ubuntu/anaconda3/envs/casa38/bin/dsacon corr set')
if a == 'stop':
# d.put_dict('/cmd/corr/0', {'cmd': 'trigger', 'val': '0-flush-'})
# pytime.sleep(120)
os.system('/home/ubuntu/anaconda3/envs/casa38/bin/dsacon corr stop')
pytime.sleep(60)
d.put_dict('/cmd/corr/docopy','False')
# main part of code
d = dsa_store.DsaStore()
#d.put_dict('/cnf/datestring',get_datestring())
# update trig_ct
for i in np.arange(1,21):
d.put_dict('/mon/corr/'+str(i)+'/voltage_ct',{'n_trigs':0})
exec_action('start',d)
pytime.sleep(3600*12)
exec_action('stop',d)
pytime.sleep(60)