Source
raise Exception('Region-file (text) format not recognized. Please check. If box-file, please start the file with \'#boxfile\' on the first line, and have at-least one valid box in it')
from __future__ import absolute_import
import glob
import os
import math
import numpy
import re
import shutil
import pwd
from numpy import unique
from casatasks.private.casa_transition import is_CASA6
if is_CASA6:
import subprocess
from collections import OrderedDict as odict
###some helper tools
from casatasks import casalog as default_casalog
from casatools import table, quanta, measures, regionmanager, image, imager, msmetadata
from casatools import ms as mstool
from casatools import ctsys
ms = mstool( )
tb = table( )
qa = quanta( )
me = measures( )
rg = regionmanager( )
ia = image( )
im = imager( )
msmd=msmetadata( )
# trying to avoid sharing a single instance with all other functions in this module
iatool = image
def _casa_version_string():
""" produce a version string with the same format as the mstools.write_history. """
return 'version: ' + ctsys.version_string() + ' ' + ctsys.version_desc()
else:
# possibly not an exact equivalent, but as used here it is
import commands as subprocess
import string
from odict import odict
from taskinit import *
###some helper tools
from casac import *
ms = casac.ms()
tb = casac.table()
qa = casac.quanta()
me = casac.measures()
rg = casac.regionmanager()
ia = casac.image()
im = casac.imager()
msmd=casac.msmetadata()
default_casalog = casalog
# trying to avoid sharing a single instance with all other functions in this module
iatool = casac.image
def _casa_version_string():
casa_glob = find_casa()
return 'version: ' + casa_glob['build']['version'] + ' ' + casa_glob['build']['time']
class cleanhelper:
def __init__(self, imtool='', vis='', usescratch=False, casalog=default_casalog):
"""
Contruct the cleanhelper object with an imager tool
like so:
a=cleanhelper(im, vis)
"""
###fix for assumption that if it is a list of 1 it is sngle ms mode
if((type(vis)==list) and (len(vis)==1)):
vis=vis[0]
####
if((type(imtool) != str) and (len(vis) !=0)):
# for multi-mses input (not fully implemented yet)
if(type(vis)!=list):
vis=[vis]
self.sortedvisindx=[0]
self.initmultims(imtool, vis, usescratch)
# else:
# self.initsinglems(imtool, vis, usescratch)
#self.maskimages={}
self.maskimages=odict( )
self.finalimages={}
self.usescratch=usescratch
self.dataspecframe='LSRK'
self.usespecframe=''
self.inframe=False
# to use phasecenter parameter in initChannelizaiton stage