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

27 statements  

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

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

2##################### 9a41da2f188957e5ce7307211fb89954 ############################## 

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_sdsidebandsplit import sdsidebandsplit as _sdsidebandsplit_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 _sdsidebandsplit: 

15 """ 

16 sdsidebandsplit ---- [EXPERIMENTAL] invoke sideband separation using FFT 

17 

18 [EXPERIMENTAL] SD sideband separation and supression task: 

19 Invoke sideband separation / supression using FFT 

20 

21 --------- parameter descriptions --------------------------------------------- 

22 

23 imagename a list of names of input images. At least two valid images are required for processing 

24 outfile Prefix of output image name. 

25 A suffix, ".signalband" or ".imageband" is added to  

26 output image name depending on the side band side being solved. 

27 overwrite overwrite option 

28 signalshift a list of channel number shifts in signal side band. 

29 The number of elements must be equal to that of imagename 

30 imageshift t of channel number shifts in image side band. 

31 The number of elements must be either zero or equal to that of imagename. 

32 In case of zero length array, the values are obtained from signalshift 

33 assuming the shifts are the same magnitude in opposite direction. 

34 getbothside sideband separation (True) or supression (False) 

35 refchan reference channel of spectral axis in image sideband 

36 refval frequency at the reference channel of spectral axis in image sideband (e.g., "100GHz") 

37 otherside solve the solution of the other side band side and subtract the solution 

38 threshold Rejection limit of solution. The value must be greater than 0.0 and less than 1.0. 

39 RETURNS void 

40 

41 --------- examples ----------------------------------------------------------- 

42 

43  

44 Solve signal sideband 

45  

46 sdsidebandsplit(imagename=['shift_0ch.image', 'shift_132ch.image', 'shift_neg81ch.image'], 

47 outfile='separated.image', signalshift=[0.0, +132.0, -81.0], 

48 imageshift=[0.0, -132.0, +81.0]) 

49  

50 The output image is 'separated.image.signalband'. 

51  

52 Solve both signal and image sidebands (need to set frequency of image sideband explicitly) 

53  

54 sdsidebandsplit(imagename=['shift_0ch.image', 'shift_132ch.image', 'shift_neg81ch.image'], 

55 outfile='separated.image', signalshift=[0.0, +132.0, -81.0], 

56 imageshift=[0.0, -132.0, +81.0], 

57 getbothside=True, refchan=0.0, refval='805.8869GHz') 

58  

59 The output images are 'separated.image.signalband' and 'separated.image.imageband' 

60 for signal and image sideband, respectively. 

61  

62 Obtain signal sideband image by solving image sideband 

63  

64 sdsidebandsplit(imagename=['shift_0ch.image', 'shift_132ch.image', 'shift_neg81ch.image'], 

65 outfile='separated.image', signalshift=[0.0, +132.0, -81.0], 

66 imageshift=[0.0, -132.0, +81.0], otherside=True) 

67  

68 Solution of image sidband is obtained and subtracted from the original (double sideband) spectra 

69 to derive spectra of signal sideband. 

70  

71  

72 

73 

74 """ 

75 

76 _info_group_ = """single dish""" 

77 _info_desc_ = """[EXPERIMENTAL] invoke sideband separation using FFT""" 

78 

79 def __call__( self, imagename=[ ], outfile='', overwrite=False, signalshift=[ ], imageshift=[ ], getbothside=False, refchan=float(0.0), refval='', otherside=False, threshold=float(0.2) ): 

80 schema = {'imagename': {'type': 'cReqPathVec', 'coerce': [_coerce.to_list,_coerce.expand_pathvec]}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}, 'signalshift': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'imageshift': {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}, 'getbothside': {'type': 'cBool'}, 'refchan': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'refval': {'type': 'cStr', 'coerce': _coerce.to_str}, 'otherside': {'type': 'cBool'}, 'threshold': {'type': 'cFloat', 'coerce': _coerce.to_float, 'min': 0.0, 'max': 1.0}} 

81 doc = {'imagename': imagename, 'outfile': outfile, 'overwrite': overwrite, 'signalshift': signalshift, 'imageshift': imageshift, 'getbothside': getbothside, 'refchan': refchan, 'refval': refval, 'otherside': otherside, 'threshold': threshold} 

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

83 _logging_state_ = _start_log( 'sdsidebandsplit', [ 'imagename=' + repr(_pc.document['imagename']), 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'signalshift=' + repr(_pc.document['signalshift']), 'imageshift=' + repr(_pc.document['imageshift']), 'getbothside=' + repr(_pc.document['getbothside']), 'refchan=' + repr(_pc.document['refchan']), 'refval=' + repr(_pc.document['refval']), 'otherside=' + repr(_pc.document['otherside']), 'threshold=' + repr(_pc.document['threshold']) ] ) 

84 task_result = None 

85 try: 

86 task_result = _sdsidebandsplit_t( _pc.document['imagename'], _pc.document['outfile'], _pc.document['overwrite'], _pc.document['signalshift'], _pc.document['imageshift'], _pc.document['getbothside'], _pc.document['refchan'], _pc.document['refval'], _pc.document['otherside'], _pc.document['threshold'] ) 

87 except Exception as exc: 

88 _except_log('sdsidebandsplit', exc) 

89 raise 

90 finally: 

91 task_result = _end_log( _logging_state_, 'sdsidebandsplit', task_result ) 

92 return task_result 

93 

94sdsidebandsplit = _sdsidebandsplit( ) 

95