Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_delmod.py: 78%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1import os
3from casatools import ms as mstool
4from casatools import calibrater
5from casatasks import casalog
6from .mstools import write_history
7from .parallel.parallel_task_helper import ParallelTaskHelper
8from .parallel.parallel_data_helper import ParallelDataHelper
10_ms = mstool( )
11_cb = calibrater( )
13def delmod(vis=None,otf=None,field=None,scr=None):
15 casalog.origin('delmod')
17 # Do the trivial parallelization
18 if ParallelDataHelper.isMMSAndNotServer(vis):
19 helper = ParallelTaskHelper('delmod', locals())
20 helper.go()
21 return
24 #Python script
26 # only if vis exists...
27 if ((type(vis)==str) & (os.path.exists(vis))):
28 # ... and we are asked to do something...
29 # open without adding anything!
30 _cb.open(vis,addcorr=False,addmodel=False)
31 _cb.delmod(otf=otf,field=field,scr=scr)
32 _cb.close()
33 else:
34 raise ValueError('Visibility data set not found - please verify the name')
36 # Write history to MS
37 try:
38 param_names = delmod.__code__.co_varnames[:delmod.__code__.co_argcount]
39 local_vars = locals( )
40 param_vals = [local_vars[p] for p in param_names]
42 write_history(mstool(), vis, 'delmod', param_names,
43 param_vals, casalog)
44 except Exception as instance:
45 casalog.post("*** Error \'%s\' updating HISTORY" % (instance),
46 'WARN')