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

27 statements  

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

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

2##################### bdb184ca2fec81ea2ded1c6ae81348c7 ############################## 

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_imreframe import imreframe as _imreframe_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 _imreframe: 

15 """ 

16 imreframe ---- Change the frame in which the image reports its spectral values 

17 

18 --------- parameter descriptions --------------------------------------------- 

19 

20 imagename Name of the input image 

21 output Name of the output image 

22 outframe Spectral frame in which the frequency or velocity values will be reported by default 

23 epoch Epoch to be associated with this image 

24 restfreq restfrequency to use for velocity values (e.g "1.420GHz" for the HI line) 

25 RETURNS void 

26 

27 --------- examples ----------------------------------------------------------- 

28 

29  

30  

31 imagename -- name of casa image file to process on 

32 output -- name of output image '' means modify the input image itself 

33 default: ''; 

34 outframe -- new spectral frame in which the frequency or 

35 velocity will be reported for. 

36 Options: 'lsrk','lsrd','bary','geo','topo','galacto', 

37 'lgroup','cmb' 

38 default: 'lsrk' 

39 >>> 

40 epoch -- when outframe is 'topo' or 'geo' a time in UTC is needed 

41 to decide when to do the frequency conversion. '' is to use 

42 the epoch of the input image 

43 default= '' 

44  

45 restfreq -- Specify rest frequency to use for output image 

46 default=''; '' means use the restfrequency already in input image 

47 For example for 

48 NH_3 (1,1) put restfreq='23.694496GHz' 

49 

50 

51 """ 

52 

53 _info_group_ = """analysis""" 

54 _info_desc_ = """Change the frame in which the image reports its spectral values""" 

55 

56 def __call__( self, imagename='', output='', outframe='lsrk', epoch='', restfreq='' ): 

57 schema = {'imagename': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'output': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outframe': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'LSRK', 'CMB', 'geo', 'bary', 'GALACTO', 'GEO', 'TOPO', 'LSRD', 'lsrk', 'topo', 'LGROUP', 'BARY', 'lsrd', 'cmb', 'galacto', 'lgroup', '' ]}, 'epoch': {'type': 'cStr', 'coerce': _coerce.to_str}, 'restfreq': {'type': 'cStr', 'coerce': _coerce.to_str}} 

58 doc = {'imagename': imagename, 'output': output, 'outframe': outframe, 'epoch': epoch, 'restfreq': restfreq} 

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

60 _logging_state_ = _start_log( 'imreframe', [ 'imagename=' + repr(_pc.document['imagename']), 'output=' + repr(_pc.document['output']), 'outframe=' + repr(_pc.document['outframe']), 'epoch=' + repr(_pc.document['epoch']), 'restfreq=' + repr(_pc.document['restfreq']) ] ) 

61 task_result = None 

62 try: 

63 task_result = _imreframe_t( _pc.document['imagename'], _pc.document['output'], _pc.document['outframe'], _pc.document['epoch'], _pc.document['restfreq'] ) 

64 except Exception as exc: 

65 _except_log('imreframe', exc) 

66 raise 

67 finally: 

68 task_result = _end_log( _logging_state_, 'imreframe', task_result ) 

69 return task_result 

70 

71imreframe = _imreframe( ) 

72