Beispiel #1
0
def PCreate(name, err, input=GSolveInput):
    """ Create the parameters and underlying structures of a UVGSolve.

    Returns UVGSolve created.
    name        = Name to be given to object
                  Most control parameters are in InfoList member
    err         = Python Obit Error/message stack
    input       = control parameters:
    subA        = Selected subarray (default 1)
    solInt      = Solution interval (min). (default 1 sec)
    refAnt      = Ref ant to use. (default 1)
    avgPol      = True if RR and LL to be averaged (false)
    avgIF       = True if all IFs to be averaged (false)
    minSNR      = Minimum acceptable SNR (5)
    doMGM       = True then find the mean gain modulus (true)
    solType     = Solution type '  ', 'L1',  (' ')
    solMode     = Solution mode: 'A&P', 'P', 'P!A', 'GCON' ('P')
    minNo       = Min. no. antennas. (default 4)
    WtUV        = Weight outside of UV_Full. (default 1.0)
    antWt       = Weight per antenna, def all 1
    prtLv       = Print level (default no print)
    """
    ################################################################
    # Checks
    if not OErr.OErrIsA(err):
        raise TypeError("err MUST be an OErr")
    #
    # Create
    out = UVGSolve(name)
    out.me = Obit.UVGSolveCreate(name, skyModel.me)
    # Set SelfCal control values on out
    inInfo = PGetList(out)  #
    dim = [1, 1, 1, 1, 1]
    # Set control values on SelfCal
    dim[0] = 1
    inInfo = UV.PGetList(skyModel)  #
    InfoList.PPutInt(inInfo, "subA", dim, [input["subA"]], err)
    InfoList.PPutInt(inInfo, "refAnt", dim, [input["refAnt"]], err)
    InfoList.PPutInt(inInfo, "minNo", dim, [input["minNo"]], err)
    InfoList.PPutInt(inInfo, "prtLv", dim, [input["prtLv"]], err)
    InfoList.PPutBoolean(inInfo, "avgPol", dim, [input["avgPol"]], err)
    InfoList.PPutBoolean(inInfo, "avgIF", dim, [input["avgIF"]], err)
    InfoList.PPutBoolean(inInfo, "doMGM", dim, [input["doMGM"]], err)
    InfoList.PPutFloat(inInfo, "solInt", dim, [input["solInt"]], err)
    InfoList.PPutFloat(inInfo, "minSNR", dim, [input["minSNR"]], err)
    InfoList.PPutFloat(inInfo, "WtUV", dim, [input["WtUV"]], err)
    dim[0] = len(input["solType"])
    InfoList.PAlwaysPutString(inInfo, "solType", dim, [input["solType"]])
    dim[0] = len(input["solMode"])
    InfoList.PAlwaysPutString(inInfo, "solMode", dim, [input["solMode"]])
    # antWt if given
    if input["antWt"].__class__ != None.__class__:
        dim[0] = len(input["antWt"])
        InfoList.PAlwaysPutFloat(inInfo, "antWt", dim, input["antWt"])
    # show any errors
    #OErr.printErrMsg(err, "UVGSolveCreate: Error setting parameters")
    #
    return out
Beispiel #2
0
def VLAUVFITS(inUV, filename, outDisk, err, compress=False, \
              exclude=["AIPS HI", "AIPS AN", "AIPS FQ", "AIPS SL", "AIPS PL"], \
                  include=[], headHi=False):
    """ Write UV data as FITS file
    
    Write a UV data set as a FITAB format file
    History written to header
    inUV       = UV data to copy
    filename   = name of FITS file
    inDisk     = FITS directory number
    err        = Python Obit Error/message stack
    exclude    = List of table types NOT to copy
                 NB: "AIPS HI" isn't really a table and gets copied anyway
    include    = List of table types to copy (FQ, AN always done )
                 Exclude has presidence over include
    headHi     = if True move history to header, else leave in History table
    returns FITS UV data object
    """
    ################################################################
    # Checks
    if not UV.PIsA(inUV):
        raise TypeError, "inUV MUST be a Python Obit UV"
    if not OErr.OErrIsA(err):
        raise TypeError, "err MUST be an OErr"
    #
    # Set output
    outUV = UV.newPFUV("FITS UV DATA", filename, outDisk, False, err)
    if err.isErr:
        OErr.printErrMsg(err, "Error creating FITS data")
    #Compressed?
    if compress:
        inInfo = UV.PGetList(outUV)  #
        dim = [1, 1, 1, 1, 1]
        InfoList.PAlwaysPutBoolean(inInfo, "Compress", dim, [True])
    # Copy
    UV.PCopy(inUV, outUV, err)
    if err.isErr:
        OErr.printErrMsg(err, "Error copying UV data to FITS")
    # History
    inHistory = History.History("inhistory", outUV.List, err)
    outHistory = History.History("outhistory", outUV.List, err)
    # Add history
    outHistory.Open(History.READWRITE, err)
    outHistory.TimeStamp(" Start Obit uvtab", err)
    outHistory.WriteRec(
        -1, "uvtab   / FITS file " + filename + " disk " + str(outDisk), err)
    outHistory.Close(err)
    # History in header?
    if headHi:
        History.PCopy2Header(inHistory, outHistory, err)
        OErr.printErrMsg(err, "Error with history")
        # zap table
        outHistory.Zap(err)
    # Copy Tables
    UV.PCopyTables(inUV, outUV, exclude, include, err)
    return outUV  # return new object
Beispiel #3
0
def PUVWeight(InImager, err, input=UVWeightInput):
    """ Apply any calibration/editing/selection and do UV weighting

    UV Data is calibrated and weighted, values in input override those given
    when the UVImage was created.  This operation is optionally done in PUVImage.
    err     = Python Obit Error/message stack
    input   = input parameter dictionary
    
    Input dictionary entries:
    InImager   = Input Python UVImager to image
    Robust   = Briggs robust parameter. (AIPS definition)
    UVTaper  = UV plane taper, sigma in klambda,deg as [maj, min, pa]
    WtSize   = Size of weighting grid in cells [same as image nx]
    WtBox    = Size of weighting box in cells [def 1]
    WtFunc   = Weighting convolution function [def. 1]
               1=Pill box, 2=linear, 3=exponential, 4=Gaussian
               if positive, function is of radius, negative in u and v.
    WtPower  = Power to raise weights to.  [def = 1.0]
               Note: a power of 0.0 sets all the output weights to 1 as modified
               by uniform/Tapering weighting.
               Applied in determinng weights as well as after.
    Channel  = Channel (1-rel) number to image, 0-> all.
    """
    ################################################################
    # Get input parameters
    Channel = input["Channel"]
    WtSize = input["WtSize"]
    #
    # Checks
    if not PIsA(InImager):
        raise TypeError, 'PUVWeight: Bad input UVImager'

    # Set control values on UV
    dim[0] = 1
    dim[1] = 1
    dim[2] = 1
    dim[3] = 1
    dim[4] = 1
    inInfo = UV.PGetList(PGetUV(InImager))
    InfoList.PAlwaysPutFloat(inInfo, "Robust", dim, [input["Robust"]])
    InfoList.PAlwaysPutInt(inInfo, "WtBox", dim, [input["WtBox"]])
    InfoList.PAlwaysPutInt(inInfo, "WtFunc", dim, [input["WtFunc"]])
    InfoList.PAlwaysPutFloat(inInfo, "WtPower", dim, [input["WtPower"]])
    dim[1] = len(input["UVTaper"])
    InfoList.PAlwaysPutFloat(inInfo, "Taper", dim, input["UVTaper"])
    if (WtSize > 0):
        print "WtSize", WtSize
        # Change name for C routine.
        dim[0] = 1
        InfoList.PAlwaysPutInt(inInfo, "nuGrid", dim, [WtSize])
        InfoList.PAlwaysPutInt(inInfo, "nvGrid", dim, [WtSize])
    #
    Obit.UVImagerWeight(InImager.me, err.me)
    if err.isErr:
        OErr.printErrMsg(err, "Error weighting UV data")
Beispiel #4
0
def PSNSmo (inSC, err, input=UVSelfSNSmoInput):
    """ Smooth SN table possibly replacing blanked soln.

    inSC    = Selfcal object
    err     = Python Obit Error/message stack
    input   = input parameter dictionary
    
    Input dictionary entries:
    InData   = Input Python UV data 
    InTable  = Input SN table
    isuba    = Desired subarray, 0=> 1 
    smoType  = Smoothing type MWF, GAUS or BOX, def BOX
    smoAmp   = Amplitude smoothing time in min
    smpPhase = Phase smoothing time in min. (0 => fix failed only')
    """
    ################################################################
    # Get input parameters
    InData    = input["InData"]
    InTable   = input["InTable"]
    isuba     = input["isuba"]
    #
    # Checks
    if not UV.PIsA(InData):
        raise TypeError('PCal: Bad input UV data')
    if not Table.PIsA(InTable):
        raise TypeError('PCal: Bad input table')
    # Set control values on UV 
    dim[0] = 1;
    inInfo = UV.PGetList(InData)  # Add control to UV data
    dim[0] = len(input["smoType"]);
    InfoList.PAlwaysPutString  (inInfo, "smoType", dim, [input["smoType"]])
    dim[0] = 1;
    InfoList.PPutFloat   (inInfo, "smoAmp",  dim, [input["smoAmp"]],  err)
    InfoList.PPutFloat   (inInfo, "smoPhase",dim, [input["smoPhase"]],err)
    # Smooth
    Obit.UVSolnSNSmo(InTable.me, isuba, err.me)
    if err.isErr:
        printErrMsg(err, "Error smoothing SN table")
Beispiel #5
0
def PSoln2Cal(inUV, outUV, err, input=Soln2CalInput):
    """ Apply a gain solution to a calibration table

    inUV     = UV data with solution and input calibration
    outUV    = UV data for output calibration table
    err      = Python Obit Error/message stack
    input    = input parameter dictionary
    
    Input dictionary entries:
    solnVer = Input Solution (SN) table version 
    calIn   = Input Cal (CL) table version, 0=high, -1=none
    calOut  = Output Calibration table version, 0=>create new
    subA    = Selected subarray (default 1)
    interMode =  Interpolation mode 2PT, SELF POLY SIMP AMBG CUBE MWF '),
        "2PT " = linear vector interpolation with no SN smoothing.
        "SELF" = Use only SN solution from same source which is closest in time.
        "POLY" = Fit a polynomial to the SN rates and delays.
                  Use the integral of the rate polynomial for the phases. (NYI)
        "SIMP" = Simple linear phase connection between SN phase
                 entries, assumes phase difference less than 180 degrees.
        "AMBG" = Linear phase connection using rates to resolve phase ambiguities.
        "CUBE" = As AMBG but fit third order polynomial to phases and rates.
        "MWF " = Median window filter of SN table before 2PT interpolation
        "GAUS" = Gaussian smoothing of SN table before 2PT interpolation,
        "BOX " = Boxcar smoothing of SN table before 2PT interpolation,
    interParm =  interpolation parameters, smoothing time (hr)
                 amplitude, phase, delay/rate
    interNPoly = number of terms in polynomial'),
    allPass = If true copy unmodified entries as well (default False)
    refAnt  = Ref ant to use. (default 1)
    """
    ################################################################
    # Get input parameters
    InData = input["InData"]
    InTable = input["InTable"]
    isuba = input["isuba"]
    #
    # Checks
    if not UV.PIsA(inUV):
        raise TypeError, 'PSoln2Cal: Bad input UV data'
    if not UV.PIsA(outUV):
        raise TypeError, 'PSoln2Cal: Bad output UV data'

    # Set control values on UV
    dim[0] = 1
    inInfo = UV.PGetList(InData)  # Add control to UV data
    dim[0] = 4
    InfoList.PAlwaysPutString(inInfo, "interMode", dim, [input["interMode"]])
    dim[0] = 1
    InfoList.PAlwaysPutInt(inInfo, "solnVer", dim, [input["solnVer"]])
    InfoList.PAlwaysPutInt(inInfo, "calIn", dim, [input["calIn"]])
    InfoList.PAlwaysPutInt(inInfo, "calOut", dim, [input["calOut"]])
    InfoList.PAlwaysPutInt(inInfo, "subA", dim, [input["subA"]])
    InfoList.PAlwaysPutInt(inInfo, "interNPoly", dim, [input["interNPoly"]])
    InfoList.PAlwaysPutInt(inInfo, "refAnt", dim, [input["refAnt"]])
    InfoList.PAlwaysPutBool(inInfo, "allPass", dim, [input["allPass"]])
    dim[0] = len(input["interParm"])
    InfoList.PAlwaysPutFloat(inInfo, "allPass", dim, input["interParm"])
    # Calibrate
    Obit.UVSoln2Cal(inUV, outUV, err)
    if err.isErr:
        printErrMsg(err, "Error applying SN table to CL table")
Beispiel #6
0
def PUVCreateImager(err, name='myUVImager', input=UVCreateImagerInput):
    """ Create an imager to generate a set of images needed to cover a region.

    Create and return a Python Obit UVImager based on input parameters and
    uv data to be imaged.  Images should be fully defined when returned.
    err     = Python Obit Error/message stack
    name    = Name for output object
    input   = input parameter dictionary
    
    Input dictionary entries:
    InData   = Input Python UV data to image
    doCalSelect = Select/calibrate/edit data?),
    Stokes   = Stokes parameter, blank-> unchanged from input),
    BChan    = First spectral channel selected. [def all]),
    EChan    = Highest spectral channel selected. [def all]),
    BIF      = First IF selected. [def all]),
    EIF      = Highest IF selected. [def all]),
    doPol    = >0 -> calibrate polarization.),
    doCalib  = >0 -> calibrate, 2=> also calibrate Weights),
    gainUse  = SN/CL table version number, 0-> use highest),
    flagVer  = Flag table version, 0-> use highest, <0-> none),
    BLVer    = BL table version, 0> use highest, <0-> none),
    BPVer    = Band pass (BP) table version, 0-> use highest),
    Subarray = Selected subarray, <=0->all [default all]),
    freqID   = Selected Frequency ID, <=0->all [default all]),
    timeRange= Selected timerange in days. [2 floats] 0s -> all),
    UVRange  = Selected UV range in wavelengths. 0s -> all),
    Sources  = Source names selected unless any starts with),
    Antennas = A list of selected antenna numbers, if any is negative),
    corrType = Correlation type, 0=cross corr only, 1=both, 2=auto only.),
    doBand   = Band pass application type <0-> none),
    Smooth   = Specifies the type of spectral smoothing [three floats]
    DoWeight = True if Weighting to be applied
    Robust   = Briggs robust parameter. (AIPS definition)
    UVTaper  = UV plane taper, sigma in klambda,deg as [maj, min, pa]
    WtSize   = Size of weighting grid in cells [same as image nx]
    WtBox    = Size of weighting box in cells [def 1]
    WtFunc   = Weighting convolution function [def. 1]
               1=Pill box, 2=linear, 3=exponential, 4=Gaussian
               if positive, function is of radius, negative in u and v.
    WtPower  = Power to raise weights to.  [def = 1.0]
               Note: a power of 0.0 sets all the output weights to 1 as modified
               by uniform/Tapering weighting.
               Applied in determinng weights as well as after.
    DoBeam   = True if beams are to be made
    Type     = Underlying file type, 0=FITS, 1=AIPS
    Name     = Name of image, used as AIPS name or to derive FITS filename
    Class    = Root of class, used as AIPS class or to derive FITS filename
    Seq      = Sequence number
    Disk     = Disk number for underlying files
    FOV      = Field of view (deg) for Mosaic
    doFull   = If True, create full field (FOV) image
    NField   = Number of fields defined in input,
               if unspecified derive from data and FOV
    xCells   = Cell spacing in X (asec) for all images,
               if unspecified derive from data
    yCells   = Cell spacing in Y (asec) for all images,
               if unspecified derive from data
    nx       = Minimum number of cells in X for NField images
               if unspecified derive from data
    ny       = Minimum number of cells in Y for NField images
               if unspecified derive from data
    RAShift  = Right ascension shift (AIPS convention) for each field
               if unspecified derive from FOV and data
    DecShift = Declination for each field
               if unspecified derive from FOV and data
    Catalog  = AIPSVZ format catalog for defining outliers, None=do not use
    OutlierFlux = Minimum estimated outlyer flux density (Jy)
    OutlierDist = Maximum distance to add outlyers (deg)
    OutlierSI   = Spectral index to estimate flux density
    OutlierSize = Size of outlyer field (pixels)

    returns = Output UVImager with defined ImageMosaic
    """
    ################################################################
    # Get input parameters
    InData = input["InData"]
    #
    # Checks
    if not UV.PIsA(InData):
        raise TypeError, 'UVCreateImage: Bad input UV data'
    # Set control values on UV
    dim[0] = 1
    dim[1] = 1
    dim[2] = 1
    dim[3] = 1
    dim[4] = 1
    inInfo = UV.PGetList(InData)  # Add control to UV data
    # Calibration/editing/selection
    InfoList.PAlwaysPutBoolean(inInfo, "doCalSelect", dim,
                               [input["doCalSelect"]])
    dim[0] = 4
    InfoList.PAlwaysPutString(inInfo, "Stokes", dim, [input["Stokes"]])
    dim[0] = 1
    InfoList.PAlwaysPutInt(inInfo, "BChan", dim, [input["BChan"]])
    InfoList.PAlwaysPutInt(inInfo, "EChan", dim, [input["EChan"]])
    InfoList.PAlwaysPutInt(inInfo, "BIF", dim, [input["BIF"]])
    InfoList.PAlwaysPutInt(inInfo, "EIF", dim, [input["EIF"]])
    itemp = int(input["doPol"])
    InfoList.PAlwaysPutInt(inInfo, "doPol", dim, [itemp])
    InfoList.PAlwaysPutInt(inInfo, "doCalib", dim, [input["doCalib"]])
    InfoList.PAlwaysPutInt(inInfo, "doBand", dim, [input["doBand"]])
    InfoList.PAlwaysPutInt(inInfo, "gainUse", dim, [input["gainUse"]])
    InfoList.PAlwaysPutInt(inInfo, "flagVer", dim, [input["flagVer"]])
    InfoList.PAlwaysPutInt(inInfo, "BLVer", dim, [input["BLVer"]])
    InfoList.PAlwaysPutInt(inInfo, "BPVer", dim, [input["BPVer"]])
    InfoList.PAlwaysPutInt(inInfo, "Subarray", dim, [input["Subarray"]])
    InfoList.PAlwaysPutInt(inInfo, "freqID", dim, [input["freqID"]])
    InfoList.PAlwaysPutInt(inInfo, "corrType", dim, [input["corrType"]])
    dim[0] = 2
    InfoList.PAlwaysPutFloat(inInfo, "UVRange", dim, input["UVRange"])
    dim[0] = 3
    InfoList.PAlwaysPutFloat(inInfo, "Smooth", dim, input["Smooth"])
    dim[0] = 2
    InfoList.PAlwaysPutFloat(inInfo, "timeRange", dim, input["timeRange"])
    dim[0] = len(input["Antennas"])
    InfoList.PAlwaysPutInt(inInfo, "Antennas", dim, input["Antennas"])
    dim[0] = 16
    dim[1] = len(input["Sources"])
    InfoList.PAlwaysPutString(inInfo, "Sources", dim, input["Sources"])
    # Weighting parameters
    dim[0] = 1
    dim[1] = 1
    InfoList.PAlwaysPutFloat(inInfo, "Robust", dim, [input["Robust"]])
    InfoList.PAlwaysPutInt(inInfo, "WtBox", dim, [input["WtBox"]])
    InfoList.PAlwaysPutInt(inInfo, "WtFunc", dim, [input["WtFunc"]])
    InfoList.PAlwaysPutFloat(inInfo, "WtPower", dim, [input["WtPower"]])
    dim[0] = len(input["UVTaper"])
    InfoList.PAlwaysPutFloat(inInfo, "UVTaper", dim, input["UVTaper"])
    WtSize = input["WtSize"]
    if (WtSize > 0):
        print "WtSize", WtSize
        # Change name for C routine.
        dim[0] = 1
        InfoList.PAlwaysPutInt(inInfo, "nuGrid", dim, [WtSize])
        InfoList.PAlwaysPutInt(inInfo, "nvGrid", dim, [WtSize])
    # Define image
    dim[0] = 1
    dim[1] = 1
    InfoList.PAlwaysPutInt(inInfo, "imFileType", dim, [input["Type"]])
    InfoList.PAlwaysPutInt(inInfo, "imSeq", dim, [input["Seq"]])
    InfoList.PAlwaysPutInt(inInfo, "imDisk", dim, [input["Disk"]])
    InfoList.PAlwaysPutFloat(inInfo, "FOV", dim, [input["FOV"]])
    InfoList.PAlwaysPutBoolean(inInfo, "doFull", dim, [input["doFull"]])
    InfoList.PAlwaysPutInt(inInfo, "NField", dim, [input["NField"]])
    InfoList.PAlwaysPutFloat(inInfo, "xCells", dim, [input["xCells"]])
    InfoList.PAlwaysPutFloat(inInfo, "yCells", dim, [input["yCells"]])
    InfoList.PAlwaysPutFloat(inInfo, "OutlierFlux", dim,
                             [input["OutlierFlux"]])
    InfoList.PAlwaysPutFloat(inInfo, "OutlierDist", dim,
                             [input["OutlierDist"]])
    InfoList.PAlwaysPutFloat(inInfo, "OutlierSI", dim, [input["OutlierSI"]])
    InfoList.PAlwaysPutInt(inInfo, "OutlierSize", dim, [input["OutlierSize"]])
    dim[0] = len(input["Name"])
    InfoList.PAlwaysPutString(inInfo, "imName", dim, [input["Name"]])
    dim[0] = len(input["Class"])
    InfoList.PAlwaysPutString(inInfo, "imClass", dim, [input["Class"]])
    dim[0] = len(input["Catalog"])
    InfoList.PAlwaysPutString(inInfo, "Catalog", dim, [input["Catalog"]])
    dim[0] = len(input["nx"])
    InfoList.PAlwaysPutInt(inInfo, "nx", dim, input["nx"])
    dim[0] = len(input["ny"])
    InfoList.PAlwaysPutInt(inInfo, "ny", dim, input["ny"])
    dim[0] = len(input["RAShift"])
    InfoList.PAlwaysPutFloat(inInfo, "RAShift", dim, input["RAShift"])
    dim[0] = len(input["DecShift"])
    InfoList.PAlwaysPutFloat(inInfo, "DecShift", dim, input["DecShift"])
    #
    # Create
    out = UVImager(name, InData.me, err.me)
    # show any errors
    #OErr.printErrMsg(err, "UVImage: Error creating UVImager object")
    #
    return out
Beispiel #7
0
def PCreate (name, uvdata, err, input=CleanInput):
    """
    Create the parameters and underlying structures of a CleanVis.
    
    Returns CleanVis created.

    * name      = Name to be given to object. Most control parameters are in 
      InfoList member
    * uvdata    = Python uv data from which image is to be made
    * err       = Python Obit Error/message stack
    * input     = control parameters:

      ===========  ============================================================
      Niter        Maximum number of CLEAN iterations
      minPatch     Minimum beam patch in pixels [def 100]
      maxPixel     Maximum number of residuals [def 20000]
      BMAJ         Restoring beam major axis (deg)
      BMIN         Restoring beam minor axis (deg)
      BPA          Restoring beam position angle (deg)
      Gain         CLEAN loop gain
      minFlux      Minimun flux density (Jy)
      Factor       CLEAN depth factor
      Plane        Plane being processed, 1-rel indices of axes 3-?
      autoWindow   True if autoWindow feature wanted.
      CCVer        CC table version number
      Mode         Model mode, 0=fastest, 1=DFT, 2=Grid
      doCalSelect  Select/calibrate/edit data?),
      Stokes       Stokes parameter, blank-> unchanged from input),
      BChan        First spectral channel selected. [def all]),
      EChan        Highest spectral channel selected. [def all]),
      BIF          First IF selected. [def all]),
      EIF          Highest IF selected. [def all]),
      doPol        >0 -> calibrate polarization.),
      doCalib      >0 -> calibrate, 2=> also calibrate Weights),
      gainUse      SN/CL table version number, 0-> use highest),
      flagVer      Flag table version, 0-> use highest, <0-> none),
      BLVer        BL table version, 0> use highest, <0-> none),
      BPVer        Band pass (BP) table version, 0-> use highest),
      Subarray     Selected subarray, <=0->all [default all]),
      freqID       Selected Frequency ID, <=0->all [default all]),
      timeRange    Selected timerange in days. [2 floats] 0s -> all),
      UVRange      Selected UV range in wavelengths. 0s -> all),
      Sources      Source names selected unless any starts with),
      Antennas     A list of selected antenna numbers, if any is negative),
      corrType     Correlation type, 0=cross corr only, 1=both, 2=auto only.),
      doBand       Band pass application type <0-> none),
      Smooth       Specifies the type of spectral smoothing [three floats]
      DoWeight     True if Weighting to be applied
      PBCor        If True make freq. dependent rel. pri. beam corr.
      Robust       Briggs robust parameter. (AIPS definition)
      UVTaper      UV plane taper, sigma in klambda,deg as [maj, min, pa]
      WtSize       Size of weighting grid in cells [same as image nx]
      WtBox        Size of weighting box in cells [def 1]
      WtFunc       Weighting convolution function [def. 1]
                   1=Pill box, 2=linear, 3=exponential, 4=Gaussian
                   if positive, function is of radius, negative in u and v.
      WtPower      Power to raise weights to.  [def = 1.0]
                   Note: a power of 0.0 sets all the output weights to 1 as modified
                   by uniform/Tapering weighting.
                   Applied in determinng weights as well as after.
      DoBeam       True if beams are to be made
      Type         Underlying file type, 0=FITS, 1=AIPS
      Name         Name of image, used as AIPS name or to derive FITS filename
      Class        Root of class, used as AIPS class or to derive FITS filename
      Seq          Sequence number
      Disk         Disk number for underlying files
      FOV          Field of view (deg) for Mosaic
      doFull       If True, create full field (FOV) image
      NField       Number of fields defined in input,
                   if unspecified derive from data and FOV
      xCells       Cell spacing in X (asec) for all images,
                   if unspecified derive from data
      yCells       Cell spacing in Y (asec) for all images,
                   if unspecified derive from data
      nx           Minimum number of cells in X for NField images
                   if unspecified derive from data
      ny           Minimum number of cells in Y for NField images
                   if unspecified derive from data
      RAShift      Right ascension shift (AIPS convention) for each field
                   if unspecified derive from FOV and data
      DecShift     Declination for each field
                   if unspecified derive from FOV and data
      Catalog      AIPSVZ format catalog for defining outliers, None=do not use
      OutlierFlux  Minimum estimated outlyer flux density (Jy)
      OutlierDist  Maximum distance to add outlyers (deg)
      OutlierSI    Spectral index to estimate flux density
      OutlierSize  Size of outlyer field (pixels)
      dispURL      URL of display server
      doRestore    Restore image when done? [def True]
      doFlatten    Flatten image when done? [def True]
      ===========  ============================================================
    """
    ################################################################
    # Checks
    if not UV.PIsA(uvdata):
        raise TypeError,"uvData MUST be a Python Obit UV"
    if not OErr.OErrIsA(err):
        raise TypeError,"err MUST be an OErr"
    #
    dim = [1,1,1,1,1]
    # Set imaging control values on uvdata
    dim[0] = 1;
    inInfo = UV.PGetList(uvdata)    # 
    InfoList.PPutBoolean (inInfo, "doCalSelect",  dim, [input["doCalSelect"]], err)
    dim[0] = 4
    InfoList.PAlwaysPutString (inInfo, "Stokes",   dim, [input["Stokes"]])
    dim[0] = 1;
    InfoList.PPutInt  (inInfo, "BChan",      dim, [input["BChan"]],    err)
    InfoList.PPutInt  (inInfo, "EChan",      dim, [input["EChan"]],    err)
    InfoList.PPutInt  (inInfo, "BIF",        dim, [input["BIF"]],      err)
    InfoList.PPutInt  (inInfo, "EIF",        dim, [input["EIF"]],      err)
    itemp = int(input["doPol"])
    InfoList.PPutInt  (inInfo, "doPol",      dim, [itemp],             err)
    InfoList.PPutInt  (inInfo, "doCalib",    dim, [input["doCalib"]],  err)
    InfoList.PPutInt  (inInfo, "doBand",     dim, [input["doBand"]],   err)
    InfoList.PPutInt  (inInfo, "gainUse",    dim, [input["gainUse"]],  err)
    InfoList.PPutInt  (inInfo, "flagVer",    dim, [input["flagVer"]],  err)
    InfoList.PPutInt  (inInfo, "BLVer",      dim, [input["BLVer"]],    err)
    InfoList.PPutInt  (inInfo, "BPVer",      dim, [input["BPVer"]],    err)
    InfoList.PPutInt  (inInfo, "Subarray",   dim, [input["Subarray"]], err)
    InfoList.PPutInt  (inInfo, "freqID",     dim, [input["freqID"]],   err)
    InfoList.PPutInt  (inInfo, "corrType",   dim, [input["corrType"]], err)
    dim[0] = 2
    InfoList.PPutFloat (inInfo, "UVRange",   dim, input["UVRange"],    err)
    dim[0] = 3
    InfoList.PPutFloat (inInfo, "Smooth",    dim, input["Smooth"],     err)
    dim[0] = 2
    InfoList.PPutFloat (inInfo, "timeRange", dim, input["timeRange"],  err)
    dim[0] = len(input["Antennas"])
    InfoList.PPutInt  (inInfo, "Antennas",   dim, input["Antennas"],   err)
    dim[0] = 16; dim[1] = len(input["Sources"])
    InfoList.PAlwaysPutString  (inInfo, "Sources", dim, input["Sources"])
    # Weighting parameters
    dim[0] = 1; dim[1] = 1;
    InfoList.PPutBoolean (inInfo,"DoWeight",dim,[input["DoWeight"]],err)
    InfoList.PPutBoolean (inInfo,"PBCor",  dim, [input["PBCor"]],   err)
    InfoList.PPutFloat  (inInfo, "Robust", dim, [input["Robust"]],  err)
    InfoList.PPutInt    (inInfo, "WtBox",  dim, [input["WtBox"]],   err)
    InfoList.PPutInt    (inInfo, "WtFunc", dim, [input["WtFunc"]],  err)
    InfoList.PPutFloat  (inInfo, "WtPower",dim, [input["WtPower"]], err)
    dim[1] = len(input["UVTaper"])
    InfoList.PPutFloat  (inInfo, "Taper",  dim, input["UVTaper"],   err)
    WtSize   = input["WtSize"]
    if (WtSize>0):
        print "WtSize", WtSize
        # Change name for C routine.
        dim[0] = 1;
        InfoList.PPutInt  (inInfo, "nuGrid",  dim, [WtSize], err)
        InfoList.PPutInt  (inInfo, "nvGrid",  dim, [WtSize], err)
    # Define image
    dim[0] = 1; dim[1] = 1;
    InfoList.PPutInt    (inInfo, "imFileType", dim, [input["Type"]],   err)
    InfoList.PPutInt    (inInfo, "imSeq",      dim, [input["Seq"]],    err)
    InfoList.PPutInt    (inInfo, "imDisk",     dim, [input["Disk"]],   err)
    InfoList.PPutFloat  (inInfo, "FOV",      dim, [input["FOV"]],    err)
    InfoList.PPutBoolean (inInfo, "doFull",  dim, [input["doFull"]], err)
    InfoList.PPutInt    (inInfo, "NField",   dim, [input["NField"]], err)
    InfoList.PPutFloat  (inInfo, "xCells",   dim, [input["xCells"]], err)
    InfoList.PPutFloat  (inInfo, "yCells",   dim, [input["yCells"]], err)
    InfoList.PPutFloat  (inInfo, "OutlierFlux", dim, [input["OutlierFlux"]], err)
    InfoList.PPutFloat  (inInfo, "OutlierDist", dim, [input["OutlierDist"]], err)
    InfoList.PPutFloat  (inInfo, "OutlierSI",   dim, [input["OutlierSI"]],   err)
    InfoList.PPutInt    (inInfo, "OutlierSize", dim, [input["OutlierSize"]], err)
    InfoList.PPutFloat  (inInfo, "BMAJ",     dim, [input["BMAJ"]],     err)
    InfoList.PPutFloat  (inInfo, "BMIN",     dim, [input["BMIN"]],     err)
    InfoList.PPutFloat  (inInfo, "BPA",      dim, [input["BPA"]],      err)
    dim[0] = len(input["Name"])
    InfoList.PAlwaysPutString (inInfo, "imName",     dim, [input["Name"]])
    dim[0] = len(input["Class"])
    InfoList.PAlwaysPutString (inInfo, "imClass",    dim, [input["Class"]])
    dim[0] = len(input["Catalog"])
    InfoList.PAlwaysPutString (inInfo, "Catalog",  dim, [input["Catalog"]])
    dim[0] = len(input["nx"])
    InfoList.PAlwaysPutInt    (inInfo, "nx",       dim, input["nx"])
    dim[0] = len(input["ny"])
    InfoList.PAlwaysPutInt    (inInfo, "ny",       dim, input["ny"])
    dim[0] = len(input["RAShift"])
    InfoList.PAlwaysPutFloat  (inInfo, "RAShift",  dim, input["RAShift"])
    dim[0] = len(input["DecShift"])
    InfoList.PAlwaysPutFloat  (inInfo, "DecShift", dim, input["DecShift"])
    #OErr.printErrMsg(err, "CleanVisCreate: Error setting parameters")
    #
    # Create
    out = CleanVis(name);
    out.me = Obit.CleanVisCreate(name, uvdata.me,  err.me)
    if err.isErr:
        OErr.printErrMsg(err, "Error creating CleanVis")
    # Set Clean control values on out
    dim[0] = 1;
    inInfo = PGetList(out)    # 
    InfoList.PPutInt   (inInfo, "Niter",    dim, [input["Niter"]],    err)
    InfoList.PPutInt   (inInfo, "minPatch", dim, [input["minPatch"]], err)
    InfoList.PPutInt   (inInfo, "maxPixel", dim, [input["maxPixel"]], err)
    InfoList.PPutInt   (inInfo, "CCVer",    dim, [input["CCVer"]],    err)
    InfoList.PPutInt   (inInfo, "Mode",     dim, [input["Mode"]],    err)
    InfoList.PPutFloat (inInfo, "BMAJ",     dim, [input["BMAJ"]],     err)
    InfoList.PPutFloat (inInfo, "BMIN",     dim, [input["BMIN"]],     err)
    InfoList.PPutFloat (inInfo, "BPA",      dim, [input["BPA"]],      err)
    InfoList.PPutFloat (inInfo, "Gain",     dim, [input["Gain"]],     err)
    InfoList.PPutFloat (inInfo, "minFlux",  dim, [input["minFlux"]],  err)
    InfoList.PPutFloat (inInfo, "Factor",   dim, [input["Factor"]],   err)
    InfoList.PPutBoolean (inInfo, "doRestore",  dim, [input["doRestore"]], err)
    InfoList.PPutBoolean (inInfo, "doFlatten",  dim, [input["doFlatten"]], err)
    InfoList.PPutBoolean (inInfo, "autoWindow", dim, [input["autoWindow"]],err)
    dim[0] = len(input["Plane"])
    InfoList.PAlwaysPutInt   (inInfo, "Plane",    dim, input["Plane"])
    dim[0] = len(input["dispURL"])
    InfoList.PAlwaysPutString (inInfo, "dispURL",   dim, [input["dispURL"]])
    # show any errors 
    #OErr.printErrMsg(err, "CleanVisCreate: Error setting parameters")
    #
    return out;