예제 #1
0
lev = 0.1
cntfac = 2.0**0.5
blc = [230, 119]
trc = [285, 178]
img = Image.newPFImage("in image", file, 1, True, err)
info = img.List
info.set("BLC", blc)
info.set("TRC", trc)

cont = OPlot.newOPlot("cont", err, output=plotfile + "/ps")
OPlot.PContour(cont, "Some AGN", img, lev, cntfac, err)
# Text
txt=[(265.0,155.0,"A"), \
     (258.0,155.0,"B"), \
     (251.0,152.0,"C"), \
     (247.0,149.0,"D"), \
     (241.0,146.0,"E"), \
     (244.0,141.0,"F")]
OPlot.PSetCharSize(cont, 1, err)
for ss in txt:
    x = -(ss[0] - 1. - 250.9) * 2.0 / 60.0
    y = (ss[1] - 1. - 150.1) * 2.0 / 60.0
    OPlot.PText(cont, x, y, 180.0, 0.5, ss[2], err)

OPlot.PShow(cont, err)
print "Contour plot of", file, "written to", plotfile

# Shutdown Obit
OErr.printErr(err)
OSystem.Shutdown(ObitSys)
예제 #2
0
def doVPlot(spec, spec2, label, fact2=1.0, file="None", \
           xlabel="Velocity (km/s)", ylabel="Flux Density (Jy)", \
           lwidth=2,csize=1,symbol=3, Stokes="V"):
    """ Plots and displays an I and Stokes Stokes spectrum 

    accepts spectrum in a dictionary with entries
       vel = vel coordinate
       flux = flux
    spec   = IPol spectrum
    spec2  = VPol spectrum to plot with solid line, scaled on return
    fact2  = Factor to multiple times spec2 flux
    label  = plot label
    file   = name of output postscript file, if "None" ask
             "/xterm" gives xterm display
    xlabel = [optional] x axis label
    ylabel = [optional] y axis label
    lwidth = [optional] line width (integer)
    csize  = [optional] symbol size (integer)
    symbol = [optional] plot symbol code
    """
    ################################################################
    # Scale second spectrum
    if fact2 != 1.0:
        for i in range(0, len(spec2["flux"])):
            spec2["flux"][i] *= fact2

    xmin = min(min(spec['vel']), min(spec2['vel']))
    xmax = max(max(spec['vel']), max(spec2['vel']))
    ymin = 1.05 * min(min(spec['flux']), min(spec2['flux']))
    ymax = 1.1 * max(max(spec['flux']), max(spec2['flux']))
    # Add "/PS" for postscript files
    if file != "None" and file != "/xterm":
        filename = file + "/ps"
    else:
        filename = file
    # Create plot object
    err = Image.err
    plot = OPlot.newOPlot("plot", err, output=filename)
    # Set labeling on plot InfoList member
    info = plot.List
    dim = [1, 1, 1, 1, 1]
    InfoList.PPutFloat(info, "XMAX", dim, [xmax], err)
    InfoList.PPutFloat(info, "XMIN", dim, [xmin], err)
    InfoList.PPutFloat(info, "YMAX", dim, [ymax], err)
    InfoList.PPutFloat(info, "YMIN", dim, [ymin], err)
    InfoList.PPutInt(info, "LWIDTH", dim, [lwidth], err)
    InfoList.PPutInt(info, "CSIZE", dim, [csize], err)
    dim[0] = max(1, len(label))
    InfoList.PAlwaysPutString(info, "TITLE", dim, [label])
    dim[0] = max(1, len(xlabel))
    InfoList.PAlwaysPutString(info, "XLABEL", dim, [xlabel])
    dim[0] = max(1, len(ylabel))
    InfoList.PAlwaysPutString(info, "YLABEL", dim, [ylabel])
    x = spec["vel"]
    y = spec["flux"]
    OPlot.PXYPlot(plot, -1, x, y, err)
    x = spec2["vel"]
    y = spec2["flux"]
    OPlot.PXYOver(plot, symbol, x, y, err)
    # Label
    tx = xmin + 0.02 * (xmax - xmin)
    ty = ymax - 0.05 * (ymax - ymin)
    OPlot.PText(plot, tx, ty, 0.0, 0.0, "Line = I", err)
    ty = ymax - 0.09 * (ymax - ymin)
    OPlot.PText(plot, tx, ty, 0.0, 0.0, "* = " + Stokes + "*" + str(fact2),
                err)
    OPlot.PShow(plot, err)