Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/clearcal.py: 56%

27 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 17:39 +0000

1##################### generated by xml-casa (v2) from clearcal.xml ################## 

2##################### b987d933ff19641b5848c299498b895e ############################## 

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_clearcal import clearcal as _clearcal_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 

13 

14class _clearcal: 

15 """ 

16 clearcal ---- Re-initializes the calibration for a visibility data set 

17 

18  

19 Clearcal reinitializes the calibration columns in a measurement 

20 set. Specificially, it will set the MODEL_DATA column (if present) to 

21 unity in total intensity and zero in polarization, and it will set the 

22 CORRECTED_DATA column to the original (observed) DATA in the DATA 

23 column. Use the field and spw parameters to select which data to 

24 initialize. If the dataset does not yet have the scratch columns, 

25 they will be created (MODEL_DATA only if addmodel=True) and initilized 

26 for the whole dataset (field, spw, and intent will be ignored in this 

27 case). 

28 

29 --------- parameter descriptions --------------------------------------------- 

30 

31 vis Name of input visibility file (MS) 

32 Default: none 

33  

34 Example: vis='ngc5921.ms' 

35 field Select field using field id(s) or field name(s) 

36 default: '' (all fields) 

37  

38 Use 'go listobs' to obtain the list id's or 

39 names. If field string is a non-negative integer, 

40 it is assumed a field index, otherwise, it is 

41 assumed a field name. 

42  

43 Examples: 

44 field='0~2'; field ids 0,1,2 

45 field='0,4,5~7'; field ids 0,4,5,6,7 

46 field='3C286,3C295'; field named 3C286 and 

47 3C295 

48 field = '3,4C*'; field id 3, all names 

49 starting with 4C 

50 spw Select spectral window/channels 

51  

52 Examples: 

53 spw='0~2,4'; spectral windows 0,1,2,4 (all 

54 channels) 

55 spw='<2'; spectral windows less than 2 

56 (i.e. 0,1) 

57 spw='0:5~61'; spw 0, channels 5 to 61, 

58 INCLUSIVE 

59 spw='\*:5~61'; all spw with channels 5 to 61 

60 spw='0,10,3:3~45'; spw 0,10 all channels, spw 

61 3, channels 3 to 45. 

62 spw='0~2:2~6'; spw 0,1,2 with channels 2 

63 through 6 in each. 

64 spw='0:0~10;15~60'; spectral window 0 with 

65 channels 0-10,15-60. (NOTE ';' to separate 

66 channel selections) 

67 spw='0:0~10^2,1:20~30^5'; spw 0, channels 

68 0,2,4,6,8,10, spw 1, channels 20,25,30  

69 type 'help par.selection' for more examples. 

70 intent Select observing intent 

71 default: '' (no selection by intent) 

72  

73 Example: intent='*BANDPASS*' (selects data 

74 labelled with BANDPASS intent) 

75 addmodel add MODEL_DATA along with CORRECTED_DATA? 

76 Default: False (model will not be added) 

77 Options: False|True 

78  

79 If False, it will add/reset only CORRECTED_DATA, 

80 model visibilities will then be evaluated when 

81 needed. 

82 RETURNS void 

83 

84 --------- examples ----------------------------------------------------------- 

85 

86  

87  

88 For more information, see the task pages of clearcal in CASA Docs: 

89  

90 https://casa.nrao.edu/casadocs/ 

91  

92  

93 

94 

95 """ 

96 

97 _info_group_ = """calibration""" 

98 _info_desc_ = """Re-initializes the calibration for a visibility data set""" 

99 

100 def __call__( self, vis='', field='', spw='', intent='', addmodel=False ): 

101 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'addmodel': {'type': 'cBool'}} 

102 doc = {'vis': vis, 'field': field, 'spw': spw, 'intent': intent, 'addmodel': addmodel} 

103 assert _pc.validate(doc,schema), create_error_string(_pc.errors) 

104 _logging_state_ = _start_log( 'clearcal', [ 'vis=' + repr(_pc.document['vis']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'intent=' + repr(_pc.document['intent']), 'addmodel=' + repr(_pc.document['addmodel']) ] ) 

105 task_result = None 

106 try: 

107 task_result = _clearcal_t( _pc.document['vis'], _pc.document['field'], _pc.document['spw'], _pc.document['intent'], _pc.document['addmodel'] ) 

108 except Exception as exc: 

109 _except_log('clearcal', exc) 

110 raise 

111 finally: 

112 task_result = _end_log( _logging_state_, 'clearcal', task_result ) 

113 return task_result 

114 

115clearcal = _clearcal( ) 

116