From 1e3c3190086e29f4b6ce8f070a61ae61e3db92ca Mon Sep 17 00:00:00 2001 From: botteon Date: Fri, 1 Sep 2023 09:45:56 +0200 Subject: [PATCH] copying DATA column with DP3 For unknown reasons, copying the DATA column into a new one with casacore generates "Core dumped" on MeerKAT data. If instead DP3 is used to make the copy, the code doesn't crash. --- subtract/subtract_with_wsclean.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/subtract/subtract_with_wsclean.py b/subtract/subtract_with_wsclean.py index 01f6759c..65fff2fb 100644 --- a/subtract/subtract_with_wsclean.py +++ b/subtract/subtract_with_wsclean.py @@ -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