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

27 statements  

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

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

2##################### bb68db34e36ca4abbe694ff07ec721b1 ############################## 

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_imhistory import imhistory as _imhistory_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 _imhistory: 

15 """ 

16 imhistory ---- Retrieve and modify image history 

17 

18  

19 Retrieve and modify image history. 

20  

21 This task provides access to the logtable of an image, where generally 

22 history information is stored. Two operation modes are supported. When 

23 mode="list", the history messages are returned as an array of 

24 strings. If verbose=True, this information is also written to the 

25 logger. When mode="append", a specified message (along with its 

26 specified origin) are appended to the logtable and True is returned if 

27 successful. 

28 

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

30 

31 imagename Name of the input (CASA or FITS) image 

32 Default: none 

33  

34 Example: imagename='ngc5921.im' 

35 mode Operating mode. 

36 Default: 'list' (retrieve history) 

37 Options: 'list|append' ('append' to append a 

38 record to history) 

39 verbose Write history to logger if mode="list"? 

40 Subparameter of mode='list' 

41 Default: True 

42 Options: True|False 

43 origin Origin of appended message.  

44 Subparameter of mode='append' 

45 Default: 'imhistory' 

46  

47 The user can specify any string. This string will 

48 appear as a tag at the start of the appended line 

49 in the image history. Only used for mode="append". 

50 message Message to append.  

51 Subparameter of mode='append' 

52 Default: none 

53  

54 Only used of mode="append". 

55 RETURNS variant 

56 

57 --------- examples ----------------------------------------------------------- 

58 

59  

60 FOR MORE INFORMATION, SEE THE TASK PAGES OF IMHISTORY IN CASA DOCS: 

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

62 

63 

64 """ 

65 

66 _info_group_ = """information,analysis""" 

67 _info_desc_ = """Retrieve and modify image history""" 

68 

69 def __call__( self, imagename='', mode='list', verbose=True, origin='imhistory', message='' ): 

70 schema = {'imagename': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str}, 'verbose': {'type': 'cBool'}, 'origin': {'type': 'cStr', 'coerce': _coerce.to_str}, 'message': {'type': 'cStr', 'coerce': _coerce.to_str}} 

71 doc = {'imagename': imagename, 'mode': mode, 'verbose': verbose, 'origin': origin, 'message': message} 

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

73 _logging_state_ = _start_log( 'imhistory', [ 'imagename=' + repr(_pc.document['imagename']), 'mode=' + repr(_pc.document['mode']), 'verbose=' + repr(_pc.document['verbose']), 'origin=' + repr(_pc.document['origin']), 'message=' + repr(_pc.document['message']) ] ) 

74 task_result = None 

75 try: 

76 task_result = _imhistory_t( _pc.document['imagename'], _pc.document['mode'], _pc.document['verbose'], _pc.document['origin'], _pc.document['message'] ) 

77 except Exception as exc: 

78 _except_log('imhistory', exc) 

79 raise 

80 finally: 

81 task_result = _end_log( _logging_state_, 'imhistory', task_result ) 

82 return task_result 

83 

84imhistory = _imhistory( ) 

85