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

16 statements  

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

1import os 

2 

3from casatools import calibrater 

4from casatasks import casalog 

5 

6def uvmodelfit(vis=None, 

7 field=None,spw=None, 

8 selectdata=None,timerange=None,uvrange=None,antenna=None,scan=None,msselect=None, 

9 niter=None,comptype=None,sourcepar=None,varypar=None,outfile=None): 

10 

11 #Python script 

12 try: 

13 mycb = calibrater() 

14 

15 casalog.origin('uvmodelfit') 

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

17 mycb.setvi(old=True,quiet=False); # old VI for now 

18 mycb.open(vis) 

19 else: 

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

21 

22 # Do data selection according to selectdata 

23 if (selectdata): 

24 # pass all data selection parameters in as specified 

25 mycb.selectvis(time=timerange,spw=spw,scan=scan,field=field, 

26 baseline=antenna,uvrange=uvrange,chanmode='none', 

27 msselect=msselect); 

28 else: 

29 # selectdata=F, so time,scan,baseline,uvrange,msselect='' 

30 # using spw and field specifications only 

31 mycb.selectvis(time='',spw=spw,scan='',field=field, 

32 baseline='',uvrange='',chanmode='none', 

33 msselect=''); 

34 

35 mycb.modelfit(niter=niter,compshape=comptype,par=sourcepar,vary=varypar,file=outfile) 

36 

37 finally: 

38 mycb.close()