Source
lsmodims(d,modpat='*fd_time.dat', header='Time variable models of asteroids available for %s [only applicable for the observation date 2014.01.01 0UT and beyond]' % standard)
from __future__ import absolute_import
from glob import glob
import os
import re
import sys
import shutil
# the solution here to findCalModels should be reworked
# CASA5 uses the casa dict to set the default roots parameter values
# and that dict is not available in CASA6, where ctsys.resolve is
# available
# Here: defaultRoots is defined differently for CASA6 and CASA5 and
# that values is used as the default value for the roots parameter in
# findCalModels.
# Inside findCalModels there is a new section at the top to use
# ctsys.resolve to make the initial attempt to find the models.
# If that fails or is unavailable it falls back to the CASA5 code.
# get is_python3 and is_CASA6
from casatasks.private.casa_transition import *
if is_CASA6:
from .setjy_helper import *
from .parallel.parallel_data_helper import ParallelDataHelper
from .parallel.parallel_task_helper import ParallelTaskHelper
from .mstools import write_history
from casatools import ctsys, ms, imager, calibrater
from casatasks import casalog
# used in one type comparison
strType = str
# default roots argument for findCalModels
defaultRoots = ['.']
else:
from setjy_helper import *
from taskinit import *
from taskinit import mstool as ms
from taskinit import imtool as imager
from taskinit import cbtool as calibrater
from mstools import write_history
from parallel.parallel_data_helper import ParallelDataHelper
from parallel.parallel_task_helper import ParallelTaskHelper
# used in one type comparison
strType = string
# default roots argument for findCalModels
defaultRoots = ['.', casa['dirs']['data']]
# Helper class for Multi-MS processing (by SC)
class SetjyHelper():
def __init__(self, msfile=None):
self.__msfile = msfile
def resetModelCol(self):
rstatus = True
# Hide the log info
casalog.post("Resetting the log filter to WARN", "DEBUG")
casalog.post("Initialize the MODEL columns of sub-MSs to default 1", "DEBUG")
casalog.filter('WARN')
myms = ms()
try:
try:
myms.open(self.__msfile)
submslist = myms.getreferencedtables()
parentms = myms.name()
myms.close()
except:
if (os.path.exists(os.path.join(self.__msfile,'SUBMSS'))):
casalog.post("MS may be corrupted. Try to initialize sub-MSs anyway...","DEBUG")
submslist = [os.path.abspath(os.path.join(self.__msfile,'SUBMSS',fn))
for fn in os.listdir(os.path.join(self.__msfile,'SUBMSS')) if fn.endswith('.ms') ]
else:
rstatus = False
mycb = calibrater()
if parentms!= submslist[0]:
for subms in submslist:
mycb.open(subms, addcorr=False, addmodel=True)
mycb.close()
except:
rstatus = False
casalog.filter('INFO')
return rstatus
def setjy(vis=None, field=None, spw=None,
selectdata=None, timerange=None, scan=None, intent=None, observation=None,