Tutorial 4: Wideband Spectrometer - Bypass Mode¶
This tutorial is adapted from the original one found Here. It is now leveraged to support ADC operating in Digital Down Convereter (DDC) Bypass bandwidth mode. The ADC modules based on ADC32RF45 chips which support both DDC and DDC Bypass bandwidth modes are applicable in this tutorial while focussing only on the DDC Bypass mode.
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.
This tutorial comes with completed model files, compiled bitstreams, ready for execution on Skarab, as well as Python scripts to configure the Skarab and make plots. Here
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:
In contrast, for real or Nyquist sampled data the rate is half this:
as two samples are required to reconstruct a given waveform .
- Frequency resolution: The frequency resolution of a spectrometer, Δf, is given by
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¶
The tutorial comes with a pre-compiled fpg file, which is generated from the model you just went through (tut_spec_byp.fpg). All communication and configuration will be done by the python control script called tut_spec_byp.py.
Next, you need to set up your Skarab as shown in the diagram below.
Switch it on, making sure that:
- Your tone source is set within the band of the ADC and is connected on channel 0 of the ADC. The ADC is operated in DDC bypass bandwidth mode. The set tone source frequency should be observed on the spectrum as is. In our setup, we set the tone frequency to 1.054 GHz.
- Make sure the 10MHz reference is connected up, otherwise the script will fail along the way.
The tut_spec_byp.py spectrometer script¶
Once you’ve got that done, it’s time to run the script. If you’re in linux, browse to where the tut_spec_byp.py file is in a terminal and at the prompt type
python tut_spec_byp.py <skarab IP or hostname> -l <accumulation length> -b <fpgfile name>
Take some time to inspect the tut_spec_byp.py script. It is quite long, but don’t be intimidated. Most of the script is configuration for the ADC. The important lines begin after the
#START OF MAIN comment. There, you will see that the script
• Instantiates the casperfpga connection with the Skarab
• Uploads the fpg file
• Sets the ADC
• Records ADC snapshots, interleaves them and writes to a file adcN_data.txt where N is 0..4
• Plots the spectral outputs of the memory blocks
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 Skarab spectrometer using python scripting