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

16 statements  

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

1import os 

2from casatools import ms 

3 

4from casatasks import casalog 

5 

6def exportuvfits( vis, fitsfile, datacolumn, field, spw, antenna, time, 

7 writesyscal, multisource, combinespw, 

8 writestation, padwithflags, overwrite ): 

9 

10 casalog.origin('exportuvfits') 

11 

12 try: 

13 myms = ms( ) 

14 if ((type(vis)==str) & (os.path.exists(vis))): 

15 myms.open( vis, lock=True ) 

16 else: 

17 raise ValueError('Visibility data set not found - please verify the name') 

18 writesyscal=False #until ms syscal table defined 

19 res = myms.tofits( fitsfile=fitsfile, column=datacolumn, field=field, spw=spw, 

20 baseline=antenna, time=time, writesyscal=writesyscal, 

21 multisource=multisource, combinespw=combinespw, 

22 writestation=writestation, padwithflags=padwithflags, 

23 overwrite=overwrite ) 

24 if not res: 

25 raise Exception("exportuvfits failed") 

26 finally: 

27 if myms: 

28 myms.done() 

29