Tutorial 3: Wide(-ish)band Spectrometer

Introduction

A spectrometer is something that takes a signal in the time domain and converts it to the frequency domain. In digital systems, this is generally achieved by utilising the FFT (Fast Fourier Transform) algorithm.

When designing a spectrometer for astronomical applications, it’s important to consider the science case behind it. For example, pulsar timing searches will need a spectrometer which can dump spectra on short timescales, so the rate of change of the spectra can be observed. In contrast, a deep field HI survey will accumulate multiple spectra to increase the signal to noise ratio. It’s also important to note that “bigger isn’t always better”; the higher your spectral and time resolution are, the more data your computer (and scientist on the other end) will have to deal with. For now, let’s skip the science case and familiarize ourselves with an example spectrometer.

Setup

This tutorial comes with a completed model file, a compiled bitstream, ready for execution on Red Pitaya, as well as a Python script to configure the Red Pitaya and make plots. Here

Spectrometer Basics

When designing a spectrometer there are a few main parameters of note:

  • Bandwidth: The width of your frequency spectrum, in Hz. This depends on the sampling rate; for complex sampled data this is equivalent to:

../../_images/bandwidtheq1.png

In contrast, for real or Nyquist sampled data the rate is half this:

../../_images/bandwidtheq2.png

as two samples are required to reconstruct a given waveform .

  • Frequency resolution: The frequency resolution of a spectrometer, Δf, is given by

../../_images/freq_eq.png,

and is the width of each frequency bin. Correspondingly, Δf is a measure of how precise you can measure a frequency.

  • Time resolution: Time resolution is simply the spectral dump rate of your instrument. We generally accumulate multiple spectra to average out noise; the more accumulations we do, the lower the time resolution. For looking at short timescale events, such as pulsar bursts, higher time resolution is necessary; conversely, if we want to look at a weak HI signal, a long accumulation time is required, so time resolution is less important.

Configuration and Control

Hardware Configuration

The tutorial comes with a pre-compiled fpg file, which is generated from the model you just went through (tut_spec.fpg)

Next, you need to set up your Red Pitaya. Power it on, making sure that:

• By default, the Red Pitaya takes RF inputs between -1 and +1 V though it can be configured for higher voltages.

• Connect inputs 0 and 1 to sine wave generators. The frequencies should be between 0 and 50 MHz.

The tut_spec.py spectrometer script

This short script does the following:

• calls the Red-Pitaya • uploads an fpg file • activates the reset registers • pulls data from the snap blocks • plots the spectra.

Browse to where the tut_spec.py file is in a terminal and at the prompt type

 python tut_spec.py -f <fpgfile name> -r <Red-Pitaya IP or hostname> -a <accumulation length>

replacing with the IP address of your Red-Pitaya and with your fpg path and filename. You should see a spectrum like this:

../../_images/Spectrum_14MHz_all.png

In the plot, the blue solid line represents several spectra concatenated one after the next. You see that after each accumulation – in this case 5 – the amplitude of the tones build. After the fifth spectrum, then the accumulation resets and repeats. The data valid flag, shown by a red-dashed line scaled to the range of the plot, shows the indecies of the last accumulation. We plot the valid accumulation in frequency space, you see the tone at 14 MHz. Inspect the tut_spec.py script to see how this is done.

../../_images/Spectrum_14MHz_zoom_freq.png

Conclusion

If you have followed this tutorial faithfully, you should now know:

• What a spectrometer is and what the important parameters for astronomy are.

• Which CASPER blocks you might want to use to make a spectrometer, and how to connect them up in Simulink.

• How to connect to and control a Red Pitaya spectrometer using python scripting.