casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
task_uvmodelfit.py
Go to the documentation of this file.
00001 import os
00002 from taskinit import *
00003 
00004 def uvmodelfit(vis=None,
00005                field=None,spw=None,
00006                selectdata=None,timerange=None,uvrange=None,antenna=None,scan=None,msselect=None,
00007                niter=None,comptype=None,sourcepar=None,varypar=None,outfile=None):
00008 
00009         #Python script
00010         try:
00011                 casalog.origin('uvmodelfit')
00012                 if ((type(vis)==str) & (os.path.exists(vis))):
00013                         cb.open(vis)
00014                 else:
00015                         raise Exception, 'Visibility data set not found - please verify the name'
00016 
00017                 # Do data selection according to selectdata
00018                 if (selectdata):
00019                         # pass all data selection parameters in as specified
00020                         cb.selectvis(time=timerange,spw=spw,scan=scan,field=field,
00021                                      baseline=antenna,uvrange=uvrange,chanmode='none',
00022                                      msselect=msselect);
00023                 else:
00024                         # selectdata=F, so time,scan,baseline,uvrange,msselect=''
00025                         # using spw and field specifications only
00026                         cb.selectvis(time='',spw=spw,scan='',field=field,
00027                                      baseline='',uvrange='',chanmode='none',
00028                                      msselect='');
00029 
00030                 cb.modelfit(niter=niter,compshape=comptype,par=sourcepar,vary=varypar,file=outfile)
00031                 cb.close()
00032         except Exception, instance:
00033                 print '*** Error ***',instance
00034                 cb.close()
00035                 raise Exception, instance
00036