Пример #1
0
def aipy_hp_beam(freq,nside,y=False,efield=False):
    # currently only works with scalar frequencies
    #for freq in freqs:
    #bm = prms['beam'](np.array([freq]),nside=nside,lmax=20,mmax=20,deg=7)
    #bm.set_params(prms['bm_prms'])
    px = np.arange(hp.nside2npix(nside))
    theta,phi = hp.pix2ang(nside,px)
    B = aipy_beam(freq,theta,phi,efield=efield)
    if y:
        B = rotmap(B,[90,0])
    #xyz = hp.pix2vec(nside,px)
    #poly = np.array([h.map[px] for h in bm.hmap])
    #Axx = np.polyval(poly,freq)
    #Axx = np.where(xyz[-1] >= 0, Axx, 0)
    #Axx /= Axx.max()
    #Axx = Axx*Axx
    return B
Пример #2
0
2) Avoid the weird singularities at the pole.  I really want this to
not suffer from numerical defects

"""
apod = False
paper = True
david = False

# This should be wrapped up in a map object
nside = 256
npix = hp.nside2npix(nside)
ipix = np.arange(npix)
theta,phi = hp.pix2ang(nside,ipix)

# Complete WAG
dipole_phase_x = np.exp(-1j*2.*rotmap(phi,[0,90]))
dipole_phase_y = np.exp(-1j*2.*rotmap(rotmap(phi,[0,90]),[90,0]))

D_z = np.sin(theta) # Actual dipole power response for z-oriented dipole
D_y = rotmap(rotmap(D_z,[0,90]),[90,0])
prefix = 'dipole'
if apod:
    prefix = 'apod_dipole'
    apod = rotmap(np.exp(-np.power(theta,2)),[0,-90])
    D_z = D_z * apod
    D_y = D_y * apod
if paper:
    prefix = 'paper'
    #A_paper_xx = (cst2hp('/Users/jaguirre/Documents/PAPER/2010_beam/sdipole_05e_eg_ffx_150.txt',filetype='rich',column=2))['bm128']
    D_z = bm.aipy_hp_beam(0.15,nside,efield=True)
    D_z = rotmap(D_z,[0,-90])
Пример #3
0
# A half-wave dipole along z has a pure theta-hat E-field radiation pattern
D_z = np.exp(-np.power(theta,2))
#np.cos(np.pi/2.*np.cos(theta))/np.sin(theta)
# What does this thing look like if I put it along x?
# Rotate from the coordinates of the original problem to the new one
#D_x = D_z #rotmap(D_z,[0,90])
#exiD_y = D_z #rotmap(D_x,[90,0])
# Now, re-express theta-hat in the old system as a linear combination
# of theta and phi in the new one ...
PAPER=False

if PAPER:
    Axt = np.sqrt(A_paper_xt['bm32']/A_paper_xx['bm32'].max()) 
    Axp = np.sqrt(A_paper_xp['bm32']/A_paper_xx['bm32'].max()) 
    Ayt = rotmap(Axt,[90,0])
    Ayp = rotmap(Axp,[90,0])
else:
    xnorm = np.power(1-np.power(np.sin(theta)*np.cos(phi),2),-0.5)
    ynorm = np.power(1-np.power(np.sin(theta)*np.sin(phi),2),-0.5)
    #Axt = D_x * xnorm * np.cos(theta)*np.cos(phi)
    #Axp = D_x * xnorm * -1.*np.sin(phi)
    #Ayt = D_y * ynorm * np.cos(theta)*np.sin(phi)
    #Ayp = D_y * ynorm * np.cos(phi)

    Axt = np.abs(D_z * np.cos(phi))
    Axp = np.abs(D_z * np.sin(phi))
    Ayt = np.abs(D_z * (-np.sin(phi)))
    Ayp = np.abs(D_z * np.cos(phi))

    
Пример #4
0
# A half-wave dipole along z has a pure theta-hat E-field radiation pattern
D_z = np.exp(-np.power(theta, 2))
#np.cos(np.pi/2.*np.cos(theta))/np.sin(theta)
# What does this thing look like if I put it along x?
# Rotate from the coordinates of the original problem to the new one
#D_x = D_z #rotmap(D_z,[0,90])
#exiD_y = D_z #rotmap(D_x,[90,0])
# Now, re-express theta-hat in the old system as a linear combination
# of theta and phi in the new one ...
PAPER = False

if PAPER:
    Axt = np.sqrt(A_paper_xt['bm32'] / A_paper_xx['bm32'].max())
    Axp = np.sqrt(A_paper_xp['bm32'] / A_paper_xx['bm32'].max())
    Ayt = rotmap(Axt, [90, 0])
    Ayp = rotmap(Axp, [90, 0])
else:
    xnorm = np.power(1 - np.power(np.sin(theta) * np.cos(phi), 2), -0.5)
    ynorm = np.power(1 - np.power(np.sin(theta) * np.sin(phi), 2), -0.5)
    #Axt = D_x * xnorm * np.cos(theta)*np.cos(phi)
    #Axp = D_x * xnorm * -1.*np.sin(phi)
    #Ayt = D_y * ynorm * np.cos(theta)*np.sin(phi)
    #Ayp = D_y * ynorm * np.cos(phi)

    Axt = np.abs(D_z * np.cos(phi))
    Axp = np.abs(D_z * np.sin(phi))
    Ayt = np.abs(D_z * (-np.sin(phi)))
    Ayp = np.abs(D_z * np.cos(phi))

Ax_dot_Ay = Axt * Ayt + Axp * Ayp