Commits

Takahiro Tsutsumi authored and Ville Suoranta committed ed483931080 Merge
Pull request #781: CAS-13359

Merge in CASA/casa6 from CAS-13359 to master * commit '5c33a81582dbdaa21dea29ccb23df972dbfae96c': Now usescratch's default is True in setjy, modified setjy command in test_model_keys to explicitly set usescatch=False Add a test for the exception handling Modify to use RuntimeError rather than generic Exception and the boolean comparison to follow PEP8 Minor edit to retrigger build A minor edit in the xml help doc Change the default for usescratch to True. Catch to raise an exception when Butler-JPL-Horizons and usescratch = False are set.

casatasks/src/private/task_setjy.py

Modified
11 11 # available
12 12 # Here: defaultRoots is defined differently for CASA6 and CASA5 and
13 13 # that values is used as the default value for the roots parameter in
14 14 # findCalModels.
15 15 # Inside findCalModels there is a new section at the top to use
16 16 # ctsys.resolve to make the initial attempt to find the models.
17 17 # If that fails or is unavailable it falls back to the CASA5 code.
18 18
19 19 # get is_python3 and is_CASA6
20 20 from casatasks.private.casa_transition import *
21 -if is_CASA6:
22 - from .setjy_helper import *
23 - from .parallel.parallel_data_helper import ParallelDataHelper
24 - from .parallel.parallel_task_helper import ParallelTaskHelper
25 - from .mstools import write_history
26 - from casatools import ctsys, ms, imager, calibrater
27 - from casatasks import casalog
28 -
29 - # used in one type comparison
30 - strType = str
31 -
32 - # default roots argument for findCalModels
33 - defaultRoots = ['.']
34 -else:
35 - from setjy_helper import *
36 - from taskinit import *
37 - from taskinit import mstool as ms
38 - from taskinit import imtool as imager
39 - from taskinit import cbtool as calibrater
40 - from mstools import write_history
41 - from parallel.parallel_data_helper import ParallelDataHelper
42 - from parallel.parallel_task_helper import ParallelTaskHelper
43 -
44 - # used in one type comparison
45 - strType = string
46 -
47 - # default roots argument for findCalModels
48 - defaultRoots = ['.', casa['dirs']['data']]
21 +from .setjy_helper import *
22 +from .parallel.parallel_data_helper import ParallelDataHelper
23 +from .parallel.parallel_task_helper import ParallelTaskHelper
24 +from .mstools import write_history
25 +from casatools import ctsys, ms, imager, calibrater
26 +from casatasks import casalog
27 +
28 +# used in one type comparison
29 +strType = str
30 +
31 +# default roots argument for findCalModels
32 +defaultRoots = ['.']
49 33
50 34 # Helper class for Multi-MS processing (by SC)
51 35 class SetjyHelper():
52 36 def __init__(self, msfile=None):
53 37 self.__msfile = msfile
54 38
55 39 def resetModelCol(self):
56 40 rstatus = True
57 41 # Hide the log info
58 42 casalog.post("Resetting the log filter to WARN", "DEBUG")
195 179 ssmoddirs=None
196 180 for d in calmoddirs:
197 181 lsmodims(d)
198 182
199 183 # Actual operation, when either the MODEL_DATA column or visibility model header are set
200 184 else:
201 185 if not os.path.isdir(vis):
202 186 #casalog.post(vis + " must be a valid MS unless listmodels is True.",
203 187 # "SEVERE")
204 188 raise Exception("%s is not a valid MS" % vis)
205 -
189 + if 'Butler-JPL-Horizons' in standard and not usescratch:
190 + raise RuntimeError(f"usescratch={usescratch} and standard={standard}. "
191 + +"Virtual model can not be used for an ephemeris object calibrator. Use usescratch=True.")
206 192 myms = ms()
207 193 myim = imager()
208 194 if ismms==None: ismms=False
209 195 if type(vis) == str and os.path.isdir(vis):
210 196 n_selected_rows = nselrows(vis, field, spw, observation, timerange, scan, intent, usescratch, ismms)
211 197 # jagonzal: When usescratch=True, creating the MODEL column only on a sub-set of
212 198 # Sub-MSs causes problems because ms::open requires all the tables in ConCatTable
213 199 # to have the same description (MODEL data column must exist in all Sub-MSs)
214 200 #
215 201 # This is a bit of an over-doing but it is necessary for the sake of transparency

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut