Skip to content

Commit 68d52f4

Browse files
committedMar 21, 2018
fixed airy beam
1 parent e82616f commit 68d52f4

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
 

‎IonRIME/instrument_setup.py

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(self, parameters, antenna='a'):
6262
'paper_feko': 'jones_save/PAPER/',
6363
'hera_legacy': 'jones_save/',
6464
'analytic_dipole': 'analytic_dipole/',
65+
'airy_dipole': 'jones_save/airy_dipole/',
6566
'sim_group_test0': 'jones_save/sim_group_test0/'
6667
}
6768

@@ -77,6 +78,7 @@ def __init__(self, parameters, antenna='a'):
7778
'paper_feko': self.paper_feko,
7879
'hera_legacy': self.hera_legacy,
7980
'analytic_dipole': self.analytic_dipole,
81+
'airy_dipole': self.airy_dipole,
8082
'sim_group_test0': self.sim_group_test0,
8183
}
8284

@@ -156,5 +158,9 @@ def hera_legacy(self, parameters):
156158
def analytic_dipole(self, parameters):
157159
return irf.analytic_dipole_setup(self.nside, self.nfreq,sigma=self.dipole_hpbw, z0_cza=self.z0_cza)
158160

161+
def airy_dipole(self, parameters):
162+
a = 14.6/2. # HERA dish radius ...or was it 14.0?
163+
return irf.airy_dipole_setup(self.nside, self.nu_axis, a, z0_cza=self.z0_cza)
164+
159165
def sim_group_test0(self, parameters):
160166
return sgtest0.make_ijones_spectrum(parameters)

‎IonRIME/ionRIME_funcs.py

+73
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import healpy as hp
44
from datetime import datetime
55

6+
import scipy.special as special
7+
68
import scipy.interpolate as interpolate
79

810
import numba_funcs as irnf
@@ -659,6 +661,77 @@ def transform_basis(nside, jones, z0_cza, R_z0):
659661

660662
return jones_out
661663

664+
def AiryBeam(th, lmbda, a):
665+
k = 2. * np.pi / lmbda
666+
B = np.abs(2. * special.jv(1, k * a * np.sin(th)) / (k * a * np.sin(th)))
667+
B[np.where(np.abs(th) < 1e-10)[0]] = 1
668+
B[np.where(th > np.pi/2.)[0]] = 0.
669+
return B
670+
671+
def airy_dipole_setup(nside, nu_axis, a, z0_cza=None):
672+
def transform_basis(nside, jones, z0_cza, R_z0):
673+
674+
npix = hp.nside2npix(nside)
675+
hpxidx = np.arange(npix)
676+
cza, ra = hp.pix2ang(nside, hpxidx)
677+
678+
fR = R_z0
679+
680+
tb, pb = rotate_sphr_coords(fR, cza, ra)
681+
682+
cza_v = t_hat_cart(cza, ra)
683+
ra_v = p_hat_cart(cza, ra)
684+
685+
tb_v = t_hat_cart(tb, pb)
686+
687+
fRcza_v = np.einsum('ab...,b...->a...', fR, cza_v)
688+
fRra_v = np.einsum('ab...,b...->a...', fR, ra_v)
689+
690+
cosX = np.einsum('a...,a...', fRcza_v, tb_v)
691+
sinX = np.einsum('a...,a...', fRra_v, tb_v)
692+
693+
694+
basis_rot = np.array([[cosX, sinX],[-sinX, cosX]])
695+
basis_rot = np.transpose(basis_rot,(2,0,1))
696+
697+
return np.einsum('...ab,...bc->...ac', jones, basis_rot)
698+
699+
if z0_cza is None:
700+
z0_cza = np.radians(120.72)
701+
702+
nfreq = len(nu_axis)
703+
704+
npix = hp.nside2npix(nside)
705+
hpxidx = np.arange(npix)
706+
th, phi = hp.pix2ang(nside, hpxidx)
707+
708+
R_z0 = hp.rotator.Rotator(rot=[0,-np.degrees(z0_cza)])
709+
710+
th_l, phi_l = R_z0(th, phi)
711+
phi_l[phi_l < 0] += 2. * np.pi
712+
713+
ct,st = np.cos(th_l), np.sin(th_l)
714+
cp,sp = np.cos(phi_l), np.sin(phi_l)
715+
716+
jones_dipole = np.array([
717+
[ct * cp, -sp],
718+
[ct * sp, cp]
719+
], dtype=np.complex128).transpose(2,0,1)
720+
721+
jones_c = transform_basis(nside, jones_dipole, z0_cza, np.array(R_z0.mat))
722+
723+
c = 299792458.
724+
# a = 14.6/2.
725+
726+
B = np.zeros((nfreq, npix,2,2))
727+
for nu_i, nu in enumerate(nu_axis):
728+
B[nu_i] = np.broadcast_to(AiryBeam(th_l, c/nu, a), (2,2,npix)).T
729+
730+
jones_c = np.broadcast_to(jones_c, (nfreq, npix, 2, 2))
731+
jones_out = B * jones_c
732+
733+
return jones_out
734+
662735
def PAPER_transform_basis(nside, jones, z0_cza, R_z0):
663736

664737
npix = hp.nside2npix(nside)

0 commit comments

Comments
 (0)