Example #1
0
def passrotPat():
    """Test passive rotation of a pattern. There are two sub-requests possible
    and two input configs: full 3D output of 2D-cuts with input, single-pol
    pattern or dual-pol.
    """
    def doTrack():
        #(thetas, phis) = pntsonsphere.cut_az(0.*math.pi/2) #Good for some tests.
        (thetas, phis) = pntsonsphere.cut_theta(10.0/180*math.pi)
        try:
            E_ths, E_phs = ant.getFFalong(1.0, (thetas, phis))
            tvecfun.plotAntPat2D(thetas, E_ths, E_phs, freq=0.5)
        except:
            freq=30e6
            jones = ant.getJonesAlong([freq], (thetas, phis))
            j00=jones[...,0,0].squeeze()
            j01=jones[...,0,1].squeeze()
            tvecfun.plotAntPat2D(phis, j00, j01, freq)
            j10=jones[...,1,0].squeeze()
            j11=jones[...,1,1].squeeze()
            tvecfun.plotAntPat2D(phis, j10, j11, freq)

    def do3D():
        cutphis = numpy.arange(0, 2*math.pi, .2)
        nrLngs = len(cutphis)
        dims = (100, nrLngs)
        THETA = numpy.zeros(dims)
        PHI  = numpy.zeros(dims)
        E_TH = numpy.zeros(dims, dtype=complex)
        E_PH = numpy.zeros(dims, dtype=complex)
        for (cutNr, cutphi) in enumerate(cutphis):
            (thetas, phis) = pntsonsphere.cut_theta(cutphi)
            E_ths, E_phs = ant.getFFalong(0.0, (thetas, phis))
            THETA[:,cutNr] = thetas
            PHI[:,cutNr] = phis
            E_TH[:,cutNr] = E_ths
            E_PH[:,cutNr] = E_phs
        tvecfun.plotvfonsph(THETA, PHI, E_TH, E_PH, projection='equirectangular')

    #Get a simple linear dipole along y.
    singpol = True
    if singpol:
        ant = gen_simp_RadFarField()
        #ant = antpat.theoreticalantennas.max_gain_pat(4)[0]
    else:
        dpath=dreambeam.__path__[0]+'/telescopes/LOFAR/data/'
        ha = HamakerPolarimeter(pickle.load(open(dpath+'HA_LOFAR_elresp_LBA.p', 'rb')))
        ant = DualPolElem(ha)

    rotang = 1.*math.pi/4.
    rotmat = pntsonsphere.rot3Dmat(0.0, 0.0*math.pi/2, 0.1*math.pi/2)
    #Rotate the antenna 90 deg.
    print(rotmat)
    ant.rotateframe(rotmat)
    #Choose between next 2 lines:
    #doTrack()
    do3D()
Example #2
0
def dualpolelem_2FF():
    """Test plot of a dual-polarized antenna where one channel is given
    by Psi and the other is a rotated copy it."""
    T, P = pntsonsphere.sphericalGrid()
    dipX = numpy.array(vsh.Psi(1, 1, T, P))+numpy.array(vsh.Psi(1, -1, T, P))
    dipXT = numpy.squeeze(dipX[0,:,:])
    dipXP = numpy.squeeze(dipX[1,:,:])
    freq = 1.0
    vfdipX = tvecfun.TVecFields(T, P, dipXT, dipXP, freq)
    antp = RadFarField(vfdipX)
    antq = antp.rotate90()
    dualpolAnt = DualPolElem(antp, antq)
    rotmat = pntsonsphere.rotzmat(0*math.pi/4)
    dualpolAnt.rotateframe(rotmat)
    dualpolAnt.plotJonesPat3D(freq, projection='azimuthal-equidistant', cmplx_rep='ReIm', )
Example #3
0
def dualpolelem_2FF():
    """Test plot of a dual-polarized antenna where one channel is given
    by Psi and the other is a rotated copy it."""
    T, P = pntsonsphere.sphericalGrid()
    dipX = numpy.array(vsh.Psi(1, 1, T, P)) + numpy.array(vsh.Psi(1, -1, T, P))
    dipXT = numpy.squeeze(dipX[0, :, :])
    dipXP = numpy.squeeze(dipX[1, :, :])
    freq = 1.0
    vfdipX = tvecfun.TVecFields(T, P, dipXT, dipXP, freq)
    antp = RadFarField(vfdipX)
    antq = antp.rotate90()
    dualpolAnt = DualPolElem(antp, antq)
    rotmat = pntsonsphere.rotzmat(0 * math.pi / 4)
    dualpolAnt.rotateframe(rotmat)
    dualpolAnt.plotJonesPat3D(
        freq,
        projection='azimuthal-equidistant',
        cmplx_rep='ReIm',
    )
Example #4
0
def passrotPat():
    """Test passive rotation of a pattern. There are two sub-requests possible
    and two input configs: full 3D output of 2D-cuts with input, single-pol
    pattern or dual-pol.
    """
    def doTrack():
        #(thetas, phis) = pntsonsphere.cut_az(0.*math.pi/2) #Good for some tests.
        (thetas, phis) = pntsonsphere.cut_theta(10.0 / 180 * math.pi)
        if type(ant) is not DualPolElem:
            E_ths, E_phs = ant.getFFalong(1.0, (thetas, phis))
            tvecfun.plotAntPat2D(thetas, E_ths, E_phs, freq=0.5)
        else:
            freq = 30e6
            jones = ant.getJonesAlong([freq], (thetas, phis))
            j00 = jones[..., 0, 0].squeeze()
            j01 = jones[..., 0, 1].squeeze()
            tvecfun.plotAntPat2D(phis, j00, j01, freq)
            j10 = jones[..., 1, 0].squeeze()
            j11 = jones[..., 1, 1].squeeze()
            tvecfun.plotAntPat2D(phis, j10, j11, freq)

    def do3D():
        cutphis = numpy.arange(0, 2 * math.pi, .2)
        nrLngs = len(cutphis)
        dims = (100, nrLngs)
        THETA = numpy.zeros(dims)
        PHI = numpy.zeros(dims)
        E_TH = numpy.zeros(dims, dtype=complex)
        E_PH = numpy.zeros(dims, dtype=complex)
        for (cutNr, cutphi) in enumerate(cutphis):
            (thetas, phis) = pntsonsphere.cut_theta(cutphi)
            if type(ant) is DualPolElem:
                freq = 30e6
                jones = ant.getJonesAlong([freq], (thetas, phis))
                j00 = jones[..., 0, 0].squeeze()
                j01 = jones[..., 0, 1].squeeze()
                j10 = jones[..., 1, 0].squeeze()
                j11 = jones[..., 1, 1].squeeze()
                # select y antenna
                E_ths = j10
                E_phs = j11
                vfname = 'Hamaker-Arts'
            else:
                freq = 0.0
                E_ths, E_phs = ant.getFFalong(freq, (thetas, phis))
                vfname = 'E-dipole y-directed'
            THETA[:, cutNr] = thetas
            PHI[:, cutNr] = phis
            E_TH[:, cutNr] = E_ths
            E_PH[:, cutNr] = E_phs
        tvecfun.plotvfonsph(THETA,
                            PHI,
                            E_TH,
                            E_PH,
                            freq=freq,
                            projection='equirectangular',
                            vfname=vfname)

    # Get a simple linear dipole along y.
    singpol = False
    if singpol:
        ant = gen_simp_RadFarField()
        # ant = antpat.theoreticalantennas.max_gain_pat(4)[0]
    else:
        dpath = dreambeam.__path__[0] + '/telescopes/LOFAR/data/'
        ha = HamakerPolarimeter(
            pickle.load(open(dpath + 'HA_LOFAR_elresp_LBA.p', 'rb')))
        ant = DualPolElem(ha)

    rotang = 1. * math.pi / 4.
    rotmat = pntsonsphere.rot3Dmat(0.0, 0.0 * math.pi / 2, 1.5 * math.pi / 2)
    # Rotate the antenna 90 deg.
    print(rotmat)
    ant.rotateframe(rotmat)
    # Choose between next 2 lines:
    # doTrack()
    do3D()