Esempio n. 1
0
def PlotMapsSet(r,
                pref="plots/temp",
                post=".png/PNG",
                s=4e-4,
                eqrange=False):

    "Plot a set of model maps"

    """
    s:       bounding box scale
    eqrange: if true, plot all maps to same range
    """

    if eqrange:
        lmax= [ m.max() for m in r]
        lmin= [ m.min() for m in r]
        valrange=[ min(lmin), max(lmax) ]
    else:
        valrange=None

    for i,mid  in enumerate( ["infoc",
                              "-ve",
                              "+ve"]):
        implot.plotmap(r[i],
                       bbox=[x * s for x in [-1,1,-1,1]] ,
                       fout=pref+mid+post,
                       colmap="heat",
                       valrange=valrange)
Esempio n. 2
0
def PlotMapsSet(r,
                pref="plots/temp",
                post=".png/PNG",
                s=4e-4,
                eqrange=False):

    "Plot a set of model maps"

    """
    s:       bounding box scale
    eqrange: if true, plot all maps to same range
    """

    if eqrange:
        lmax= [ m.max() for m in r]
        lmin= [ m.min() for m in r]
        valrange=[ min(lmin), max(lmax) ]
    else:
        valrange=None

    for i,mid  in enumerate( ["infoc",
                              "-ve",
                              "+ve"]):
        implot.plotmap(r[i],
                       bbox=[x * s for x in [-1,1,-1,1]] ,
                       fout=pref+mid+post,
                       colmap="heat",
                       valrange=valrange,
                       transf=2,
                       #contours=r[i].max() * (numpy.array([1.0, 0.8, 0.4, 0.1]))
                       
         )
        print list(r[i].max() * 2**(-1*numpy.arange(8)))
Esempio n. 3
0
def PlotGBTDefocus():

    apmod, tel = MkGBT()

    phasemap=pyplot.Map( apmod.getphase() )
    phasemap.mult(0)
    
    tel.MkDefocus(35e-3, phasemap)
    phasemap.add(-1.0 * phasemap.getv( phasemap.nx/2, phasemap.ny/2)  )    

    mask = pyoof.Clone(phasemap)
    tel.DishMask(mask)

    phasemap.mult(mask)    

    nlevels=7
    contours=[ phasemap.min() * (i+1)/float(nlevels+1) for i in range(nlevels)  ]
    
    for ext in ["png/PNG" ] :
        implot.plotmap(phasemap,
                       bbox=[x * 60 for x in [-1,1,-1,1]] ,
                       fout="plots/gbtdefocus."+ext ,
                       colmap="heat",
                       valrange=None,
                       contours=contours,
                       contcolour=0)
Esempio n. 4
0
def PlotZernFile( fnamein,
                  fnameout,
                  npix=256,
                  telgeo=pyoof.GBTGeo(),
                  phaserange=None,
                  plotwedge=True):

    #Should convert this to use MkApFile
    m = pyplot.Map(npix,npix)
    pyplot.MkApCS(m, telgeo.DishEffRadius() * 1.05)

    zm = pyoof.RZernModel ( 5 , m , telgeo )

    md=pybnmin1.ModelDesc(zm.downcast())

    bnmin1io.FLoad( md, fnamein, silent=True)

    for zn in ["z1" ,"z2"  ] :
        md.getbyname(zn).setp(0)

    zm.Calc(m)

    implot.plotmap( m,
                    fnameout,
                    colmap="heat",
                    contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2],
                    valrange=phaserange,
                    plotwedge=plotwedge)
    return m
Esempio n. 5
0
def PlotSimDrizzleBeams(obsfilename, beamfilename,
                        dirout,
                        prefix="simdrizbeam",
                        fwhm=1.0, extent=2.0,
                        oversample=2.0,
                        npix=128,
                        bbox=None,
                        ncont=None,
                        hardcopy=False,
                        decorate=True):

    "Create a simulated ds from model beams and then drizzle"

    ds = oofreduce.SimBeamDS(obsfilename, beamfilename)

    if hardcopy : end=".eps/CPS"
    else:         end=".png/PNG"

    for i in range(len(ds)):
        skym=MkFFMap(obsfilename, npix=npix, oversample=oversample)
        pyplot.SimpleDrizzle( ds[i], skym, fwhm , extent)
        implot.plotmap(skym,
                       fout=os.path.join(dirout,
                                         prefix + "-%i%s" % (i, end) ),
                       colmap="heat",
                       bbox=bbox,
                       contours=ncont and implot.MkChopContours(skym, nlevels=ncont),
                       plotbox=decorate,
                       plotwedge=decorate
                       )
Esempio n. 6
0
def PlotAperture(apmod,
                 pref,
                 post=".png/PNG",
                 contour=False):

    s=12

    if contour:
        contours=implot.MkChopContours(pyplot.Map(apmod.getphase()),
                                       ctype="lin", nlevels=5)
    else:
        contours=None    

    implot.plotmap(pyplot.Map(apmod.getphase()),
                   bbox=[x * s for x in [-1,1,-1,1]] ,
                   fout=pref+"-phase"+post ,
                   colmap="heat",
                   valrange=None,
                   contours=contours,
                   contcolour=0)

    implot.plotmap(pyplot.Map(apmod.getamp()),
                   bbox=[x * s for x in [-1,1,-1,1]] ,
                   fout=pref+"-amp"+post ,
                   colmap="heat",
                   valrange=None)
Esempio n. 7
0
def WhyDefocus(npix=256, zn=7, err=1,
               rnoise=0,
               pref="plots",
               valrange=[0,3e5]):

    tel1 = MkSimpleTel()
    m = pyplot.Map(npix, npix)
    mperf = pyplot.Map(npix, npix)
    
    apmod = pyoof.MkSimpleAp( tel1,
                              1e-3,
                              npix,
                              5,
                              4)

    amm=pybnmin1.ModelDesc( apmod.downcast() )
    amm.getbyname("z%i" % zn).setp(err)

    apmodperf = pyoof.MkSimpleAp( tel1,
                              1e-3,
                              npix,
                              5,
                              4)

    ammperf=pybnmin1.ModelDesc( apmodperf.downcast() )
    
    bbox= [-0.005, 0.005, -0.005,0.005]
    for cdz in [ 0 , 0.5  , 1 , 2 , 5]:
        amm.getbyname("z4" ).setp(cdz)
        ammperf.getbyname("z4" ).setp(cdz)

        farf= pyoof.FarF ( apmod.getphase(),
                           1e-3)

        farf.Power( apmod.getamp(), apmod.getphase(),  m)
        farf.Power( apmodperf.getamp(), apmodperf.getphase(),  mperf)

        #use this to add random noise:
        if cdz == 0:
            maxlevel=mperf.max()

        if rnoise != 0:
            mnoise=pyplot.Map(npix, npix)
            pyplot.NormDist(mnoise, maxlevel * rnoise)
            m.add(mnoise)
        
        implot.plotmap( m,
                        colmap="heat",
                        fout=os.path.join(pref,
                                          "LWhydefocux-zn%i-dz%g-n%g.png/PNG" % ( zn , cdz, rnoise ) ),
                        bbox=bbox,
                        valrange=valrange)

        mperf.mult(-1)
        m.add(mperf)
        implot.plotmap( m,
                        colmap="heat",
                        fout=os.path.join(pref,
                                          "LDiffWhydefocux-zn%i-dz%g-n%g.png/PNG" % ( zn , cdz, rnoise )),
                        bbox=bbox)
Esempio n. 8
0
def PlotZern(nmax=6,
             contour=False):

    npix = 512
    tel1 = MkSimpleTel()
    
    m = pyplot.Map(npix, npix)
    pyplot.MkApCS(m, 1.2)

    mask = pyplot.Clone(m)
    tel1.DishMask(mask)

    for n in range(1,nmax):
        for i in range (0, n+1 ):
            l= -n + 2*i

            zfn=pybnlib.ZernPoly(n,l)
            pyplot.WorldSet( m , zfn)
            m.mult( mask)
            if contour:
                contours=implot.MkChopContours(m, ctype="lin", nlevels=5)
            else:
                contours=None
            implot.plotmap( m,
                            fout="plots/ZPoly-%i%i.png/PNG" % (n,l),
                            colmap="heat",
                            contours=contours,
                            contcolour=0)
Esempio n. 9
0
def IllustratePerfectApFFT():

    apmod=MkApModel(2)
    amm=pybnmin1.ModelDesc( apmod.downcast() )

    #Set taper to -12 db @edge
    amm.getbyname("sigma").setp(0.36)
    amm.getbyname("z0").setp(1)

    farf=pyoof.FarF ( apmod.getphase(),
                      1e-3)

    fa= pyplot.Map(apmod.getphase().nx,apmod.getphase().ny)
    fp= pyplot.Map(apmod.getphase().nx,apmod.getphase().ny)

    farf.AmpPhase( apmod.getamp(),
                   apmod.getphase(),
                   fa,
                   fp)
    s=4e-4
    implot.plotmap(fa,
                   bbox=[x * s for x in [-1,1,-1,1]] ,
                   fout="plots/perfect_farf_a.png/PNG",
                   colmap="heat",
                   valrange=None )
    implot.plotmap(fp,
                   bbox=[x * s for x in [-1,1,-1,1]] ,
                   fout="plots/perfect_farf_p.png/PNG",
                   colmap="heat",
                   valrange=None )    
Esempio n. 10
0
def PlotGBTDefocusedBeam( difference=False):

    apmod, tel = MkGBT(over=8)
    


    for dz in [0 , -35, 35]:

        phasemap, res = MkDefocusBeam( dz , apmod, tel,
                                       difference=difference)

        contours=implot.MkChopContours(res,
                                       ctype="log",
                                       nlevels=8)
        if difference:
            fnameout= "plots/gbtsingledefoc%g-diff.png/PNG" % dz
        else:
            fnameout= "plots/gbtsingledefoc%g.png/PNG" % dz

        implot.plotmap(res,
                       bbox=[x * 8e-4 for x in [-1,1,-1,1]] ,
                       fout=fnameout,
                       colmap="heat",
                       valrange=None,
                       contours=contours,
                       contcolour=0)
Esempio n. 11
0
def PlotObitMUSTANG(sno):

    fnamein = "/home/bn204/d/data/oof/gbt/mustang/obit/OOF/0854+2006.%i.CalImage.fits" % sno

    m = pyplot.FitsMapLoad(fnamein, 1)
    pyplot.ReplaceInfNaN(m, 0)

    implot.plotmap(m, colmap="heat")
Esempio n. 12
0
def PlotNoiseSims():

    for x in ["01", "05", "10"]:
        m1=pyplot.FitsMapLoad( "oofout/sim-%s-000/z4/aperture.fits" % x,
                               2)

        implot.plotmap(m1,
                       bbox=[xm * 6 for xm in [-1,1,-1,1]] ,
                       fout="plots/noise%sz4ap.png/PNG" % x,
                       colmap="heat",
                       valrange=[-1.0,1.0] )    
Esempio n. 13
0
def PlotAperture(apfname,
                 dirout,
                 prefix="aperture",
                 oversample=2.0,
                 hardcopy=False,
                 umicron=False):
    """
    Plot aperture phase and amplitude

    :param umicron: If true, plot in units of micron of normal surface
    error rather than radians of path.

    """
    phasemap=pyplot.FitsMapLoad(apfname,2)
    if umicron:
        wvl=float(pyfits.open(apfname)[0].header["WAVE"])
        phasemap.mult(1e6*wvl/4/math.pi)

    ampmap  =pyplot.FitsMapLoad(apfname,1)    

    bbox = implot.GetMapBBox(phasemap)
    bbox = [ x/oversample *1.05 for x in bbox]

    if hardcopy:
        end=".eps/PS"
        if umicron:
            contours=[-20.0,-15.0,-10.0,-5.0,0.0,5.0,10.0, 15.0, 20.0]
        else:
            contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2]
        colmap=None
    else:
        end=".png/PNG"
        if umicron:
            contours=[-20.0,-15.0,-10.0,-5.0,0.0,5.0,10.0, 15.0, 20.0]
        else:
            contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2]
        colmap="heat"

    implot.plotmap( phasemap,
                    fout=os.path.join(dirout,
                                      prefix+"-phase"+end),
                    bbox=bbox,
                    colmap=colmap,
                    contours=contours,
                    contcolour=0,
                    title=apfname)

    implot.plotmap( ampmap,
                    fout=os.path.join(dirout,
                                      prefix+"-amplitude"+end),
                    bbox=bbox,
                    colmap=colmap   )
Esempio n. 14
0
def BumpPlot(m,fnameout):

    implot.plotmap( m,
                    os.path.join("plots/bump", fnameout+".png/PNG"),
                    colmap="heat",
                    contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2],
                    valrange=[-2,2],
                    plotwedge=False)

    implot.plotmap( m,
                    os.path.join("plots/bump", fnameout+".eps/CPS"),
                    colmap="heat",
                    contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2],
                    valrange=[-2,2],
                    plotwedge=False                    
                    )
Esempio n. 15
0
def plotscan(fnamein,
             d=0.03):
    fnameout=os.path.basename(os.path.split(fnamein)[1])+".png/PNG"
    fin=pyfits.open(fnamein)
    mc=[float(fin[0].header["CRVAL1"]), float(fin[0].header["CRVAL2"])]
    m=pyplot.FitsMapLoad(fnamein, 1)
    implot.plotmap(m,
                   valrange=[0,m.max_fin()], 
                   colmap="heat", 
                   bbox=[mc[0]-d, 
                         mc[0]+d, 
                         mc[1]-d, 
                         mc[1]+d],   
                   contours=implot.MkSynthesisContours(m, 
                                                       step=0.5,
                                                       nlevels=9),
                   fout=fnameout)
Esempio n. 16
0
def PlotZernDict(d,
                 fnameout,
                 npix=256,
                 telgeo=pyoof.GBTGeo(),
                 phaserange=None,
                 plotwedge=True):
    """
    Plot aperture phase distribution from a dictionary of Zernike
    polynomial coefficients.
    
    :param d: dictionary with zernike coefficients, in OOF numbering
    convention; i.e., { "z4" : 1.0 } means one radian of classical
    defocus

    :param fnameout: Name of file to plot to; PGPLOT convention
    
    :param npix: Size of map in pixels to rasterise the aperture on
    
    :param telgeo: Telescope geometry (used just for dish radius)

    :returns: the plotted map

    """

    m = pyplot.Map(npix,npix)
    pyplot.MkApCS(m, telgeo.DishEffRadius() * 1.05)

    zm = pyoof.RZernModel (5, 
                           m, 
                           telgeo )

    md=pybnmin1.ModelDesc(zm.downcast())
    for k in d.keys():
        if k not in ["z1", "z2"] and k[0]=="z":
            md.getbyname(k).setp(float(d[k]))

    zm.Calc(m)

    implot.plotmap( m,
                    fnameout,
                    colmap="heat",
                    contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2],
                    valrange=phaserange,
                    plotwedge=plotwedge)
    return m
Esempio n. 17
0
def PlotDiff():

    m1=oofplot.PlotZernFile( "bump/rhbumphalfoof.fits" , "test.png/PNG" )
    m2=PlotD2()

    m1.mult(1)
    m2.add(m1)

    i1    = oofplot.PlotIllumFile( "oofoutTPTCSOOF_060330/s42-l-db-000/z5/fitpars.fits",
                                   "temp/amp.png/PNG")

    print "WRMS: " , pyplot.MapRMS(m2, i1 )

    implot.plotmap( m2,
                    "plots/halfbumpdiff.png/PNG",
                    colmap="heat",
                    contours=[-2,-1.5,-1,-0.5,0,0.5,1,1.5,2],
                    valrange=[-2,2])
Esempio n. 18
0
def PlotDSFile( fnamein,
                dirout,
                prefix="beam",
                npix=128,
                oversample=2.0,
                fwhm=2.0,
                extent=4.0,
                bbox=None,
                ncont=None,
                hardcopy=False,
                decorate=True
               ):
    "Plot beams contained in a dataseries file"

    fin=pyfits.open(fnamein)

    m= MkFFMap( fnamein, npix=npix, oversample=oversample)

    #Create the output directory if necessary
    if not os.path.exists(dirout):
        os.makedirs(dirout)

    if hardcopy : end=".eps/CPS"
    else:         end=".png/PNG"        

    for i in range(1,len(fin)):
        ds1=pyplot.LoadFITSDS(fnamein,i+1)

        pyplot.SimpleDrizzle( ds1, m, fwhm , extent)    
        implot.plotmap( m,
                        fout=os.path.join(dirout,
                                          prefix + "-%i%s" % (i, end) ),
                        colmap="heat",
                        bbox=bbox,
                        contours=ncont and implot.MkChopContours(m, nlevels=ncont),
                        plotbox=decorate,
                        plotwedge=decorate)
Esempio n. 19
0
def PlotIllumFile( fnamein,
                   fnameout,
                   npix=256,
                   telgeo=pyoof.GBTGeo()):

    "Plot illumination from a paremeter file"

    #Should convert this to use MkApFile
    m = pyplot.Map(npix,npix)
    pyplot.MkApCS(m, telgeo.DishEffRadius() * 1.05)

    im = pyoof.GaussAmpMod ( telgeo , m  )

    md=pybnmin1.ModelDesc(im.downcast())

    bnmin1io.FLoad( md, fnamein, silent=True)

    im.Calc(m)

    implot.plotmap( m,
                    fnameout,
                    colmap="heat"                  )

    return m
Esempio n. 20
0
def PSFSeq():
    acc=pyplot.Map(128,128)
    for o in range(0,200,10):
        mm=PSF(0.15,o*3)
        implot.plotmap(mm, transf=2, 
                       colmap="heat",
                       fout="plots/psf-seq-%03i.png/PNG" % o)
        acc.add(mm)
        m2=pyplot.MapSubset(m1, o, o+128, 0, 128)    
        m2.mult(0.15)
        implot.plotmap(m2, transf=2, 
                       colmap="heat",
                       fout="plots/screen-seq-%03i.png/PNG" % o)

    implot.plotmap(acc, transf=2, 
                   colmap="heat",
                   fout="plots/psf-accum.png/PNG")
Esempio n. 21
0
def ZernPower(zn , dz):

    ""
    npix = 512
    tel1 = MkSimpleTel()
    m = pyplot.Map(npix, npix)
    
    apmod = pyoof.MkSimpleAp( tel1,
                              1e-3,
                              npix,
                              5,
                              4)

    amm=pybnmin1.ModelDesc( apmod.downcast() )
    amm.getbyname("z%i" % zn).setp(1)
    amm.getbyname("sigma" ).setp(100)

    for cdz in [ 0 , dz, -1* dz]:
        amm.getbyname("z4" ).setp(cdz)

        apbox=[-1.1,1.1,-1.1,1.1]

        farf= pyoof.FarF ( apmod.getphase(),
                           1e-3)
        implot.plotmap(apmod.getphase(), 
                       colmap="heat",
                       fout="plots/phase.png/PNG",
                       bbox=apbox,
                       transf=0)
        implot.plotmap(apmod.getamp(), 
                       colmap="heat",
                       fout="plots/amplitude.png/PNG",
                       bbox=apbox)

        farf.Power( apmod.getamp(), apmod.getphase(),  m)
        implot.plotmap( m, colmap="heat",
                        fout="plots/ZPpower-zn%i-dz%g.png/PNG" % ( zn , cdz ),
                        bbox=[-0.007, 0.007, -0.007,0.007])
Esempio n. 22
0
scratch = pyplot.Map(npix, npix)
pyplot.MkApCS(scratch, ParentRadius * 1.2)

piston = pyplot.Map(npix, npix)
pyplot.MkApCS(piston, ParentRadius * 1.2)
pzfn = pybnlib.ZernPoly(0, 0)
pyplot.WorldSet(piston, pzfn)

zfn = pybnlib.ZernPoly(1, 1)
pyplot.WorldSet(scratch, zfn)
scratch.mult(wholetilt)
m.add(scratch)
m.mult(mask)

implot.plotmap(m, colmap="heat", fout="gbtil/wholeap.eps/CPS", contours=implot.MkChopContours(m, ctype="lin"))

th1 = pybnlib.TopHatDD()
th1.x0 = 0.5 * ParentRadius
th1.y0 = 0
th1.radius = 0.5 * ParentRadius
mask1 = pyoof.Clone(m)
pyplot.WorldSet(mask1, th1)
piston.mult(-6e-3)
m.add(piston)
m.mult(mask1)


implot.plotmap(m, colmap="heat", fout="gbtil/apX.eps/CPS", contours=implot.MkChopContours(m, ctype="lin", nlevels=8))

tel1.MkFocMove(0.01, 0, 0, m)
Esempio n. 23
0
File: t2.py Progetto: bnikolic/oof
tel1.DishMask(m)

if 1:
    fftf=pyplot.FFTFact( m.nx , m.ny  , pyplot.FFTFact.forward , pyplot.FFTFact.center)
    m2 = pyplot.Map(128,128)
    m3 = pyplot.Map(128,128)
    fftf.FFTAmpPh_Power(m, m2 , m3)

#implot.plotmap(m3, colmap="heat", transf=1)

if 0:
    ds1=pyplot.LoadFITSDS("/home/bnikolic/temp/s114-l-db.fits",3)
    m4 = pyplot.Map(128,128)
    pyplot.MkApCS(m4, 4.8e-6*100)
    pyplot.SimpleDrizzle( ds1, m4, 5 , 3)
    implot.plotmap( m4, colmap="heat")


if 0:
    mlc= pyplot.LCMaps()
    pyplot.NormDist(m, 1)
    mlc.AddMap(m)

    pyplot.NormDist(m, 1)
    mlc.AddMap(m)

    mlc.setc(0,1)
    mlc.Calc(m)
    implot.plotmap( m, colmap="heat")

Esempio n. 24
0
def SHil(o=0):
    """
    Illustrate Shack-Hartman principle
    """
    m2=pyplot.MapSubset(m1, o, o+128, 0, 128)    
    m2.mult(0.03)
    mres=pyplot.Map(128,128)
    implot.plotmap(m2, colmap="heat", fout="plots/sh-screen-phase.png/PNG")
    implot.plotmap(ma, colmap="heat", fout="plots/sh-screen-amplitude.png/PNG")
    ff.FFTAmpPh_Power(ma, m2, mres)
    implot.plotmap(mres, transf=2,colmap="heat", fout="plots/sh-psfwhole.png/PNG")

    ma2=mkAmp(128, radius=0.2)
    implot.plotmap(ma2, colmap="heat", fout="plots/sh-screen-amplitude-l1.png/PNG")
    ff.FFTAmpPh_Power(ma2, m2, mres)
    implot.plotmap(mres, transf=2,colmap="heat", fout="plots/sh-psfl1.png/PNG")

    ma2=mkAmp(128, radius=0.1)
    implot.plotmap(ma2, colmap="heat", fout="plots/sh-screen-amplitude-l2.png/PNG")
    ff.FFTAmpPh_Power(ma2, m2, mres)
    implot.plotmap(mres, transf=2,colmap="heat", fout="plots/sh-psfl2.png/PNG")

    for i in range(7):
        for j in range(7):
            y0=-0.4+0.2*j
            ma2=mkAmp(128, radius=0.1, 
                      x0=-0.4+0.2*i,
                      y0=y0)
            print y0
            implot.plotmap(ma2, colmap="heat", fout="plots/sh-screen-amplitude-ll%i-%i.png/PNG" % (i,j))
            ff.FFTAmpPh_Power(ma2, m2, mres)
            implot.plotmap(mres, transf=0,colmap="heat", fout="plots/sh-psfll-%i-%i.png/PNG" % (i,j), 
                           contours=implot.MkSynthesisContours(mres, step=0.5, nlevels=4),
                           bbox=[40,88,40,88])
Esempio n. 25
0
import numarray
from matplotlib import pylab

if 0:
    m = pyplot.Map(128,128)
    x=pyplot.dFresnelDir( m, 64, 64, 100)

tel=pyoof.TelSwitch("ALMA")

mamp=pyoof.MkApMap(tel, 128, 2.0)
ilmod=pyoof.GaussAmpMod( tel, mamp)
ilmod.SetSigma(0.3)
ilmod.Calc(mamp)
m3=pyplot.Map(mamp)
implot.plotmap(m3)

mphase=pyoof.MkApMap(tel, 128, 8.0)
ms    =pyoof.MkApMap(tel, 128, 8.0)

fftf=pyplot.FFTFact( m3.nx , m3.ny  , pyplot.FFTFact.forward , pyplot.FFTFact.center)


def P2norm(b1, b2):

    [ pylab.plot( abs(x)**2 / (abs(x)**2).max()) for x in [b1,b2] ]
    pylab.show()
    

def PFren( R):
    x3=numarray.array( [ pyplot.dFresnelDir( m3, i, 64, 1e10) for i in range(0,128) ])
Esempio n. 26
0
    if 0:
        mphase = mkALMAAperture(phaserms=[1], errscale=[0.25], justPhase=True)
        implot.plotmap(mphase, transf=0, colmap="heat", fout="sample-phase.png/PNG")

        mphase = mkALMAAperture(phaserms=[1], errscale=[1.0], justPhase=True)
        implot.plotmap(mphase, transf=0, colmap="heat", fout="sample-phase-ls.png/PNG")


if 0:
    # Creates a pair of maps which represent the the aperture plane
    # phase and amplitude distributions
    mphase = mkALMAAperture(phaserms=[0.4, 0.4], errscale=[1.0, 0.4], justPhase=True)
    mamp = getAmpMap("vertex", 512)

    # Plot the phase map
    implot.plotmap(mphase, transf=0, colmap="heat")
    # Plot the amplitude
    implot.plotmap(mphase, transf=0, colmap="heat")
    # Create the object that transforms the aperture plane
    # distribution to far field. The second parameter is the
    # wavelenght of the radiation
    farf = pyoof.FarF(mamp, 3.5e-3)
    # Create a map to store the far field pattern in
    mbeam = pyplot.Map(512, 512)
    # Compute the far-field power pattern
    farf.Power(mamp, mphase, mbeam)
    # Plot the beam as on log-scale (second parameter, it has the same
    # meaning as the convention in PGPLOT)
    implot.plotmap(mbeam, transf=1, colmap="heat")
    # Convolve with a Moon simulation
    mb3 = mkMoonSim(mbeam)
Esempio n. 27
0
def plotTechFigs():

    if 0:
        m = getAmpMap("vertex", 512)
        implot.plotmap(m, colmap="heat", bbox=[-6, 6, -6, 6], fout="vertex-amp.png/PNG")
        m = getAmpMap("melco12", 512)
        implot.plotmap(m, colmap="heat", bbox=[-6, 6, -6, 6], fout="melco12-amp.png/PNG")

    if 1:
        mphase = mkALMAAperture(phaserms=[0.4, 0.4], errscale=[1.0, 0.4], justPhase=True)
        mamp = getAmpMap("vertex", 512)
        farf = pyoof.FarF(mamp, 1.3e-3)
        mbeam = pyplot.Map(512, 512)
        farf.Power(mamp, mphase, mbeam)
        implot.plotmap(mbeam, transf=1, colmap="heat", fout="sample-beam.png/PNG")

        mb3 = mkMoonSim(mbeam)
        # Plot the beam as on log-scale
        implot.plotmap(mb3, transf=1, colmap="heat", fout="sample-moonconv.png/PNG")

    if 0:
        mphase = mkALMAAperture(phaserms=[1], errscale=[0.25], justPhase=True)
        implot.plotmap(mphase, transf=0, colmap="heat", fout="sample-phase.png/PNG")

        mphase = mkALMAAperture(phaserms=[1], errscale=[1.0], justPhase=True)
        implot.plotmap(mphase, transf=0, colmap="heat", fout="sample-phase-ls.png/PNG")
Esempio n. 28
0
# Tests/illustrations of the parametrised geometry

from setup import *

import pyoof


import pyplot
import pyoof
import implot





R=3
g=pyoof.ParamGeo(R, pyoof.ParsetVect( [ pyoof.ParPair("z3", 1.9) ]))

npix=512
m = pyplot.Map(npix, npix)
pyplot.MkApCS(m, R * 1.2)

g.MkDefocus(1, m)

implot.plotmap(m, colmap="heat", 
               contours=implot.MkChopContours(m, ctype="lin"),
               plotbox=False
)
Esempio n. 29
0
File: t3.py Progetto: bnikolic/oof
def pb(oc,i):

    m = oc.Beam(i)
    mm = pyplot.Map(m)
    implot.plotmap(mm, colmap="heat")
Esempio n. 30
0
def plotmapmc():
    for i in range(10):
        implot.plotmap(MkIllMap(64, 0.5), "o/gauss-5-%i.eps/CPS" % i, colmap="heat")