oct12

# Intro

The spectral jumps at 2^n channels are caused by the aggressive shifting in the butterfly stages. This shifting is required because of the lband radars. This shifting can cause underflows in the fft butterflys which end up causing the spectral jumps and 2^n channel.

## The pfb overflows:

The PFB  (polyphase filter bank) overflow errors occur in the butterfly stages of the fft. Each butterfly stage does a multiply and add. This causes  the size of the  number to grow:
• For noise, the number increases by sqrt(2) on each butterfly stage. After two stages, the number has doubled.
• For a sine wave, the number doubles on each butterfly stage.
The fft computation starts with a 12 bit number stored in the uppermost 12 bits of the 18 bit fpga registers. The PSHIFT parameter tells the  fpga on which butterfly stages a downshift is needed:
• each bit of pshift refers to a butterfly stage. The leftmost bit is the first butterfly.
• A question exists on whether a phshift bit means to downshift before or after the butterfly operation. I think that it does the down shift before the operation (but that needs to be verified).
• the number of butterfly stages is log2(fftlen). For 8192 there are 13 butterflys.
• We need to guarantee that the multiply, add in the butterflys do not overflow.
•  The arithmetic does not clamp, it rolls around (turns out if it clamped it probably causes the same problem).
• If an overflow occurs, the power in that channel gets spread over a number of channels in the final spectra. This makes the spectra unusable.
• Initially we set PHSHIFT for noise.
• for an 8192 fft that would be: 0x1555 It downshifts every two butterflys.
• If we started with a noise sigma of 30 counts (about)  5 bits, we should not have trouble with the overflows
• When alfa was installed, we found that a pshift of 0x1555 would have overflows. The problem was the strong radars. They were acting as sine waves which needed to be downshifted every butterfly stage.
• PHSHIFT used to handle the radars.
• With the original 12 bit number in the upper 12 bits of the 18 bit register, there were 6 lower bits that were unused.
• For the first 6 butterfly stages we could do a downshift and use up the 6 lower bits
• These 6  butterflys also increased the value every 2 butterfly. That means that the number grew by 3 more bits
• This gives a total of 9 allowable downshifts before we need to alternate every other butterfly on the downshifting.
• For 8192 that would be : 0x1ff5 .. nine downshifts then alternate shifting on every other butterfly.
• With this value of pshift, the radars no longer caused overflows in the pfb on every ipp (we still see them at certain az,za's where the radar is strongest).
• Note that fftlens of 512 or less would use 9 or fewer butterflys. Downshifting on each of the butterflys guaranteed that we would not have pfb overflows.
• CIMA was initially setup with a fixed PHSHIFT. We used 0x1ff5 since all alfa observing was exposed to the radars.
• Single pixel observing with other receivers used the same PSHIFT value: 0x1ff5. We saw steps of 2^n channels in the spectra with this configuration.

# Underflows in the butterflys.

The problem with the aggressive shifting is that we have seen steps  in the final spectrum.
• The steps are located at powers of 2^n in channels.
• I think the underflows occur at a particular step in the butterflys. The bit reversal at the end then gives the 2^n spacing.
Datasets showing the steps in the spectra:.
• 04oct10: cband receiver 4-6 ghz
• shows that pshift=0x1555, adjpwr=30 will get rid of the jumps and not cause pfb overflows (at least for the az,za were at).
• 23apr10: if2 noise source.
• try adjpwr=30,45,120 counts, and pshift=0x1ff5,0x0ff5
• Shows that 0x0ff5 still has jumps up to adjpwr=120 counts.
• 08jul08: use if2 noise source.
• this was while we were still exploring what was making the jumps
• test fftlens of 8192,4096,2048,1024,512
• take data with rms of 80 counts. Use this as a bandpass correction
•  test # butterfly downshifts tested a/d rms in counts 0 9 downshifts then 0,1 80 use as bpcorrection 1 9 downshifts then 0,1 30 2 9 downshifts then 0,1 25 3 9 downshifts then 0,1 20 4 10 downshifts then 0,1 30 5 9 downshifts then 0,1 15

• 18mar08: use if2 noise source
• fix pshift and then vary  a/d rms in counts
• fix a/d rms counts and vary pshift.

# Summary:

• the jumps are from underflows in the pfb
• removing shifts on the left (1st butterflys removes the jumps faster than removing the shifts from the right.. this makes sense).
• single pixel observing without radars (when not using lband) can probably use regular noise like shifting (everyother butterfly)
• Lband with the radars needs the aggressive shifting or we get pfb overflows on every radar ipp