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

24 statements  

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

1import os 

2import numpy as np 

3 

4from casatasks import casalog 

5from .imagerhelpers.imager_base import PySynthesisImager 

6from .imagerhelpers.input_parameters import ImagerParameters 

7 

8def apparentsens(vis=None, 

9 field=None,spw=None,intent=None, 

10 selectdata=None,timerange=None,uvrange=None,antenna=None,scan=None, 

11 observation=None, # msselect=None, 

12 imsize=None,cell=None, 

13 stokes=None,specmode=None, 

14 weighting=None, 

15 robust=None,npixels=None,uvtaper=None): 

16 

17 #Python script 

18 casalog.origin('apparentsens') 

19 

20 try: 

21 

22 # insist on continuum calculation only (for now) 

23 if specmode!='mfs': 

24 casalog.post( "The apparentsens task only supports specmoe='mfs' at this time", "WARN", "task_apparentsens" ) 

25 

26 imname=vis+'.apparentsens' 

27 

28 # remove the image files that imager makes below 

29 os.system('rm -Rf '+imname+'.*') 

30 

31 # fill the relevant parameters 

32 paramList = ImagerParameters( 

33 msname=vis, 

34 field=field, 

35 spw=spw, 

36 timestr=timerange, 

37 uvdist=uvrange, 

38 antenna=antenna, 

39 scan=scan, 

40 obs=observation, 

41 state=intent, 

42 imagename=imname, 

43 imsize=imsize, 

44 cell=cell, 

45 stokes=stokes, 

46 specmode=specmode, 

47 nchan=-1, 

48 weighting=weighting, 

49 robust=robust, 

50 npixels=npixels, 

51 uvtaper=uvtaper 

52 ) 

53 

54 imager = PySynthesisImager(params=paramList) 

55 

56 imager.initializeImagers() 

57 imager.initializeNormalizers() 

58 imager.setWeighting() 

59 

60 out = imager.calcVisAppSens() 

61 

62# imager.makePSF() 

63 

64 imager.deleteTools() 

65 

66 return out 

67 

68 except Exception as instance: 

69 print('*** Error ***', instance) 

70 casalog.post("Error in apparentsens: %s" % str(instance), "SEVERE") 

71 raise Exception("Error in apparentsens: "+str(instance)) 

72