Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/nrobeamaverage.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 nrobeamaverage.xml ############ 

2##################### a845209a9e306f10ea04d323c4c5103b ############################## 

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_nrobeamaverage import nrobeamaverage as _nrobeamaverage_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 _nrobeamaverage: 

15 """ 

16 nrobeamaverage ---- Average SD data over beams and do time averaging 

17 

18  

19  

20 The task nrobeamaverage is for Nobeyama dataset of ON-ON observations. 

21 It averages on-source spectra having specified beam IDs over specified 

22 time bins. 

23  

24 

25 --------- parameter descriptions --------------------------------------------- 

26 

27 infile name of input SD dataset 

28 datacolumn name of data column to be used ["data", "float_data", or "corrected_data"] 

29 field select data by field IDs and names, e.g. "3C2*" (""=all) 

30 spw select data by IF IDs (spectral windows), e.g. "3,5,7" (""=all) 

31 timerange select data by time range, e.g. "09:14:0~09:54:0" (""=all) (see examples in help) 

32 scan select data by scan numbers, e.g. "21~23" (""=all) 

33 beam beam IDs to be averaged over, e.g. "1,3" (""=all) 

34 timebin bin width for time averaging. 

35 outfile name of output file 

36 

37 --------- examples ----------------------------------------------------------- 

38 

39  

40 ----------------- 

41 Keyword arguments 

42 ----------------- 

43 infile -- name of input SD dataset 

44 datacolumn -- name of data column to be used 

45 options: 'data', 'float_data', or 'corrected_data' 

46 default: 'float_data' 

47 field -- select data by field IDs and names 

48 default: '' (use all fields) 

49 example: field='3C2*' (all names starting with 3C2) 

50 field='0,4,5~7' (field IDs 0,4,5,6,7) 

51 field='0,3C273' (field ID 0 or field named 3C273) 

52 this selection is in addition to the other selections to data 

53 spw -- select data by IF IDs (spectral windows) 

54 default: '' (use all IFs) 

55 example: spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 

56 spw='<2'; spectral windows less than 2 (i.e. 0,1) 

57 this selection is in addition to the other selections to data 

58 timerange -- select data by time range 

59 default: '' (use all) 

60 example: timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 

61 Note: YYYY/MM/DD can be dropped as needed: 

62 timerange='09:14:00~09:54:00' # this time range 

63 timerange='09:44:00' # data within one integration of time 

64 timerange='>10:24:00' # data after this time 

65 timerange='09:44:00+00:13:00' #data 13 minutes after time 

66 this selection is in addition to the other selections to data 

67 scan -- select data by scan numbers 

68 default: '' (use all scans) 

69 example: scan='21~23' (scan IDs 21,22,23) 

70 this selection is in addition to the other selections to data 

71 beam -- beam IDs to be averaged over 

72 default: '' (all beam IDs) 

73 example: beam='1,3' (beam IDs 1 and 3) 

74 NOTE: beam IDs of averaged spectra in the output file will 

75 be the smallest one, e.g., in case of beam='1,3', 

76 the averaged output spectra will have beam ID 1. 

77 Note also that beam IDs should be stored in the 

78 ANTENNA column of input MS. 

79 timebin -- bin width for time averaging 

80 default: '' (only beam IDs changed, no time averaging) 

81 outfile -- name of output file 

82 

83 

84 """ 

85 

86 _info_group_ = """single dish""" 

87 _info_desc_ = """Average SD data over beams and do time averaging""" 

88 

89 def __call__( self, infile='', datacolumn='float_data', field='', spw='', timerange='', scan='', beam='', timebin='0s', outfile='' ): 

90 schema = {'infile': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'beam': {'type': 'cStr', 'coerce': _coerce.to_str}, 'timebin': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}} 

91 doc = {'infile': infile, 'datacolumn': datacolumn, 'field': field, 'spw': spw, 'timerange': timerange, 'scan': scan, 'beam': beam, 'timebin': timebin, 'outfile': outfile} 

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

93 _logging_state_ = _start_log( 'nrobeamaverage', [ 'infile=' + repr(_pc.document['infile']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'timerange=' + repr(_pc.document['timerange']), 'scan=' + repr(_pc.document['scan']), 'beam=' + repr(_pc.document['beam']), 'timebin=' + repr(_pc.document['timebin']), 'outfile=' + repr(_pc.document['outfile']) ] ) 

94 task_result = None 

95 try: 

96 task_result = _nrobeamaverage_t( _pc.document['infile'], _pc.document['datacolumn'], _pc.document['field'], _pc.document['spw'], _pc.document['timerange'], _pc.document['scan'], _pc.document['beam'], _pc.document['timebin'], _pc.document['outfile'] ) 

97 except Exception as exc: 

98 _except_log('nrobeamaverage', exc) 

99 raise 

100 finally: 

101 task_result = _end_log( _logging_state_, 'nrobeamaverage', task_result ) 

102 return task_result 

103 

104nrobeamaverage = _nrobeamaverage( ) 

105