Coverage for /home/casatest/venv/lib/python3.12/site-packages/casatasks/defintent.py: 56%

27 statements  

« prev     ^ index     » next       coverage.py v7.10.4, created at 2025-08-21 07:43 +0000

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

2##################### 24e4a55bc1407415b9ca0254317c55fa ############################## 

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_defintent import defintent as _defintent_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 _defintent: 

15 """ 

16 defintent ---- Manually set scan intents 

17 

18  

19 Allows the user to manually set scan intents 

20 

21 --------- parameter descriptions --------------------------------------------- 

22 

23 vis Name of input visibility file (MS) 

24 Default: none 

25  

26 Example: vis='ngc5921.ms' 

27 intent select intent to add 

28 The list of strings will be combined into an intent string to be added 

29 mode Intent modification mode (set/append) 

30 outputvis Creates an output ms with all the changes from the task leaving the original vis untouched. 

31 scan Select Scan to apply the new intents to 

32 field Select field using field id(s) or field name(s) 

33 obsid Select ObsId 

34 RETURNS void 

35 

36 --------- examples ----------------------------------------------------------- 

37 

38  

39  

40 For more information, see the task pages of clearcal in CASA Docs: 

41  

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

43  

44  

45 

46 

47 """ 

48 

49 _info_group_ = """calibration""" 

50 _info_desc_ = """Manually set scan intents""" 

51 

52 def __call__( self, vis='', intent='', mode='', outputvis='', scan='', field='', obsid='' ): 

53 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outputvis': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'obsid': {'type': 'cStr', 'coerce': _coerce.to_str}} 

54 doc = {'vis': vis, 'intent': intent, 'mode': mode, 'outputvis': outputvis, 'scan': scan, 'field': field, 'obsid': obsid} 

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

56 _logging_state_ = _start_log( 'defintent', [ 'vis=' + repr(_pc.document['vis']), 'intent=' + repr(_pc.document['intent']), 'mode=' + repr(_pc.document['mode']), 'outputvis=' + repr(_pc.document['outputvis']), 'scan=' + repr(_pc.document['scan']), 'field=' + repr(_pc.document['field']), 'obsid=' + repr(_pc.document['obsid']) ] ) 

57 task_result = None 

58 try: 

59 task_result = _defintent_t( _pc.document['vis'], _pc.document['intent'], _pc.document['mode'], _pc.document['outputvis'], _pc.document['scan'], _pc.document['field'], _pc.document['obsid'] ) 

60 except Exception as exc: 

61 _except_log('defintent', exc) 

62 raise 

63 finally: 

64 task_result = _end_log( _logging_state_, 'defintent', task_result ) 

65 return task_result 

66 

67defintent = _defintent( ) 

68