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

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 getantposalma.xml ############# 

2##################### 9b3611429cf7e8704dc1abd957256848 ############################## 

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_getantposalma import getantposalma as _getantposalma_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 _getantposalma: 

15 """ 

16 getantposalma ---- Retrieve antenna positions by querying ALMA web service. 

17 

18  

19 Query an ALMA-specific web service and retrieves antenna positions. The positions 

20 retrieved can faill within a specified time window, be greater than a specified 

21 signal-to-noise level, etc. The task writes this data to a specified output file. 

22 This file can then be read by gaincal to apply antenna position corrections. 

23  

24 

25 --------- parameter descriptions --------------------------------------------- 

26 

27 outfile Name of output file to which to write antenna positions. If a file by this name already exists, it will be silently overwritten. The written file will be in JSON format. 

28 default: none 

29 Example: outfile='my_alma_antenna_positions.json' 

30 overwrite file by the same name if it exists? If False and a file 

31 with the same name exists, and exception will be thrown. 

32 asdm The associated ASDM UID. The ASDM is not required to be on the file system; this value is simply passed to the web service. 

33 default: '' 

34 Example:asdm='uid://A002/X10ac6bc/X896d' 

35 tw Optional time window in which to consider baseline measurements in the database, when calculating the antenna positions. Format is of the form begin_time,end_time, where times must be specified in YYYY-MM-DDThh:mm:ss.sss format and end_time must be later than begin time. Times should be UTC. 

36 Example: tw='2023-03-14T00:40:20,2023-03-20T17:58:20' 

37 snr Optional signal-to-noise. Antenna positions which have corrections with S/N less than this value will not be retrieved nor written. If not specified, positions of all antennas will be written. 

38 default: 0 (no snr constraint will be used)  

39 Example: snr=5.0 

40 search Search algorithm to use. Supported values are "both_latest" and "both_closest". For "both_latest", the last updated position for each antenna within 30 days after the observation will be returned, taking into account snr if specified. If provided, tw will override the 30 day default value. For "both_closest", the position of each antenna closest in time to the observation, within 30 days (before or after the observation) will be returned, subject to the value of snr if it is specified. If specified, the value of tw will override the default 30 days. The default algorithm to use will be "both_latest". 

41 Example: search="both_closest" 

42 hosts Priority-ranked list of hosts to query to obtain positions. Only one server that returns a list of antenna positions is required. That response will be written and no additional hosts will be queried. 

43 Example: hosts=["server1.alma.cl", "server2.alma.cl"] 

44 RETURNS void 

45 

46 --------- examples ----------------------------------------------------------- 

47 

48  

49 

50 

51 """ 

52 

53 _info_group_ = """calibration""" 

54 _info_desc_ = """Retrieve antenna positions by querying ALMA web service.""" 

55 

56 def __call__( self, outfile='', overwrite=False, asdm='', tw='', snr=float(0), search='both_latest', hosts=[ 'https://asa.alma.cl/uncertainties-service/uncertainties/versions/last/measurements/casa/' ] ): 

57 schema = {'outfile': {'type': 'cPath', 'coerce': _coerce.expand_path}, 'overwrite': {'type': 'cBool'}, 'asdm': {'type': 'cStr', 'coerce': _coerce.to_str}, 'tw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'snr': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'search': {'type': 'cStr', 'coerce': _coerce.to_str}, 'hosts': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}} 

58 doc = {'outfile': outfile, 'overwrite': overwrite, 'asdm': asdm, 'tw': tw, 'snr': snr, 'search': search, 'hosts': hosts} 

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

60 _logging_state_ = _start_log( 'getantposalma', [ 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'asdm=' + repr(_pc.document['asdm']), 'tw=' + repr(_pc.document['tw']), 'snr=' + repr(_pc.document['snr']), 'search=' + repr(_pc.document['search']), 'hosts=' + repr(_pc.document['hosts']) ] ) 

61 task_result = None 

62 try: 

63 task_result = _getantposalma_t( _pc.document['outfile'], _pc.document['overwrite'], _pc.document['asdm'], _pc.document['tw'], _pc.document['snr'], _pc.document['search'], _pc.document['hosts'] ) 

64 except Exception as exc: 

65 _except_log('getantposalma', exc) 

66 raise 

67 finally: 

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

69 return task_result 

70 

71getantposalma = _getantposalma( ) 

72