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

2##################### e2069cb4389a7df15be10805dc748018 ############################## 

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_getcalmodvla import getcalmodvla as _getcalmodvla_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 _getcalmodvla: 

15 """ 

16 getcalmodvla ---- Retrieve calibrator brightness distributions from a VLA web service. 

17 

18  

19 This application retrieves calibrator information via a VLA web service 

20 and writes this information as a componentlist so that it may be used by applications 

21 downstream. 

22  

23 

24 --------- parameter descriptions --------------------------------------------- 

25 

26 outfile The name of the output component list to be written. Must be specified 

27 Default: none, must be specified 

28 Example: outfile="3c273.cl" 

29 overwrite Overwrite a file or directory of the same name of outfile if it exists. If overwrite=False and a file or directory of the same name as outfile exists, an exception will be thrown. 

30 source The calibrator name. The case-insensitive names 

31 "3C48", "3C286", "3C138", 

32 and "3C147" are supported. Exactly one of source 

33 or direction must be specified. 

34 direction An alternative to source. It is the direction of the calibrator. The supported 

35 formats are of the form "EPOCH LONGITUDE LATITUDE", eg 

36  

37 "J2000 12:34:56 -12.34.56". 

38 "J2000 19h53m50 40d06m00" 

39 "B1950 292.5deg -40.0deg" 

40 "ICRS 13:05:27.2780 -049.28.04.458" 

41 "GALACTIC 47.5rad -60.22rad" 

42  

43 Only astronomical coordinate systems should be used; eg AZEL is right out. The web service 

44 will attempt to locate a known calibrator near this direction, where "near" is defined by 

45 the web service team. Exactly one of source or direction must be specified. 

46 band A string representing the case-insensitive code of 

47 the band for which the data are required. For the VLA, 

48 supported codes are "P", "L", "S", "C", "X", "U", "K", "A", and "Q". 

49 obsdate The date for which to obtain the calibrator information. If numeric, 

50 is assumed to be an MJD. If a string, is assumed to be a date and must 

51 be of the form "YYYY-MM-DD". 

52 refdate The reference date after which new database entries will be ignored. If numeric, 

53 is assumed to be an MJD. If a string, is assumed to be a date and must 

54 be of the form "YYYY-MM-DD". Used to support 

55 historical reproducibility. A non-positive value will result in this parameter being ignored, 

56 and the most recent entry will be used (which may be later than obsdate). 

57 hosts List of hostnames to use when querying the web service. They will be queried in 

58 order until a successful response is received. 

59 RETURNS void 

60 

61 --------- examples ----------------------------------------------------------- 

62 

63  

64 SEE TASK DESCRIPTION IN CASADOCS 

65  

66 

67 

68 """ 

69 

70 _info_group_ = """calibration""" 

71 _info_desc_ = """Retrieve calibrator brightness distributions from a VLA web service.""" 

72 

73 def __call__( self, outfile='', overwrite=False, source='', direction='', band='', obsdate=int(0), refdate=int(0), hosts=[ 'http://obs.vla.nrao.edu/calmodvla' ] ): 

74 schema = {'outfile': {'type': 'cPath', 'coerce': _coerce.expand_path}, 'overwrite': {'type': 'cBool'}, 'source': {'type': 'cStr', 'coerce': _coerce.to_str}, 'direction': {'type': 'cStr', 'coerce': _coerce.to_str}, 'band': {'type': 'cStr', 'coerce': _coerce.to_str}, 'obsdate': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'refdate': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'hosts': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}} 

75 doc = {'outfile': outfile, 'overwrite': overwrite, 'source': source, 'direction': direction, 'band': band, 'obsdate': obsdate, 'refdate': refdate, 'hosts': hosts} 

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

77 _logging_state_ = _start_log( 'getcalmodvla', [ 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'source=' + repr(_pc.document['source']), 'direction=' + repr(_pc.document['direction']), 'band=' + repr(_pc.document['band']), 'obsdate=' + repr(_pc.document['obsdate']), 'refdate=' + repr(_pc.document['refdate']), 'hosts=' + repr(_pc.document['hosts']) ] ) 

78 task_result = None 

79 try: 

80 task_result = _getcalmodvla_t( _pc.document['outfile'], _pc.document['overwrite'], _pc.document['source'], _pc.document['direction'], _pc.document['band'], _pc.document['obsdate'], _pc.document['refdate'], _pc.document['hosts'] ) 

81 except Exception as exc: 

82 _except_log('getcalmodvla', exc) 

83 raise 

84 finally: 

85 task_result = _end_log( _logging_state_, 'getcalmodvla', task_result ) 

86 return task_result 

87 

88getcalmodvla = _getcalmodvla( ) 

89