from casatools import calibrater, ms, table
from casatasks import casalog, virtualconcat
from .mstools import write_history
from .update_spw import *
from .parallel.parallel_data_helper import ParallelDataHelper
from .parallel.parallel_task_helper import ParallelTaskHelper
def uvcontsub_old(vis, field, fitspw, excludechans, combine, solint, fitorder, spw, want_cont):
if ParallelDataHelper.isMMSAndNotServer(vis):
helper = ParallelTaskHelper('uvcontsub_old', locals())
helper._consolidateOutput = False
cont_subMS_list.append(subMS + ".cont")
contsub_subMS_list.append(subMS + ".contsub")
if len(cont_subMS_list) <= 0:
raise ValueError("No continuum-subtracted sub-MSs for concatenation","SEVERE")
contsub_subMS_list.sort()
auxfile = "uvcontsub_aux2_"+str(time.time())
mytb.open(vis+'/POINTING')
shutil.copytree(os.path.realpath(vis+'/POINTING'), auxfile)
except Exception as instance:
raise RuntimeError("Error handling POINTING table %s: %s" %
(vis+'/POINTING',str(instance)))
virtualconcat(concatvis=helper._arg['vis'] + ".cont",vis=cont_subMS_list,
except Exception as instance:
raise RuntimeError("Error concatenating continuum sub-MSs %s: %s" %
(str(cont_subMS_list),str(instance)))
virtualconcat(concatvis=helper._arg['vis'] + ".contsub",vis=contsub_subMS_list,
except Exception as instance:
raise RuntimeError("Error concatenating continuum-subtracted sub-MSs %s: %s" %
(str(contsub_subMS_list),str(instance)))
for subMS in cont_subMS_list:
if (os.system("rm -rf " + subMS ) != 0):
casalog.post("Problem removing continuum sub-MS %s into working directory" % (subMS),'SEVERE')
for subMS in contsub_subMS_list:
if (os.system("rm -rf " + subMS ) != 0):
casalog.post("Problem removing continuum-subtracted sub-MS %s into working directory" % (subMS),'SEVERE')
casalog.post("Restoring the POINTING table ...",'NORMAL')
theptab = os.path.realpath(helper._arg['vis'] + ".cont/POINTING")
os.system('rm -rf '+theptab)
shutil.copytree(auxfile, theptab)
theptab = os.path.realpath(helper._arg['vis'] + ".contsub/POINTING")
os.system('rm -rf '+theptab)
os.system('mv '+auxfile+' '+theptab)
except Exception as instance:
raise RuntimeError("Error restoring pointing table from %s: %s" %