In [14]:
import numpy as np
import pylab as plt
from scipy import signal
import math
import itertools
from datetime import datetime, timedelta
import csv, os
%matplotlib inline
%config InlineBackend.figure_formats=['svg']

Ice Properties

Most of this information can be found on Matt Newcomb's South Pole Ice website. Needed are functional forms for $n(z)$ and $\lambda(z, T)$.

Index of Refraction

In [15]:
def index(depth):
    """
    Returns the index of refraction at a given depth.
    PARAMETERS
        - depth : depth in meters
    RETURN
        index of refraction
    """
    return 1.32 + 0.438*(1-np.exp(-0.0132*depth))
In [16]:
d = np.arange(0, 2500, 10)
plt.plot(d, index(d))
plt.xlabel('Depth (meters)')
plt.ylabel('Index of Refraction')
plt.grid()

Temperature and Attenuation Length

In [17]:
def temperature(depth):
    return -54.975 + 3.062 * np.exp(depth / 976.1)
In [18]:
plt.plot(d, temperature(d))
plt.xlabel('Depth (meters)')
plt.ylabel('Temperature (degrees C)')
plt.grid()
In [19]:
def atten2(f, depth):
    t = temperature(depth)
    a = 5.03097*np.exp(0.134806*t)
    b = 0.172082*t+10.629
    c = -0.00199175*t - 0.703323
    return 1701/(a+b*f**(c+1))
In [20]:
d = np.arange(0, 2500, 100)
for f in np.arange(100, 1000, 150):
    plt.plot(d, atten2(f*0.001, d), label='%d MHz' % f)
plt.grid()
plt.xlabel('Depth [meters]')
plt.ylabel('Attenuation Length [meters]')
plt.legend()
Out[20]:
<matplotlib.legend.Legend at 0x965b5c0>

Askaryan Radiation

This is taken from Alvarez-Muñiz, Wolf, Zas, Practical and Accurate Calculations of Askaryan Radiation arXiv:1106.6283. These give time-domain models of the vector potential. As the article explains it is the convolution of the lateral shower charge distribution with the longitudinal distribution. The authors give a parametrized fit of the former. For the latter I use the standard shower parametrization from, e.g. PDG.

TODO: verify correct behavior of emission angles greater than $\frac{\pi}{2}$.

In [26]:
def RAC(t):
    tp = t >= 0
    tn = t < 0
    ta = np.abs(t)
    return -4.5E-11 * ((np.exp(-17.5*ta) + (1.0 + 2.87*ta)**-3)*tp + \
                 (np.exp(-33.3*ta) + (1.0 + 3.05*ta)**-3.5)*tn)

def shower(t, a, b=0.5):
    return (b*t)**(a-1.0) * np.exp(-b*t) * b / math.gamma(a)

def askvp(t, theta, n=1.78):
    if theta < 0.0 or theta > 0.5*math.pi:
        return np.zeros(len(t), dtype='d')
    zp = np.arange(0, 10, 0.02).reshape(500, 1)
    Q  = shower(zp*0.92/0.36, 4)
    tp = zp * 3.33 * (1.0 - n*math.cos(theta))
    return 0.01 * np.sum(Q * RAC(t-tp), 0)*math.sin(theta)/(1 - 1/n**2)**0.5
In [27]:
t = np.arange(-30, 30.05, 0.1)
plt.plot(t, askvp(t, math.radians(30)), label='30 deg')
plt.plot(t, askvp(t, math.radians(45)), label='45 deg')
plt.plot(t, 0.1*askvp(t, math.radians(55)), label='55 deg $\cdot$ 0.1')
plt.plot(t, askvp(t, math.radians(70)), label='70 degrees')
plt.grid()
plt.xlabel('Time (ns)')
plt.ylabel('Vector Potential [V.s]')
plt.legend(loc=4)
Out[27]:
<matplotlib.legend.Legend at 0xab7630>

The electric field is given by the partial derivative of $\mathbf{A}$ with respect to time: $$\mathbf{E} = -\frac{\partial\mathbf{A}}{\partial t}$$

In [28]:
a45 = askvp(t, math.radians(45))
a55 = askvp(t, math.radians(55))
te = 0.5 * (t[1:] + t[0:-1])
e45 = -np.diff(a45)*1E10
e55 = -np.diff(a55)*1E10
plt.plot(te, e45)
plt.plot(te, e55*0.1)
plt.grid()

Then of course the frequency domain can be obtained from your best Fourier method. Below, I will transform to frequency space and then use the non-dispersive but lossy model for radio wave propagation. I would include dispersion effects but it seems hard and something I read said that it was really small. But, it's a TODO.

In [29]:
f, Pxx_den = signal.periodogram(e45, fs=20)
plt.semilogy(f, Pxx_den)
f, Pxx_den = signal.periodogram(e55, fs=20)
plt.semilogy(f, Pxx_den)
plt.axis([0, 2.5, 1E-10, 1E-2])
plt.grid()
plt.xlabel('Frequency [GHz]')
plt.ylabel('Power')
Out[29]:
<matplotlib.text.Text at 0x9457390>

Here's an example of how propagation effects would be simulated.

  1. Transform to frequency space;
  2. Apply the frequency dependent ice loss;
  3. (Facultatif) Antenna response;
  4. Inverse transform back to time domain.
In [31]:
E55 = np.fft.fft(e55)
fs  = 10.0
f   = np.fft.fftfreq(len(e55), d=1.0/fs)
plt.plot(f, np.abs(E55), '.')
E55p = E55*np.exp(-1000 / atten2(np.abs(f), 1000))*(1 > np.abs(f))*(0.1 < np.abs(f))
plt.plot(f, np.abs(E55p), '.')
plt.xlim((-2.5,2.5))
Out[31]:
(-2.5, 2.5)
In [32]:
e55p = np.fft.ifft(E55p)
plt.plot(te, 0.1*e55)
plt.plot(te, np.real(e55p))
plt.xlim((-8, 8))
Out[32]:
(-8, 8)

Antennas and Arrays

In [34]:
class Dipole(object):
    def __init__(self, pos, length=1.0):
        self.pos = pos
        self.w = 0.0
        self.length = length
        self.f0 = 0.3 / (2.0 * length)
        self.fmin = 0.4 * self.f0
        self.fmax = 2.5 * self.f0
        
    def heff(self, f, p_in):
        """
        Antenna effective height.
        INPUT:
            f    - frequency (MHz)
            p_in - incident plane wave unit vector
        """
        return (1.0 - p_in[2]**2)**0.5
    
    def receive(self, w, t0, fs):
        self.t = np.arange(0, len(w)) / fs + t0
        self.w = w

Simulation Kernel

In [35]:
class simkern(object):
    def __init__(self, ant, genvol, **simpar):
        self.ant = ant
        self.genvol = genvol
        self.askt0  = -25
        self.askt1  = 25
        self.fs     = 10.0
        
    def generate_event(self, e_scale=1.):
        # generate neutrino direction
        while True:
            u = np.random.uniform(-1, 1, size=3)
            um = np.sum(u**2)
            if um <= 1.0:
                um = um**0.5
                u /= um
                break
        
        # generate vertex position in the ice
        v = np.random.uniform(low=self.genvol[0], high=self.genvol[1])
        
        print('Neutrino dir', u)
        print('Neutrino vertex', v)
        
        # loop on detectors (antennas)
        tvp = np.linspace(self.askt0, self.askt1, (self.askt1 - self.askt0)*self.fs + 1)
        t = 0.5*(tvp[1:] + tvp[0:-1])
        f = np.fft.fftfreq(len(t), d=1.0/self.fs)

        for a in self.ant:
            obs = a.pos - v
            r   = np.dot(obs, obs)**0.5
            costh = np.dot(obs, u) / r
            theta = math.acos(costh)
            #print('r = %.1f m' % r)
            #print('cosine(theta) = %.3f' % costh)
            if theta < 0.5*math.pi:
                # askaryan radiation model in the time domain
                vp = e_scale * askvp(tvp, theta) / r
                er = -np.diff(vp)*fs*1E9
                fwt = np.ones(len(f), dtype='d')
                # step from source to receiver
                track_step = np.arange(0, r+24, 25)
                track_step[-1] = r
                t_sig = 0.0
                ia, ib = itertools.tee(track_step)
                next(ib, None)
                for ra, rb in zip(ia, ib):
                    rmid = 0.5*(ra + rb)
                    dr   = rb - ra
                    x = v + obs * rmid / r
                    depth = -x[2]
                    atl = atten2(np.abs(f), depth)
                    fwt *= np.exp(-dr/atl)
                    #print(depth, f[20], atl[20], fwt[20])
                    t_sig  += 3.33 * dr * index(depth)
                # current signal propagation model is dispersionless 
                spx = np.real(np.fft.ifft(np.fft.fft(er) * fwt))
                a.receive(spx, t_sig, self.fs)
In [49]:
a = [ Dipole(np.array((x, y, -z), 'd')) 
     for x in np.linspace(-4000, 4000, 21) 
     for y in np.linspace(-4000, 4000, 21) 
     for z in [50, 100]]
sk0 = simkern(a, genvol=((-2000, -2000, -2500), (2000, 2000, 0)))
In [52]:
sk0.generate_event(e_scale=100.)
nhit = 0
for a in sk0.ant:
    if np.max(np.abs(a.w)) > 15E-6: nhit += 1
print (nhit)
Neutrino dir [-0.43664335  0.89027411 -0.12943953]
Neutrino vertex [-1522.8034793   1893.55111313   -61.44116183]
39
In [55]:
plt.rcParams['figure.figsize'] = (5,5)
plt.scatter([a.pos[0]*0.001 for a in sk0.ant], [a.pos[1]*0.001 for a in sk0.ant], s=[np.max(np.abs(a.w))*1E5 for a in sk0.ant])
plt.grid()
plt.savefig('askarr-105.png', dpi=300)
In [63]:
plt.plot(sk0.ant[115].t, sk0.ant[115].w+np.random.normal(scale=12E-6, size=500))
Out[63]:
[<matplotlib.lines.Line2D at 0xe6b6630>]
In [62]:
f, Pxx = signal.periodogram(sk0.ant[115].w, fs=10.)
plt.plot(f, 10*np.log10(Pxx*50))
plt.axis([0, 2, -125, -50])
Out[62]:
[0, 2, -125, -50]
In [56]:
for i, a in enumerate(sk0.ant):
    ax = np.max(np.abs(a.w))
    if ax > 1E-5:
        print (a.pos, i, ax)
[-4000.  2000.   -50.] 30 1.88177322414e-05
[-4000.  2000.  -100.] 31 1.92282341531e-05
[-4000.  2400.   -50.] 32 3.29303107058e-05
[-4000.  2400.  -100.] 33 3.08684311377e-05
[-3600.  2000.   -50.] 72 3.16268539607e-05
[-3600.  2000.  -100.] 73 3.26426145582e-05
[-3600.  2400.   -50.] 74 2.93303040337e-05
[-3600.  2400.  -100.] 75 2.76939889087e-05
[-3200.  2000.   -50.] 114 6.03577974769e-05
[-3200.  2000.  -100.] 115 6.3820798036e-05
[-3200.  2400.   -50.] 116 2.45924856693e-05
[-3200.  2400.  -100.] 117 2.3268458673e-05
[-2800.  1600.  -100.] 155 1.01063222602e-05
[-2800.  2000.   -50.] 156 0.00014725640908
[-2800.  2000.  -100.] 157 0.000162654540139
[-2800.  2400.   -50.] 158 1.89435042934e-05
[-2800.  2400.  -100.] 159 1.79372769708e-05
[-2400.  1600.  -100.] 197 1.00695222231e-05
[-2400.  2000.   -50.] 198 0.000813071061976
[-2400.  2000.  -100.] 199 0.000997869663515
[-2400.  2400.   -50.] 200 1.31133231614e-05
[-2400.  2400.  -100.] 201 1.23575684552e-05
[-2000.  2000.   -50.] 240 0.00061214966857
[-2000.  2000.  -100.] 241 0.000454475755055
[-1600.  2000.   -50.] 282 3.76122781208e-05
[-1600.  2000.  -100.] 283 2.43382808169e-05
[-1600.  2400.   -50.] 284 1.10658145751e-05
[-1200.  2400.   -50.] 326 0.000609944263755
[-1200.  2400.  -100.] 327 0.000833224006381
[-1200.  2800.   -50.] 328 5.62647559106e-05
[-1200.  2800.  -100.] 329 5.18242775154e-05
[-1200.  3200.   -50.] 330 1.49821235684e-05
[-1200.  3200.  -100.] 331 1.40851537185e-05
[ -800.  2400.   -50.] 368 1.2047726518e-05
[ -800.  2400.  -100.] 369 1.3188963764e-05
[ -800.  2800.   -50.] 370 4.6365624253e-05
[ -800.  2800.  -100.] 371 4.91583165947e-05
[ -800.  3200.   -50.] 372 0.000517551099967
[ -800.  3200.  -100.] 373 0.000401561616862
[ -800.  3600.   -50.] 374 3.19847167098e-05
[ -800.  3600.  -100.] 375 3.01227055445e-05
[ -800.  4000.   -50.] 376 1.08532424633e-05
[ -800.  4000.  -100.] 377 1.04247321296e-05
[ -400.  3200.   -50.] 414 1.6936401651e-05
[ -400.  3200.  -100.] 415 1.74277516766e-05
[ -400.  3600.   -50.] 416 4.77757671853e-05
[ -400.  3600.  -100.] 417 5.02230262586e-05
[ -400.  4000.   -50.] 418 7.59771725787e-05
[ -400.  4000.  -100.] 419 6.79514561509e-05
[    0.  4000.   -50.] 460 1.49459632606e-05
[    0.  4000.  -100.] 461 1.51434729015e-05
In [12]:
Pn = 1.38E-23 * 220 * 1E9
Vn = (Pn*50)**0.5
In [13]:
Pn
Out[13]:
3.0360000000000004e-12
In [ ]: