PAPER_Correlator_EQ - david-macmahon/wiki_convert_test GitHub Wiki

PAPER 256 Input Correlator F Engine EQ Settings

Overview

Prior to quantizing to 4-bits, the PFB output values pass through a scaling (i.e. gain) stage. Each frequency channel of each input has its own scaling factor. The purpose of the scaling stage is to provide a way to equalize the passband prior to quantization, so this stage is often referred to as simply EQ and the scaling factors are also known as EQ coefficients.

Implementation

The EQ coefficients are stored in shared BRAMs. Due to the nature of the post-PFB signal paths, each BRAM holds the gains for two inputs. Since there are 32 inputs per ROACH2 F engine, a total of 16 shared BRAMs are used to hold all the EQ coefficients. The BRAMs are named eq_0_coeffs through eq_15_coeffs.

In general, eq_N_coeffs holds the EQ coefficients for inputs N and N+16. One EQ coefficient is stored in each 32-bit word of the shared BRAM. Locations 0 through 1023 hold the coefficients for channels 0 through 1023 of input N. Locations 1024 through 2047 hold the coefficients for channels 0 through 1023 of input N+16.

The lower 18 bits of the 32-bit word is treated as a UFix_18_7 data type (i.e. unsigned 18 bit value with 11 integer bits and 7 fractional bits). Thus, the smallest non-zero gain is 1/128 while the largest possible gain is 2048-1/128. Note that a gain of zero will always result in a zero value for the corresponding input and frequency channel, which can be a very useful diagnostic.

Reading and writing the EQ coefficients from and to the shared BRAMs is typically done via a KATCP, more specifically a KATCP-capable scripting language such as Ruby or Python.

Strategies for setting the EQ coefficients

Several schools of thought exist for how to set the EQ coefficients. The minimalist school assumes that the analog front ends all have (close enough to) flat frequency response and similar output power so all frequency channels of all inputs are given the same value. An alternate school of thought assumes that each frequency channel of each input needs to be scaled independently to make the pre-quantization passband as flat as possible. Another idea is to adjust the EQ coefficients over time to keep the pre-quantization levels constant as the sky brightness changes (e.g. as the galactic plane passes through the beam).

The choice of EQ coefficient strategy affects the subsequent metadata collection and data analysis. If time varying and/or frequency varying EQ coefficients are used, then the downstream data analysis will want to know about it. This adds complexity to the system which must be factored into the cost/benefit analysis when choosing the strategy.

The PAPER project has opted for the minimalistic approach and the paper_feng_init.rb script has an option to specify a single EQ value that will be used for all frequency channels of all inputs.

Determining the Optimum EQ settings

Regardless of the strategy chosen, the values to be used still need to be determined. This is a complicated topic in itself and a detailed treatment is beyond the scope of this document. See CASPER Memo 16, Quantization with Four Bits, for details.

As a rule of thumb, the EQ coefficient should be chosen such that the RMS of the 4-bit quantized signal is between 2 and 3 (assuming the 4-bit input range is considered to be -7 to +7). For a noise dominated signal, this can be determined from the integrated autocorrelation power levels.

Since a noise dominated signal has equal power in the real and imaginary components, half the integrated autocorrelation value is the "sum of squares" of the real (and imaginary) component of the input samples. Dividing by the number of samples integrated gives the "mean of squares" and taking the square root of that gives the "root mean of squares" or RMS of the 4-bit quantized values. In short, the 4-bit RMS is given as sqrt(P/(2N)), where P is the integrated autocorrelation value and N is the number of samples in the integration. Note that the RMS will always be in the range 0 to 7 (-8 is never output by the PAPER ROACH2 F engine's 4-bit quantizer).