-
Notifications
You must be signed in to change notification settings - Fork 3
/
ft_v2.py
87 lines (64 loc) · 2.36 KB
/
ft_v2.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import os
import sys
import numpy
import time
#casapy --nologger -c ft.py ms1 ms2 modimage nterms wplanes
execfile('mytasks.py')
el=len(sys.argv)
print sys.argv[:]
mslistfull = sys.argv[4:el-3]
modimage = sys.argv[el-3]
ntermsi = numpy.int(sys.argv[el-2])
wplanes = numpy.int(sys.argv[el-1])
async = True
if ntermsi == 1:
mod = [modimage]
if ntermsi == 2:
mod = [modimage+'.tt0',modimage+'.tt1']
if ntermsi == 3:
mod = [modimage+'.tt0',modimage+'.tt1',modimage+'.tt2']
os.system('rm -rf *.tmpod')
if wplanes <= 127:
nparallel = len(mslistfull)
if (wplanes > 127) and (wplanes <= 179):
nparallel = 15
if (wplanes > 179) and (wplanes <= 195):
nparallel = 14
if (wplanes > 195):
nparallel = 6
groups = range(0,numpy.int(numpy.ceil(numpy.float(len(mslistfull))/numpy.float(nparallel))))
print numpy.float(len(mslistfull)),numpy.float(nparallel)
for group_id,group in enumerate(groups):
print 'GROUP', group_id, group
mslist = mslistfull[group_id*nparallel:nparallel*(group_id+1)]
print mslist
returnval = numpy.zeros(len(mslist))
for ms_id,ms in enumerate(mslist):
modimtmp = []
for mod_id,modim in enumerate(mod): # to avoid file lock on model
tmpname = modim +'.'+ ms +'.tmpod'
os.system('cp -r ' + modim + ' ' + tmpname)
modimtmp.append(tmpname)
if wplanes > 1:
returnval[ms_id] = ftw(vis=ms,field="",spw="",model=modimtmp,nterms=ntermsi,reffreq="",\
wprojplanes=wplanes,complist="",incremental=False,usescratch=True, async=True)
else:
returnval[ms_id] = ft(vis=ms,field="",spw="",model=modimtmp,nterms=ntermsi,reffreq="",\
complist="",incremental=False,usescratch=True, async=True)
time.sleep(3)
del modimtmp
running = True
while(running):
running = False # set so that we go out here unless the part below sets it to True
for ms_id,ms in enumerate(mslist):
result = tm.retrieve(returnval[ms_id])
print ms, result
if result['status'] != 'done':
running = True
time.sleep(4)
os.system('rm -rf *.tmpod')
# 15% MEM 2048 --> max 6 bands
# 6.5% MEM 1600 --> max 14 bands
# 2.3% MEM 1200 --> no issue
# if wplanes > 179 but < 195 dan 1600
# if wplanes > 195 but < 255 dan 2048