Example #1
0
def uvcontsub(vis, field, fitspw, excludechans, combine, solint, fitorder, spw,
              want_cont):

    if ParallelTaskHelper.isParallelMS(vis):
        helper = ParallelTaskHelper('uvcontsub', locals())
        helper._consolidateOutput = False
        retVar = helper.go()

        # Gather the list of continuum subtraction-SubMSs
        cont_subMS_list = []
        contsub_subMS_list = []
        for subMS in retVar:
            if retVar[subMS]:
                cont_subMS_list.append(subMS + ".cont")
                contsub_subMS_list.append(subMS + ".contsub")

        if len(cont_subMS_list) <= 0:
            casalog.post("No continuum-subtracted sub-MSs for concatenation",
                         "SEVERE")
            return False

        # We have to sort the list because otherwise it
        # depends on the time the engines dispatches their sub-MSs
        cont_subMS_list.sort()
        contsub_subMS_list.sort()

        # deal with the pointing table
        auxfile = "uvcontsub_aux2_" + str(time.time())
        pnrows = 0
        try:
            mytb.open(vis + '/POINTING')
            pnrows = mytb.nrows()
            mytb.close()
            if (pnrows > 0):
                shutil.copytree(os.path.realpath(vis + '/POINTING'), auxfile)
        except Exception, instance:
            casalog.post(
                "Error handling POINTING table %s: %s" %
                (vis + '/POINTING', str(instance)), 'SEVERE')

        if want_cont:
            try:
                virtualconcat(concatvis=helper._arg['vis'] + ".cont",
                              vis=cont_subMS_list,
                              copypointing=False)
            except Exception, instance:
                casalog.post(
                    "Error concatenating continuum sub-MSs %s: %s" %
                    (str(cont_subMS_list), str(instance)), 'SEVERE')
Example #2
0
def uvcontsub(vis, field, fitspw, excludechans, combine, solint, fitorder, spw, want_cont):
    
    if ParallelTaskHelper.isParallelMS(vis):
        helper = ParallelTaskHelper('uvcontsub', locals())
        helper._consolidateOutput = False
        retVar = helper.go()

        # Gather the list of continuum subtraction-SubMSs 
        cont_subMS_list = []
        contsub_subMS_list = []
        for subMS in retVar:
            if retVar[subMS]:
                cont_subMS_list.append(subMS + ".cont")
                contsub_subMS_list.append(subMS + ".contsub")
                
        if len(cont_subMS_list) <= 0:
            casalog.post("No continuum-subtracted sub-MSs for concatenation","SEVERE")
            return False

        # We have to sort the list because otherwise it  
        # depends on the time the engines dispatches their sub-MSs
        cont_subMS_list.sort()
        contsub_subMS_list.sort()

        # deal with the pointing table
        auxfile = "uvcontsub_aux2_"+str(time.time())
        pnrows = 0
        try:
            mytb.open(vis+'/POINTING')
            pnrows = mytb.nrows()
            mytb.close()
            if(pnrows>0): 
                shutil.copytree(os.path.realpath(vis+'/POINTING'), auxfile)
        except Exception, instance:
            casalog.post("Error handling POINTING table %s: %s" %
                         (vis+'/POINTING',str(instance)),'SEVERE')

        if want_cont:
            try:
                virtualconcat(concatvis=helper._arg['vis'] + ".cont",vis=cont_subMS_list,
                              copypointing=False)
            except Exception, instance:
                casalog.post("Error concatenating continuum sub-MSs %s: %s" % 
                             (str(cont_subMS_list),str(instance)),'SEVERE')     
Example #3
0
            casalog.post(
                "Error handling POINTING table %s: %s" %
                (vis + '/POINTING', str(instance)), 'SEVERE')

        if want_cont:
            try:
                virtualconcat(concatvis=helper._arg['vis'] + ".cont",
                              vis=cont_subMS_list,
                              copypointing=False)
            except Exception, instance:
                casalog.post(
                    "Error concatenating continuum sub-MSs %s: %s" %
                    (str(cont_subMS_list), str(instance)), 'SEVERE')
        try:
            virtualconcat(concatvis=helper._arg['vis'] + ".contsub",
                          vis=contsub_subMS_list,
                          copypointing=False)
        except Exception, instance:
            casalog.post(
                "Error concatenating continuum-subtracted sub-MSs %s: %s" %
                (str(contsub_subMS_list), str(instance)), 'SEVERE')

        # Remove continuum subtraction-SubMSs
        if want_cont:
            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):
Example #4
0
            mytb.close()
            if(pnrows>0): 
                shutil.copytree(os.path.realpath(vis+'/POINTING'), auxfile)
        except Exception, instance:
            casalog.post("Error handling POINTING table %s: %s" %
                         (vis+'/POINTING',str(instance)),'SEVERE')

        if want_cont:
            try:
                virtualconcat(concatvis=helper._arg['vis'] + ".cont",vis=cont_subMS_list,
                              copypointing=False)
            except Exception, instance:
                casalog.post("Error concatenating continuum sub-MSs %s: %s" % 
                             (str(cont_subMS_list),str(instance)),'SEVERE')     
        try:
            virtualconcat(concatvis=helper._arg['vis'] + ".contsub",vis=contsub_subMS_list,
                          copypointing=False)
        except Exception, instance:
            casalog.post("Error concatenating continuum-subtracted sub-MSs %s: %s" %
                         (str(contsub_subMS_list),str(instance)),'SEVERE')

        # Remove continuum subtraction-SubMSs
        if want_cont:
            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')

        if(pnrows>0): # put back the POINTING table
            casalog.post("Restoring the POINTING table ...",'NORMAL')