-
Notifications
You must be signed in to change notification settings - Fork 3
/
casapy_cleanv4.py
101 lines (69 loc) · 2.47 KB
/
casapy_cleanv4.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import os
import sys
import numpy
#casapy --nologger -c ~weeren/scripts/rx42_hba/casapy_cleanv2.py ms1 ms2 imout maskname 1mJy 1000 1 512 True
el=len(sys.argv)
print sys.argv[:]
msind = sys.argv.index('-c')
ms = sys.argv[msind+2:el-7]
imageout = sys.argv[el-7]
mask = sys.argv[el-6]
threshold = sys.argv[el-5]
niter = numpy.int(sys.argv[el-4])
nterms = numpy.int(sys.argv[el-3])
imsizep = numpy.int(sys.argv[el-2])
mscale = sys.argv[el-1]
cycfactor = 2.5
if niter > 1500:
cycfactor = 3.0
scales = []
if mscale == 'True':
scales = [0,3,7,25,60,150]
#timer = '>15:32:00'
#timer = '<23:50:00' # to fix instabilities at the end of a 20 min block
timer = ""
nfacets = 1
wplanes = 1
if imsizep > 512:
wplanes = 64
if imsizep > 799:
wplanes = 96
if imsizep > 1023:
wplanes = 128
if imsizep > 1599:
wplanes = 256
nfacets = 1
if imsizep > 2047:
wplanes = 384
nfacets = 1
if imsizep > 3000:
wplanes = 448
nfacets = 1
if imsizep > 4095:
wplanes = 512
nfacets = 1
print ms, imageout, mask, threshold, niter, nterms
imsize = [imsizep, imsizep]
cell = ['1.5arcsec', '1.5arcsec']
uvrange =">80lambda"
masktmp = mask
if mask == "None":
mask = ""
print masktmp.split(",")
if len(masktmp.split(",")) >= 2 :
print 'Ok, we have more than one mask...'
mask = []
for idx in range(len(masktmp.split(","))):
mask.append(masktmp.split(",")[idx])
print 'Using mask:', mask
clean(vis=ms,imagename=imageout,outlierfile="",field="",spw="",selectdata=True,timerange=timer,\
uvrange=uvrange,antenna="",scan="",observation="",mode="mfs",gridmode="widefield",wprojplanes=wplanes,\
facets=nfacets,cfcache="cfcache.dir",painc=360.0,epjtable="",interpolation="linear", \
niter=niter,gain=0.1,threshold=threshold,psfmode="clark",imagermode="csclean", \
ftmachine="mosaic",mosweight=False,scaletype="SAULT",multiscale=scales,negcomponent=-1, \
smallscalebias=0.6,interactive=False,mask=mask,nchan=-1,start=0,width=1,outframe="", \
veltype="radio",imsize=imsize,cell=cell,phasecenter="",restfreq="",stokes="I", \
weighting="briggs",robust=-0.25,uvtaper=False,outertaper=[''],innertaper=['1.0'], \
modelimage="",restoringbeam=[''],pbcor=False,minpb=0.2,usescratch=False,noise="1.0Jy",\
npixels=0,npercycle=100,cyclefactor=cycfactor,cyclespeedup=-1,nterms=nterms,reffreq="", \
chaniter=False,flatnoise=True,allowchunk=False)