Alessandro Ridolfi's home page



RAQ - RANDOMLY ASKED QUESTIONS





How do baseband data work?

Here I will explain how baseband data is being acquired and to account for the data size and properties.

As a reference, I will use a 10-second baseband (.dada) file acquired with the PSRIX backend at Effelsberg (Lazarus et al. 2016), which makes use of ROACH-1 boards. The data file properties are the following:

PARAMETER SYMBOL VALUE
Bandwidth $\Delta f_{\rm sub}$ 15.625 MHz
Sampling Time $t_{\rm samp}$ 64 ns
Number of Polarizations $N_{\rm pol}$ 2
Number of Dimensions $N_{\rm dim}$ 2 (complex)
Number of Bits $N_{\rm bits}$ 8
Observations Length $T_{\rm obs}$ 10 s
File Size - 625004096 bytes


When we observe a pulsar with our radio telescope, the electromagnetic wave coming from the source will induce a time-varying voltage in the two orthogonal feeds (X and Y) of the receiver. We refer to the time-varying voltages as $V_x(t)$ and $V_y(t)$ for feed X and Y, respectively.

Digitization

The voltages induced in the two feeds are basically two analogue signals. The first thing that we have to do is to digitize the two signals. That means that we need two convert the continuous functions $V_x(t)$ and $V_y(t)$ into discrete time series $V_x(t_i)$ and $V_y(t_i)$, where the voltages are recorded (sampled) at specific times, $t_i$.

The sampling interval $\Delta t = t_{i+1} - t_i$ depends on how fast the Digital-to-Analogue Converters (ADCs, one for each feed) of the backend are. In the case of the ROACH-1 board, the installed ADCs are capable of sampling the voltages $10^9$ times per second. This means that the sampling interval is $\Delta t= (1 / 10^9)~{\rm s} = 10^{-9}~{\rm s} = 1~{\rm ns}$ or, equivalently, the sampling frequency is $f_{\rm samp} = 1~{\rm GHz}$.

Bandwidth

The speed of the two ADCs limits the total bandwidth that can be processed for each feed.
Indeed, for the Nyquist theorem, the total processable bandwidth is $\Delta f_{\rm tot} = 1/(2\cdot \Delta t)$.
In the case of the ROACH-1, we thus have $\Delta f_{\rm tot} = 1 / (2\cdot 10^{-9}~{\rm s}) = 500~{\rm MHz}$.


FFT, frequency channels and effective sampling interval

After the two signals from the feeds have been sampled (i.e. digitized) by the two ADCs, we may want to split the total available bandwidth (in this case, 500 MHz) into a number of sub-bands, or "channels", to retain some frequency information.

To do so, the backend uses a different component, called FPGA (Field Programmable Gate Array). Such piece of hardware is programmed, in the case of the ROACH-1, to perform Fast Fourier Transforms (FFT) of the two incoming time series. Each signal is thus decomposed into a Fourier series, meaning that both $V_x(t_i)$ and $V_y(t_i)$ will represented as the sum of sinusoidal functions $A_k \sin(\omega_k t + \phi_k)$. Each sinusoid of frequency $\omega_k$ will be fully characterized by only two numbers: the amplitude $A_k$ and the phase $\phi_k$ or, equivalently by a complex number that embodies both, $A_k\cdot e^{~j\,\phi_k}$

The FPGA installed on the ROACH-1, can operate at a clock speed of 250 MHz, meaning that it can record data only every 4 ns (1/250 s). Because the ADCs are producing one sample every 1 ns, each ADC first accumulates 4 samples, to them transfer together at once to the FPGA, to mach the speed (or "clock") of the latter.
Clearly, if the FPGA were able to operate at the same speed of the ADCs (1 GHz) there would be no need for this intermediate step.

Now we have to decide into how many channels we want to split the total bandwidth. There might be different reasons behind the choice of the exact value but, in the case of pulsar backends, the main drivers are related to the characteristics of the machines (computers) that are supposed to physically record the data, and in particular to:

  • The computational power of a single machine to perform further real-time operations (for instance, coherent de-dispersion)
  • The speed of the data storage system of the single machine.
  • In the backend used, PSRIX, there are 16 machines, each processing 2 channels. Hence, the total bandwidth is split into 32 channels of bandwidth $\Delta f_{\rm chan} = \Delta f_{\rm tot} / 32 = 15.625~{\rm MHz}$.

    From the mathematical theory of the FFT (see e.g. Press et al. 1992), the frequencies $f_k$ of the Fourier decomposition of a $N$-point time-series with sampling interval $\Delta t$ are: $$ f_k = \frac{k}{N \Delta t} \qquad {\rm~with}~k = 1, \ldots, \frac{N}{2} $$ In our case, $\Delta t = 1~{\rm ns}$ and we want these frequency to be spaced by 15.625 MHz, that is, we impose the condition: $$ {\rm 15.625~MHz} \stackrel{!}{=} f_{k+1} - f_{k} = \frac{k+1}{N \Delta t} - \frac{k}{N \Delta t} = \frac{1}{N \Delta t} $$
    $$ \Rightarrow \qquad N = 15.625 \times 10^{6}~{\rm s}^{-1} \cdot (1 \times 10^{-9}~{\rm s}) = 64~{\rm ns} $$ Hence, the FPGA needs to perform a FFT on a 64-sample times series. This implies that the former first needs to store 64 samples (in parallel for each feed) before doing so. Since the FPGA receives 4 samples per cycle, it has to wait 64/4 = 16 cycles, corresponding to $16\times 4~{\rm ns} = 64~{\rm ns}$.

    Therefore, the resulting effective sampling interval of our data will be 64 ns, as reported the Table of the data properties above.



    To recap

  • We receive two analogue signals from the two feeds, $V_x(t)$ and $V_y(t)$
  • The two signals are sampled every 1 ns
  • Every 4 samples, i.e. every 4 ns, the samples of both feeds are transferred to the FPGA
  • After accumulating 64 samples (i.e. every 64 ns), the FPGA performs a FFT on both the two 64-point-long time series and, for each, it returns 32 complex numbers (or equivalently, 32 amplitudes + 32 phases) that describe the 32 harmonics (i.e. channels) into the Fourier decomposition.
  • The 32 complex numbers are stored into the .dada file.
  • $$ \begin{array}{l} V_x(t) \qquad \stackrel{{\rm Sampling}} \Rightarrow \qquad 64{\rm -point}~~V_x(t_i) \qquad \stackrel{{\rm FFT}} \Rightarrow \qquad \left\{ \begin{array}{l} 32~{\rm amplitudes}~{A^x _k}\\ 32~{\rm phases}~{\phi^x _k} \end{array} \right. \quad \Leftrightarrow \quad 32~{\rm~complex~numbers} ~ A^x_k\cdot e^{~j\,\phi^x _k} \end{array}\\ \begin{array}{l} V_y(t) \qquad \stackrel{{\rm Sampling}} \Rightarrow \qquad 64{\rm-point}~~V_y(t_i) \qquad \stackrel{{\rm FFT}} \Rightarrow \qquad \left\{ \begin{array}{l} 32~{\rm amplitudes}~{A^y _k}\\ 32~{\rm phases}~{\phi^y _k} \end{array} \right. \quad \Leftrightarrow \quad 32~{\rm~complex~numbers} ~ A^y_k\cdot e^{~j\,\phi^y _k} \end{array} $$

    File Size

    Header = 4096 byte
    $$ \begin{split} {\rm Data~Size} &= (T_{\rm obs} / t_{\rm samp} ) \times N_{\rm bits} \times N_{\rm dim} \times N_{\rm pol}\\ &= (10~{\rm s} / 64\times10^{-9}{\rm s}~{\rm samples}) \times 8~\frac{\rm bits}{\rm sample} \times 2~{\rm dims} \times 2~{\rm pols}\\ &= ( 156250000~{\rm samples}) \times 1~\frac{\rm byte}{\rm sample} \times 2~{\rm dims} \times 2~{\rm pols}\\ &= 625000000~{\rm bytes} \end{split} $$ where the 2 dims are $({\rm amplitude, phase})\equiv( {A^y_k}, {\phi^y _k})$ and the 2 polarizations are $(V_x, V_y)$.




    Why does a randomly oriented orbit imply a uniform distribution in the cosine of the inclination?

    Assuming a completely random orientation of a binary system orbit means we are assuming that the vector $\vec{L}$ (the orbital angular momentum, if you will), that is perpendicular to the orbital plane, can point any direction in the sky with equal probabiliy.
    Imagining to have a sphere of arbitrary radius $R$ surrounding the binary, $\vec{L}$ can point to any point of the surface of the sphere with equal probability.
    Every ring of points concentric to the line of sight $\vec{n}$ will correspond to viewing the binary system with a different inclination $i$. Intuitively, larger rings contain more "points" than smaller rings, and thus the probability for the observer to view the system with the relative inclination will be higher.

    Let's put this in a more formal way.

    Given the coordinate system of Figure 1, an infinitesimal ring of the surface of the sphere taken at colatitude (that is, inclination) $i$, will have an infinitesimal area of $$ dA = R di \cdot 2 \pi R \sin(i) = 2 \pi R^2 \sin(i) di$$ Because all the points in the sphere are equiprobable, the probability $p(i)$ that $\vec{L}$ is directed towards one of the points of the ring is given by the ration between the area of the ring itself and that area of the sphere: $$ p(i) = \frac{dA}{4 \pi R^2} = \frac{ 2 \pi R^2 \sin(i) di}{4 \pi R^2} = \frac{1}{2} \sin(i) di $$ What we have just derived is the probability density function of the inclination angle, $i$. What we want to prove now is that the probability density function of the cosine of the inclination, $p(\cos(i))$ is uniform.
    There are two ways of showing this:


    METHOD 1 (p.d.f. of a function of a random variable)

    It can be shown (see any good book about Statistics, such as Papoulis's one) that, given a random variable $X$ with probability density function $p_X (X)$, the p.d.f of a function $Z=f(X)$ of this variable is given by: $$ p_Z(Z) = \sum_k \frac{p_X(\tilde{x_k})}{ | f'(\tilde{x_k})|}$$ Here $\tilde{x_k}$ are the roots of the equation $z=f(x)$ and $f'$ is the derivative of $f$.
    In our case: $$X \equiv i$$ $$p_X (X) \equiv p_i (i) = \frac{1}{2}\sin(i)$$ $$Z = \cos(i)$$

    Applying what we have just said, we first find the roots: $$z = \cos(i) \qquad \Rightarrow \qquad i_k = \arccos(z)$$ then $p_X(\tilde{x_k})$: $$p_i(\tilde{i_k}) = \frac{1}{2} \sin(i) \bigg |_{i = i_k = \arccos(z)} = \frac{1}{2} \sin[\arccos(z)]$$ and finally $| f'(\tilde{i_k})|$: $$| f'(\tilde{i_k})| = \bigg | \frac{d}{di} \cos(i) \bigg |_{i = i_k = \arccos(z)} = \big | - \sin(i)\big |_{i = i_k = \arccos(z)} = \big| - \sin[\arccos(z)] \big | = \sin[\arccos(z)]$$ Plugging these three quantities, we can thus find the p.d.f. for $Z$: $$ p_Z (Z) \equiv p_Z[\cos(i)] = \frac{1}{2} \frac{\sin[\arccos(z)]}{\sin[\arccos(z)]} = \frac{1}{2} $$ Noting that $i \in [0, \pi] \Rightarrow \cos(i) \in [-1,1]$, $p_Z (Z) = 1/2$ is exactly the uniform probability for the range $[-1,1]$.

    $\Box$




    METHOD 2 (cumulative function)

    Another way of proving that $p(\cos i)$ must be uniform, makes use of the cumulative function of the inclination, that is, by definition: $$ F(i) = \int^{i}_{-\infty} p(i') di' $$ which gives the probability that the inclination has a value lower than $i$. Plugging in the actual form of $p(i)$, we get: $$ F(i) = \int^{i}_{-\infty} \frac{1}{2} \sin i' di' = \frac{1}{2} \int^{i}_{0} \sin i' di' = \frac{1}{2}\Bigg [ -\cos(i) +\cos(0) \Bigg] = \frac{1-\cos(i)}{2} $$ so: $$ \Rightarrow \qquad F(i) = \frac{1-\cos(i)}{2} $$ Now, a cumulative function is, by construction, always a variable uniformly distributed from 0 to 1. This means that
    $F(i) = U(0,1)$, where $U$ indicates a uniform p.d.f.) and so, we can write: $$ U(0,1) = \frac{1-\cos(i)}{2} $$ $$ \Rightarrow \qquad 2\cdot U(0,1) = 1-\cos(i) $$ $$ \Rightarrow \qquad U(0,2) = 1-\cos(i) $$ $$ \Rightarrow \qquad \cos(i) = 1 - U(0,2)$$ $$ \Rightarrow \qquad \cos(i) = U(-1,1)$$ that is, $\cos(i)$ is uniformly distributed between -1 and 1, QED.

    $\Box$

    some text
    Figure 1

    Phase offsets after using psradd