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

2##################### 49e0cb68486224f2c3f83b64e80ca5b4 ############################## 

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_imcontsub import imcontsub as _imcontsub_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 _imcontsub: 

15 """ 

16 imcontsub ---- Estimates and subtracts continuum emission from an image cube 

17 

18  

19 Estimates and subtracts continuum emission from an image cube 

20  

21 For each direction pixel (x, y) column in imagename (or a subset 

22 selected by region and/or box), this estimates the continuum by 

23 fitting a polynomial to one or more subsets of the channels. The 

24 continuum estimate is saved in contfile, and subtracted from imagename 

25 (or its subset) to make a spectral line estimate, which is saved in 

26 linefile. 

27 

28 --------- parameter descriptions --------------------------------------------- 

29 

30 imagename Input image cube. 

31 Default: none 

32  

33 Example: imagename='ngc5921_task.im' 

34 linefile Name of continuum-subtracted output spectral line cube 

35 Default: none 

36  

37 Example: outline='ngc5921_line.im' 

38 contfile Name of output continuum cube 

39 Default: none 

40  

41 Example: contfile='ngc5921_cont.im' 

42 fitorder Polynomial order for the continuum estimation 

43 Default: 0 

44  

45 Example: fitorder=2 

46 region Region selection.  

47 Default: '' (use the full image) 

48 box Rectangular region to select in direction plane. 

49 Default: '' (use the entire direction plane) 

50 chans Channels to use.  

51 Default: '' (use all channels) 

52 stokes Stokes planes to use. 

53 Default: '' (use all Stokes planes) 

54 RETURNS void 

55 

56 --------- examples ----------------------------------------------------------- 

57 

58  

59 FOR MORE INFORMATION, SEE THE TASK PAGES OF IMCONTSUB IN CASA DOCS: 

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

61 

62 

63 """ 

64 

65 _info_group_ = """analysis, imaging""" 

66 _info_desc_ = """Estimates and subtracts continuum emission from an image cube""" 

67 

68 def __call__( self, imagename='', linefile='', contfile='', fitorder=int(0), region='', box='', chans='', stokes='' ): 

69 schema = {'imagename': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'linefile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'contfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'fitorder': {'type': 'cInt', 'min': 0}, 'region': {'type': 'cStr', 'coerce': _coerce.to_str}, 'box': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'chans': {'type': 'cStr', 'coerce': _coerce.to_str}, 'stokes': {'type': 'cStr', 'coerce': _coerce.to_str}} 

70 doc = {'imagename': imagename, 'linefile': linefile, 'contfile': contfile, 'fitorder': fitorder, 'region': region, 'box': box, 'chans': chans, 'stokes': stokes} 

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

72 _logging_state_ = _start_log( 'imcontsub', [ 'imagename=' + repr(_pc.document['imagename']), 'linefile=' + repr(_pc.document['linefile']), 'contfile=' + repr(_pc.document['contfile']), 'fitorder=' + repr(_pc.document['fitorder']), 'region=' + repr(_pc.document['region']), 'box=' + repr(_pc.document['box']), 'chans=' + repr(_pc.document['chans']), 'stokes=' + repr(_pc.document['stokes']) ] ) 

73 task_result = None 

74 try: 

75 task_result = _imcontsub_t( _pc.document['imagename'], _pc.document['linefile'], _pc.document['contfile'], _pc.document['fitorder'], _pc.document['region'], _pc.document['box'], _pc.document['chans'], _pc.document['stokes'] ) 

76 except Exception as exc: 

77 _except_log('imcontsub', exc) 

78 raise 

79 finally: 

80 task_result = _end_log( _logging_state_, 'imcontsub', task_result ) 

81 return task_result 

82 

83imcontsub = _imcontsub( ) 

84