示例#1
0
def PlotElScan(fnamein, fnameout ):

    eloff, tant, modtant = LoadElScanData(fnamein)

    pyxplot.vect( [ eloff, eloff],
                  [ tant, modtant],
                  fnameout,
                  yax=pyxplot.axis(r"$T_{\rm Ant}\,({\rm K})$", xmin=82, xmax=90),
                  xax=pyxplot.axis(r"$\delta E\,({\rm arcmin})$",xmin=-1.5, xmax=1.5),
                  multi=True)
示例#2
0
def CmpRandomV2():

    obsd=pyfits.open("moonscand/obs79.fits")[1].data

    m250 = pyfits.open("moonscand/model500rms.fits")[1].data

    pyxplot.vect( [ obsd.field("dx") , m250.field("dx")] ,
                  [ obsd.field("fnu") - obsd.field("fnu").max() ,
                    m250.field("fnu") - m250.field("fnu").max()] ,
                  "plots/moonscanrandcom.eps",
                  xax=pyxplot.axis("Azimuth Offset (arcmin)",
                                   xmin=None, xmax=None),
                  yax=pyxplot.axis("Rel Gain  (B)"),
                  multi=1,
                  width=pyxplot.THESIS)    
示例#3
0
def PlotModDataR(modname, fnameout):

    obsd=pyfits.open("moonscand/obs75-right.fits")[1].data

    m250 = pyfits.open(modname)[1].data

    pyxplot.vect( [ obsd.field("dx") , m250.field("dx")] ,
                  [ obsd.field("fnu") - obsd.field("fnu").max() ,
                    m250.field("fnu") - m250.field("fnu").max()] ,
                  fnameout,
                  xax=pyxplot.axis("Azimuth Offset (arcmin)",
                                   xmin=None, xmax=None),
                  yax=pyxplot.axis("Rel Gain  (B)"),
                  multi=1,
                  width=pyxplot.THESIS)    
示例#4
0
def PlotObsData():

    dnorm= pyfits.open("moonscand/obs75_full.fits")[1].data
    drand= pyfits.open("moonscand/obs79_full.fits")[1].data

    pyxplot.vect( [ dnorm.field("dx") , drand.field("dx")] ,
                  [ dnorm.field("fnu") - dnorm.field("fnu").max() ,
                    drand.field("fnu") - drand.field("fnu").max()] ,
                  "plots/obsdata.eps",
                  xax=pyxplot.axis("Azimuth Offset (arcmin)",
                                   xmin=None, xmax=None),
                  yax=pyxplot.axis("Rel Gain  (B)",
                                   xmin=-3),
                  multi=1,
                  width=pyxplot.THESIS)
示例#5
0
文件: mustang.py 项目: bnikolic/oof
def PlotSignal(fnamein, pixel_l, fnameout, hdu=1, trange=None):

    din = pyfits.open(fnamein)[hdu].data
    xv, yv = [], []

    for c, r in pixel_l:
        mask = SelectCR(din, c, r)
        time = din.field("time")

        if trange is not None:
            mask = numarray.logical_and(mask, time >= trange[0])
            mask = numarray.logical_and(mask, time < trange[1])

        xv.append(time[mask])
        yv.append(din.field("fnu")[mask])

    pyxplot.vect(xv, yv, fnameout, multi=True, xax=pyxplot.axis(r"$t\,$(s)"), yax=pyxplot.axis(r"$F_{\nu}$"))
示例#6
0
def PlotSFN(r,
            fnameout,
            fid,
            **kwargs):

    mask = numarray.logical_and( r[:,1] > 0,
                                 r[:,2] > 0)
    xvals= r[:,0]
    yvals= (r[:,1])[mask]/(r[:,2])[mask]

    m2= (xvals > 0)
    yfid= 6.88* (xvals[m2]/float(fid))**(2.0/3)

    pyxplot.vect( [xvals[mask], xvals[m2] ],
                  [yvals, yfid      ],
                  fnameout,
                  xax=pyxplot.axis(r"$d$", type="log"),
                  yax=pyxplot.axis(r"$D(d)$", type="log", xmax=12),
                  multi=True)
示例#7
0
def PlotF( fnamelist,
           fnameout="plots/ruze.eps"):

    xvv, yvv = [] , []

    for fname in fnamelist:
        data=GetData(fname)
        xvv.append( data[0]  )
        yvv.append( data[1]  )
        print data[1].max() , data[1].min()


    pyxplot.vect( xvv,
                  yvv,
                  fnameout,
                  xax=pyxplot.axis("Azimuth Offset (arcmin)",
                                   xmin=-2, xmax=1),
                  yax=pyxplot.axis("Antenna T / Cal T"),
                  multi=1,
                  width=pyxplot.THESIS)
示例#8
0
def PrintEfficiencies():

    "Print predicted loss of efficiency due to total deformations"

    res =  []
    for scandir , obsds in izip(allscans , obsscans) :
        el=pyfits.open(obsds)[0].header["meanel"]
        
        res.append(  ( el,
                       OffsetEfficiency( scandir) ,
                       0.03,
                       scandir)
                     )
    res.sort()

    pyxplot.scatter( res,
                     "plots/offseteff.eps",
                     width=pyxplot.MNRAS_SC,
                     xax=pyxplot.axis(r"$E\,$(degrees)", xmin=0 , xmax=90),
                     yax=pyxplot.axis(r"$\eta_{\rm LSS}$"),
                     symbsize=0.1,
                     ploterrb=True)
示例#9
0
def PrintEfficiencies():

    "Print predicted loss of efficiency due to total deformations"

    res =  []
    for scandir , obsds in izip(allscans , obsscans) :
        el=pyfits.open(obsds)[0].header["meanel"]
        
        res.append(  ( el,
                       OffsetEfficiency( scandir) ,
                       scandir)
                     )
    res.sort()

    for x,y,z in res:
        print x,y,z

    pyxplot.scatter( res,
                     "plots/offseteff.eps",
                     width=pyxplot.THESIS,
                     xax=pyxplot.axis(r"$\theta\,$(deg)", xmin=0 , xmax=90),
                     yax=pyxplot.axis(r"$\epsilon_{\rm LSS}$"),
                     symbsize=0.05)
示例#10
0
def plotSinlgeParDist(din,
                      parname,
                      fnameout,
                      burn=0):
    """
    Plot the distribution of a single parameter
    """
    d=din.data.field(parname)
    x=d[burn*len(d):]
    pyxplot.histogram( [ (x, "")],
                       fnameout,
                       xax=pyxplot.axis(escapeAxisName(parname)),
                       width=pyxplot.MNRAS_SC,
                       nbins=20,
                       key=None)
示例#11
0
def ElHist():

    "Compute histogram of measured elevations"

    res =  []
    for scandir , obsds in izip(allscans , obsscans) :
        el=pyfits.open(obsds)[0].header["meanel"]
        
        res.append(el)

    res.sort()

    pyxplot.histogram( [ ( res , "" ) ],
                       "plots/el-hist.eps",
                       width=pyxplot.THESIS ,
                       key=None ,
                       nbins=9,
                       xax=pyxplot.axis(r"$\theta\,$(deg)", xmin=0 , xmax=90)
                       )
示例#12
0
def PlotGain( d,
              model,
              utmin=0,
              utmax=24,
              mineff=0.2,
              maxeff=0.5,
              src=None):

    def ProcD(d2):

        pt=[]
        md = {}

        for x in d2:
            if md.has_key(x[4] ):
                md[x[4]].append (  ( x[1 ] , x[2][0] , x[2][1]  ) )
            else:
                md[x[4]]= [ ( x[1 ] , x[2][0] , x[2][1]  ) ]

        for i,k in enumerate(md.keys()):
            print "Series %i  is %s " % ( i, k)
            pt.append( pyxplot.graph.data.list( md[k], x=1, y=2, dy=3))

        return pt
        
    if src == None:
        rcpnone = [ x for x in d if x[0]=="RCP" and x[3]==0 and x[5] > utmin and x[5] < utmax ]
        rcpv1 = [ x for x in d if x[0]=="RCP" and x[3]==model and x[5] > utmin and x[5] < utmax ]
    else:
        rcpnone = [ x for x in d if x[0]=="RCP" and x[3]==0 and x[5] > utmin and x[5] < utmax and x[4] ==src ]
        rcpv1 = [ x for x in d if x[0]=="RCP" and x[3]==model and x[5] > utmin and x[5] < utmax and x[4]==src]


    pt      = [ pyxplot.graph.data.list( rcpnone, x=1, y=2, dy=3),
                pyxplot.graph.data.list( rcpv1, x=1, y=2, dy=3),                
                ]

    c = canvas.canvas()
    
    gon = c.insert(pyxplot.graph.graphxy(width=pyxplot.MNRAS_SC,
                                          x=pyxplot.axis(r"$E\,$(degrees)",
                                                         xmin=0, xmax=90) ,
                                          y=pyxplot.axis(r"$\eta_{\rm a}$",
                                                         xmin=mineff, xmax=maxeff),
                                          ))
    gon.plot(ProcD(rcpv1),
             [ graph.style.symbol(graph.style.symbol.changesquare,
                                  symbolattrs=[deco.filled()]
                                  ),
               graph.style.errorbar()
               ]
             )

    goff  = c.insert(pyxplot.graph.graphxy(width=pyxplot.MNRAS_SC,
                                           ypos =gon.height+0.5,
                                           x=graph.axis.linkedaxis(gon.axes["x"]),
                                           y=pyxplot.axis(r"$\eta_{\rm a}$",
                                                          xmin=mineff, xmax=maxeff),
                                           ))

    goff.plot(ProcD(rcpnone),
             [ graph.style.symbol(graph.style.symbol.changesquare),
               graph.style.errorbar()
               ]
             )


    c.writetofile("plots/gaincurve.eps")
    c.writetofile("plots/gaincurve.pdf")

    gon=pyxplot.graph.graphxy(width=pyxplot.MNRAS_SC,
                              x=pyxplot.axis(r"$E\,$(degrees)",
                                             xmin=0, xmax=90) ,
                              y=pyxplot.axis(r"$\eta_{\rm a}$",
                                             xmin=mineff, xmax=maxeff),
                              )
    
    gon.plot(ProcD(rcpv1),
             [ graph.style.symbol(graph.style.symbol.changesquare,
                                  symbolattrs=[deco.filled()]
                                  ),
               graph.style.errorbar()
               ]
             )
             
    gon.writetofile("plots/gaincurve_on.pdf")

    goff  = pyxplot.graph.graphxy(width=pyxplot.MNRAS_SC,
                                  x=pyxplot.axis(r"$E\,$(degrees)",
                                                 xmin=0, xmax=90) ,
                                  y=pyxplot.axis(r"$\eta_{\rm a}$",
                                                 xmin=mineff, xmax=maxeff),
                                  )

    goff.plot(ProcD(rcpnone),
             [ graph.style.symbol(graph.style.symbol.changesquare),
               graph.style.errorbar()
               ]
             )
    goff.writetofile("plots/gaincurve_off.pdf")