예제 #1
0
파일: UVPolnUtil.py 프로젝트: mauch/Obit-1
def PlotRM(inUV, fitDict, plotFile, title, err):
    """
    Plot data and model
    
    Return list of channel lambda^2 (m^2)
    * inUV     = Obit UV data with tables
    * fitDict  = dict returned by PFitSource
    * plotFile = output ps plotfile name
    * title    = plot title
    * err      = Python Obit Error/message stack
    """
    ################################################################
    plot=OPlot.newOPlot("Plot", err,output=plotFile+"/ps",ny=2)
    # Extract data, fits
    RM    = fitDict["RM"];     RMErr    = fitDict["RMErr"];
    EVPA0 = fitDict["EVPA0"];  EVPAErr  = fitDict["EVPAErr"];
    lamb2 = fitDict["Lamb2"];  refLamb2 = fitDict["RefLamb2"];
    EVPA  = fitDict["EVPA"];   fpol     = fitDict["FPol"];
    # angles to deg
    EVPA0 = math.degrees(EVPA0); EVPAErr = math.degrees(EVPAErr); 
    phs = []
    for angle in EVPA :
        phs.append(math.degrees(angle))
    
    # Plot EVPA
    plot.List.set("TITLE","%s RM=%6.2f (%5.2f) EVPA=%6.2f (%5.2f) "\
                      %(title, RM, RMErr, EVPA0, EVPAErr))
    plot.List.set("YLABEL","EVPA (deg)")
    plot.List.set("CSIZE",1)
    plot.List.set("SSIZE",3)
    plot.List.set("LWIDTH",3)
    OPlot.PXYPlot(plot, 2, lamb2, phs, err)
    # Plot RM fit
    nspec = len(lamb2)
    x1 = lamb2[0] - refLamb2
    y1 = EVPA0 + math.degrees(RM*x1)
    x2 = lamb2[nspec-1] - refLamb2
    y2 = EVPA0 + math.degrees(RM*x2)
    OPlot.PDrawLine(plot, lamb2[0], y1, lamb2[nspec-1], y2, err)
    # Plot fractional poln
    plot.List.set("TITLE"," ")
    plot.List.set("XLABEL","#gl#u2#d (m#u2#d)")
    plot.List.set("YLABEL","frac. pol.")
    plot.List.set("XMAX",lamb2[0])
    plot.List.set("XMIN",lamb2[nspec-1])
    plot.List.set("YMIN",0.0)
    plot.List.set("YMAX",0.1)
    OPlot.PXYPlot(plot, 2, lamb2, fpol, err)
    OPlot.PShow(plot,err)
예제 #2
0
파일: PangleOTF.py 프로젝트: mauch/Obit-1
    plot.List.set("TITLE","Pixel %d %d, RM=%6.2f (%5.2f)"\
                  %(pixel[0],pixel[1], RMParms[0], RMParms[2]))
    plot.List.set("YLABEL", "EVPA (deg)")
    plot.List.set("CSIZE", 1)
    plot.List.set("SSIZE", 3)
    plot.List.set("LWIDTH", 3)
    OPlot.PXYErr(plot, 2, l2, phs, ephs, err)
    # Plot RM fit - a few times
    noff = 7
    offs = [0.0, 180, -180., 360., -360, 540. - 540.]
    for off in offs:
        x1 = lamb2[0] - refLamb2
        y1 = math.degrees(RMParms[1] + RMParms[0] * x1) + off
        x2 = lamb2[nspec - 1] - refLamb2
        y2 = math.degrees(RMParms[1] + RMParms[0] * x2) + off
        OPlot.PDrawLine(plot, lamb2[0], y1, lamb2[nspec - 1], y2, err)
    # Plot fractional poln
    plot.List.set("TITLE", " ")
    plot.List.set("XLABEL", "#gl#u2#d (m#u2#d)")
    plot.List.set("YLABEL", "frac. pol.")
    plot.List.set("XMAX", lamb2[0])
    plot.List.set("XMIN", lamb2[nspec - 1])
    plot.List.set("YMIN", 0.0)
    plot.List.set("YMAX", 0.6)
    OPlot.PXYErr(plot, 2, lamb2, fpol, efpol, err)
    PLPLOTOPlot.PShow(plot, err)
# end loop over pixels

# Shutdown Obit
OErr.printErr(err)
OSystem.Shutdown(ObitSys)