Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/flagmanager.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
1##################### generated by xml-casa (v2) from flagmanager.xml ###############
2##################### 21144af62938a153fde0ca566cee198d ##############################
3from __future__ import absolute_import
4import numpy
5from casatools.typecheck import CasaValidator as _val_ctor
6_pc = _val_ctor( )
7from casatools.coercetype import coerce as _coerce
8from casatools.errors import create_error_string
9from .private.task_flagmanager import flagmanager as _flagmanager_t
10from casatasks.private.task_logging import start_log as _start_log
11from casatasks.private.task_logging import end_log as _end_log
12from casatasks.private.task_logging import except_log as _except_log
14class _flagmanager:
15 """
16 flagmanager ---- Enable list, save, restore, delete and rename flag version files.
19 These flag version files are copies of the flag column for a
20 measurement set. They can be restored to the data set to get
21 back to a previous flag version. On running importvla, a flag
22 version call 'Original' is automatically produced.
25 --------- parameter descriptions ---------------------------------------------
27 vis Name of input visibility file (MS)
28 mode Operation: list, save, restore, delete, rename
29 versionname Flag version name
30 oldname Flag version to rename
31 comment Short description of a versionname
32 merge Merge option: replace will save or over-write the flags
33 [1;42mRETURNS[1;m void
35 --------- examples -----------------------------------------------------------
40 The flag version files are copies of the FLAG column of a
41 Measurement Set. They can be restored to the data set to obtain
42 a previous flag version. On running importasdm, a flag
43 version called 'Original' is produced by default. It is recommended to
44 save a flagversion at the beginning or after serious editing.
46 Keyword arguments:
47 vis -- Name of input visibility file
48 default: none. example: vis='ngc5921.ms'
50 mode -- Flag version operation
51 default: 'list': it will list in the logger the existing flag versions of the MS.
52 This option will also return by default a dictionary containing the
53 name of the MS, the name of the flag version and the comment. This
54 information is taken from the FLAG_VERSION_LIST file inside the
55 .flagversions directory.
57 'save': will save the FLAG column from vis to a specified flag file. If the name given
58 in versionname already exists, the task will give a warning and rename it
59 to a name with a suffix '.old.timestamp'. The respective entry in FLAG_VERSION_LIST
60 will also be updated.
62 'restore': will place the specified flag file into vis
64 'delete': will delete specified flag file
66 'rename': will rename a specified flag file
68 versionname -- Flag version name
69 default: none; example: versionname='original_data'
70 No imbedded blanks in the versionname
72 comment -- Short description of a versionname, when mode is 'save' or 'rename'
73 default: ''; example: comment='Clip above 1.85'
74 comment = versionname
76 oldname -- When mode='rename', the flag file to rename
78 merge -- Merge operation
79 Options: 'or','and', but not recommended for now.
84 """
86 _info_group_ = """flagging"""
87 _info_desc_ = """Enable list, save, restore, delete and rename flag version files."""
89 def __call__( self, vis='', mode='list', versionname='', oldname='', comment='', merge='replace' ):
90 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'rename', 'save', 'delete', 'list', 'restore' ]}, 'versionname': {'type': 'cStr', 'coerce': _coerce.to_str}, 'oldname': {'type': 'cStr', 'coerce': _coerce.to_str}, 'comment': {'type': 'cStr', 'coerce': _coerce.to_str}, 'merge': {'type': 'cStr', 'coerce': _coerce.to_str}}
91 doc = {'vis': vis, 'mode': mode, 'versionname': versionname, 'oldname': oldname, 'comment': comment, 'merge': merge}
92 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
93 _logging_state_ = _start_log( 'flagmanager', [ 'vis=' + repr(_pc.document['vis']), 'mode=' + repr(_pc.document['mode']), 'versionname=' + repr(_pc.document['versionname']), 'oldname=' + repr(_pc.document['oldname']), 'comment=' + repr(_pc.document['comment']), 'merge=' + repr(_pc.document['merge']) ] )
94 task_result = None
95 try:
96 task_result = _flagmanager_t( _pc.document['vis'], _pc.document['mode'], _pc.document['versionname'], _pc.document['oldname'], _pc.document['comment'], _pc.document['merge'] )
97 except Exception as exc:
98 _except_log('flagmanager', exc)
99 raise
100 finally:
101 task_result = _end_log( _logging_state_, 'flagmanager', task_result )
102 return task_result
104flagmanager = _flagmanager( )