casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
task_ssoflux.py
Go to the documentation of this file.
00001 import os
00002 from taskinit import *
00003 
00004 def ssoflux(vis=None,field=None,spw=None,modimage=None,fluxdensity=None,standard=None):
00005        """
00006        *This is an experimental clone of setjy while flux calibration with
00007        Solar System objects is being tested.  It will eventually be merged
00008        back into setjy.*
00009 
00010        Fills the model column for flux density calibrators:
00011 
00012        The task places the model visibility amp and phase associated
00013        with a specified clean components image into the model column
00014        of the data set.  The simplest way is to enter the flux density
00015        (I,Q,U,V) explicitly.
00016 
00017        Models are available for 3C48, 3C138, and 3C286 between
00018        1.4 and 43 GHz.  3C147 is available above 13 GHz.  These models
00019        are scaled to the precise frequency of the data.  Only I models are
00020        presently available.
00021 
00022        The location of the models are system dependent:  At the AOC, the
00023        models are in the directory::/usr/lib/casapy/data/nrao/VLA/CalModels
00024 
00025        ssoflux need only be run on the calibrator sources with a know flux
00026        density and/or model.
00027 
00028        Keyword arguments:
00029        vis -- Name of input visibility file
00030                default: none.  example: vis='ngc5921.ms'
00031        field -- Select field using field id(s) or field name(s).
00032                  [run listobs to obtain the list id's or names of calibrators]
00033               default: ''=all fields
00034               Only one field can be used if a source model or specific fluxdensity
00035                  is inserted.
00036               If field string is a non-negative integer, it is assumed a field index
00037                 otherwise, it is assumed a field name
00038               field='0~2'; field ids 0,1,2
00039               field='0,4,5~7'; field ids 0,4,5,6,7
00040               field='3C286,3C295'; fields named 3C286 and 3C295
00041               field = '3,4C*'; field id 3, all names starting with 4C
00042        spw -- Select spectral window/channels
00043               default: ''=all spectral windows and channels
00044               spw='0~2,4'; spectral windows 0,1,2,4 (all channels)
00045               spw='<2';  spectral windows less than 2 (i.e. 0,1)
00046               spw='0:5~61'; spw 0, channels 5 to 61
00047               spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, channels 3 to 45.
00048               spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each.
00049               spw='0:0~10;15~60'; spectral window 0 with channels 0-10,15-60
00050               spw='0:0~10,1:20~30,2:1;2;4'; spw 0, channels 0-10,
00051                        spw 1, channels 20-30, and spw 2, channels, 1,2 and 4
00052        modimage -- Optional model image (I only) from which the model visibilities
00053               are calculated and placed in the model column.  Each field must
00054               be done separately.  The image flux density will be scaled from the
00055               frequency in the model to that actually used.
00056               In CV and the AOC, the models are located in the
00057               /usr/lib/casapy/data/nrao/VLA/CalModels directory
00058        fluxdensity -- Specified flux density [I,Q,U,V] in Jy
00059                default => -1, puts total flux density for known standard source
00060                places [1,0,0,0] for any other source.
00061                Otherwise,  places the specified flux density for the source.  This
00062                is the only way to insert a polarized flux density model at the
00063                present time (March 2008).
00064                example:  fluxdensity=[2.63,0.21,-0.33,0.02]
00065        standard -- Flux density standard, used if fluxdensity<0
00066                default: 'Perley-Taylor 99'; example: standard='Baars'
00067                Options: 'Baars','Perley 90','Perley-Taylor 95',
00068                   'Perley-Taylor 99'
00069 
00070        """
00071 
00072        try:
00073          casalog.origin('ssoflux')
00074          casalog.post('ssoflux is no longer supported.  Use setjy.', 'SEVERE')
00075 
00076          ## if ((type(vis)==str) & (os.path.exists(vis))):
00077          ##             im.open(vis, usescratch=True)
00078          ## else:
00079          ##             raise Exception, 'Visibility data set not found - please verify the name'
00080 
00081          ## im.ssoflux(field=field,spw=spw,modimage=modimage,fluxdensity=fluxdensity,standard=standard)
00082          ## im.close()
00083 
00084 
00085          ##      #write history
00086          ## ms.open(vis,nomodify=False)
00087          ## ms.writehistory(message='taskname = ssoflux',origin='ssoflux')
00088          ## ms.writehistory(message='vis         = "'+str(vis)+'"',origin='ssoflux')
00089          ## ms.writehistory(message='field       = "'+str(field)+'"',origin='ssoflux')
00090          ## ms.writehistory(message='spw       = '+str(spw),origin='ssoflux')
00091          ## ms.writehistory(message='modimage = '+str(modimage),origin='ssoflux')
00092          ## ms.writehistory(message='fluxdensity = '+str(fluxdensity),origin='ssoflux')
00093          ## ms.writehistory(message='standard    = "'+str(standard)+'"',origin='ssoflux')
00094          ## ms.close()
00095 
00096        except Exception, instance:
00097               print '*** Error ***',instance
00098