Commits

Dirk Petry authored 607f5c5cba5
CAS-12570: Aligned the code with the documentation:

Not providing the outputvis parameter now results in the outputvis name being "conjugated_"+vis And not providing the spwlist now results in all spws being conjugated.

gcwrap/python/scripts/task_conjugatevis.py

Modified
52 52 else:
53 53 for j in range(0,_tb.nrows()):
54 54 if(_tb.getcell("SPECTRAL_WINDOW_ID",j)==k and not (j in myddlist)):
55 55 myddlist = myddlist + [j]
56 56 #end for k
57 57 _tb.close()
58 58 casalog.post('DATA_DESC_IDs to process: '+str(myddlist), 'INFO')
59 59 except:
60 60 raise Exception('Error reading DATA_DESCRIPTION table')
61 61 #endif
62 - outname = 'conjugatedvis_'+vis
63 - if not outputvis=="":
62 + outname = 'conjugated_'+vis
63 + if not (outputvis==""):
64 64 if((type(outputvis)!=str) or (len(outputvis.split()) < 1)):
65 65 raise Exception('parameter outputvis is invalid')
66 66 outname = outputvis
67 67 if not overwrite and os.path.exists(outname):
68 68 raise Exception('outputvis '+outname+' exists and you did not permit overwrite')
69 69 os.system('rm -rf '+outname)
70 70 os.system('cp -R '+vis+' '+outname)
71 71 _tb.open(outname, nomodify=False)
72 72 if _tb.iswritable():
73 - if(spwlist==None):
73 + if(spwlist==[]):
74 74 for colname in [ 'DATA', 'CORRECTED_DATA', 'FLOAT_DATA' ]:
75 75 if colname in _tb.colnames():
76 76 casalog.post('Conjugating '+str(colname), 'INFO')
77 77 for i in range(0,_tb.nrows()):
78 78 a = _tb.getcell(colname, i)
79 79 a = a.conjugate()
80 80 _tb.putcell(colname, i, a)
81 81 else:
82 82 for colname in [ 'DATA', 'CORRECTED_DATA', 'FLOAT_DATA' ]:
83 83 if colname in _tb.colnames():
96 96 casalog.post('Cannot write to output MS '+str(outname), 'WARN')
97 97
98 98 # Write history to output MS
99 99 try:
100 100 param_names = conjugatevis.__code__.co_varnames[:conjugatevis.__code__.co_argcount]
101 101 if is_python3:
102 102 vars = locals()
103 103 param_vals = [vars[p] for p in param_names]
104 104 else:
105 105 param_vals = [eval(p) for p in param_names]
106 - write_history(mstool(), outputvis, 'conjugatevis', param_names,
106 + write_history(mstool(), outname, 'conjugatevis', param_names,
107 107 param_vals, casalog)
108 108
109 109 except Exception as instance:
110 110 casalog.post("*** Error \'%s\' updating HISTORY" % (instance), 'WARN')
111 111
112 112 except Exception as instance:
113 113 _tb.close()
114 114 print('*** Error *** %s' % instance)
115 115 raise

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut