# Waterfall plot

### From setiquest wiki

A **waterfall plot** is a three dimensional graphical display (frequency vs. time vs. intensity) also known as a spectrogram.

## Pseudo-code for generating waterfall plots

This pseudo-code omits potential refinements (e.g., windowing to improve channel response).

- Perform a FFT of size n on the first n complex samples of data.
- Square the FFT output channels (real^2 + imag^2) to compute power for each of the n channels.
- Autoscale the n power values into n pixel values.
- Arrange the n pixel values into the top row of a waterfall image of width n (by convention: most negative frequency left-most, most positive frequency right-most).
- Perform a FFT of size n on the next n complex samples.
- Same as step 2.
- Same as step 3.
- Same as step 4, placing n pixels in next waterfall image row down (by convention: time flows from top-to-bottom).
- While there is more data, go to step 5.

The resulting waterfall plot will be n pixels wide and its height will be determined by the number of FFTs that the observation data file length supports (i.e., file length / (2 bytes-per-sample) / FFT size).

What value should you choose for n, the FFT size? The larger the FFT, the narrower the bandwidth of each FFT output channel which supports greater signal-to-noise ratio because the noise power (which is conserved) is distributed randomly (evenly) in all the FFT output channels but the power of an embedded narrow-band signal will be wholly contained in just one channel, or a few channels. However, a large FFT size will reduce transient response and can hide, in combination with auto-scaling, wide features, such as the hydrogen spectrum.

The waterfall plots computed for some of the setiQuest observations have a channel width, or equivalent vertical pixel width, of ~ 1Hz. This is a sweet spot between maximizing signal-to-noise for narrow band signals and minimizing the effect of frequency spreading by the interstellar medium. The sample rate of the setiQuest data is 8738133.(3) samples/second. Therefore, we use a binary-length FFT size (n) of 2^23 (8388608). The setiQuest analysis FFT is done in two stages and the output channels are divided into 256 pixel-wide waterfall images.

Auto-scaling of the power values into pixel values is done to achieve nice contrast for signals against background noise. There is no one best technique for doing this. However, a technique which works well -- the technique used to auto-scale the setiQuest waterfall images -- is to generate statistics on the power values which will approximate a normal distribution for almost all observation data, even data containing strong signals. Set all power values below one standard deviations to black and all power values above 3 standard deviations to white with all other values mapped linearly between the two.

## See also

## References

- E-mail from Rob Ackermann, 2010-11-30.