Skip to content

Commit

Permalink
Merge pull request #19 from botteon/patch-1
Browse files Browse the repository at this point in the history
copying DATA column with DP3
  • Loading branch information
jurjen93 authored Sep 6, 2023
2 parents 60a337c + 1e3c319 commit 87a31dd
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions subtract/subtract_with_wsclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,22 +291,24 @@ def subtract_col(self, out_column: str = None):
print('Subtract ' + ms)
ts = ct.table(ms, readonly=False)
colnames = ts.colnames()
ts.close()

if "MODEL_DATA" not in colnames:
sys.exit(f"ERROR: MODEL_DATA does not exist in {ms}.\nThis is most likely due to a failed predict step.")

if not self.onlyprint:
if out_column not in colnames:
# get column description from DATA
desc = ts.getcoldesc('DATA')
# create output column
desc['name'] = out_column
# create template for output column
ts.addcols(desc)
cmd = 'DP3 msin=' + ms + ' msout=. steps=[] msout.datacolumn=' + out_column + ' '
cmd += 'msin.datacolumn=DATA msout.storagemanager=dysco'
print('Copying DATA column into ' + out_column + ': ' + cmd)
os.system(cmd)

else:
print(out_column, ' already exists')

ts = ct.table(ms, readonly=False)
colnames = ts.colnames()

# get number of rows
nrows = ts.nrows()
# make sure every slice has the same size
Expand Down

0 comments on commit 87a31dd

Please sign in to comment.