Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/private/task_uvsub.py: 85%
20 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
1#
2# This file was generated using xslt from its XML file
3#
4# Copyright 2007, Associated Universities Inc., Washington DC
5#
6import os
8from casatools import ms as mstool
9from casatasks import casalog
10from .mstools import write_history
12_ms = mstool()
15def uvsub(vis=None,reverse=False):
17 """Subtract model from the corrected visibility data
19 uvsub(vis='ngc5921.ms', reverse=false)
21 This function subtracts model visibility data from corrected visibility
22 data leaving the residuals in the corrected data column. If the
23 parameter 'reverse' is set true, the process is reversed.
25 Keyword arguments:
26 vis -- Name of input visibility file (MS)
27 default: none; example: vis='ngc5921.ms'
28 reverse -- Reverse the operation (add rather than subtract)
29 default: false; example: reverse=true
31 uvsub(vis='ngc5921.ms', reverse=false)
33 """
35 #Python script
36 #
38 try:
39 casalog.origin('uvsub')
40 if ((type(vis)==str) & (os.path.exists(vis))):
41 _ms.open(thems=vis,nomodify=False)
42 else:
43 raise ValueError('Visibility data set not found - please verify the name')
44 return
45 _ms.uvsub(reverse)
47 # Write history to MS
48 try:
49 param_names = uvsub.__code__.co_varnames[:uvsub.__code__.co_argcount]
50 local_vars = locals( )
51 param_vals = [local_vars[p] for p in param_names]
53 write_history(mstool(), vis, 'uvsub', param_names,
54 param_vals, casalog)
55 except Exception as instance:
56 casalog.post("*** Error \'%s\' updating HISTORY" % (instance),
57 'WARN')
59 finally:
60 _ms.close()