Hi, Steve.
The results look great! I now understand properly that when you said clipping low level signals you were just trimming the Y axis of the FFT. I had taken your statement to mean that you were clipping samples in the time domain (!) so you can imagine why I thought that was a bad idea. I am really sorry about that thanks for the careful clarification. I did not mean to come back with a reply that was far too basic. The actual algorithms of the FFT are for the most part largely over my head; I am very glad there are people like you who understand it and can help to optimize it.
I have also been doing some experiments (I am using perl/PDL instead of python and matlab). There are two things I am looking at:
First, even if you use a smaller FFT for display purposes, I do not think that you necessarily have to rely on the FFT bin size to get a precise measurement of frequency. For these harmonic measurements when you can be reasonably sure there is a single sinusoidal signal peak in the bin, you can use the phase information of the bin between two FFTs taken at a known interval to determine instantaneous frequency more precisely than looking at the bin energy alone. I believe this is how most sampling SA's must do it because they will provide for peak measurements that are not centered on the bin. There may also be other ways to do it as well. The power measurement should be able to be made fairly precise too even with larger bins; maybe consider subtracting the expected noise power in the bin if it ends up being significant enough. I have not looked into these ideas very much or run any research on them, so could be very wrong on these assumptions...
Second, I am looking at running overlapping FFTs to compute a spectral density plot similar to how the data is displayed on real-time spectrum analyzers or in gr-fosphor. So for an FFT length of 1 megapoint, with an overlap of 1 sample, up to 23 million transforms can be aggregated to examine spectral density. This may also allow for an oversampled 1gsps source to be sliced every 4 samples to compute FFT from 0-125MHz which is probably more reasonable given the capabilities of the scope. Slicing every 3 samples might be even better since 167mhz is a more reasonalbe approximation of the range of the frontend, and the scope cannot be made to run at this rate natively. Granted you get only a couple ms of time with this samplerate, so it might not be terribly useful, but it might be enough to establish the fundamental technique for future projects.
This document has some good theory of operation stuff in it for sampling spectrum analyzers. In fact, it is oddly comprehensive while not getting too terribly technical.
http://circuitslab.case.edu/manuals/Real_time_Spectrum_Analyzer_Fundamentals_-_Tektronix.pdf I havent read it all yet, but I did notice some interesting bits related to how they measure power - how it is computed, what windowing function is used (They default to Kaiser) and how the windowing function is adjusted for the desired RBW.
I have not tried talking with the scope yet. I have been working all with synthesized data. Since I can't find anything off the shelf for perl, I was going to give it a shot over LXI/ethernet as it seems like it would be easier to implement than USB. It might also allow faster transfers which would be extremely welcome.
Picking up FM is interesting; I figured it would be possible on purpose; in fact I had planned on trying it, but it kind of sucks that it's getting in there unwanted.
Regarding the raw values not going to full scale, the range of 22-184 you are seeing does not seem great -- that implies that when the scope is AC coupled the dc bias into the ADC's not well centered in the dynamic range of the ADC (0V at ~103 instead of 128). Not much to do about that.I guess, but you should be able to eek out a bit more dynamic range if you can either boost the input signal into the scope by a few dB or adjust the frontend to the next smallest v/div scale (which might have a more centered bias point too) and use an adjustable attenuator to try to get the ADC to run out to full scale. All of that is basically manually accounting for the fact that the scope does not have the step attenuator or preamps on the frontend like most SA's have to deal with the problem of getting the signal pushed to ADC full scale. Have you run the self-cal? I doubt it would affect the raw ranges but it might be doing some internal scaling. If you haven't, give it a shot but be aware it takes a good amount of time on this scope. A final thought is that there are clamp diodes on the frontend that you might hit -- you might hit clamping before you actually get the ADC to full scale (Rigol may do this to avoid clipping), and you may not be able to see it on the scope itself since it will be way off screen.
Alan, I am really looking forward to seeing what you have done w/ your software. If you have a chance, you might check out gr-fosphor and consider a similar plotting mode using overlapping FFT. Have you had a look at the DirectX 11 FFT API? I wonder if it is as fast or capable as the CUDA FFT? Fosphor includes a basic OpenCL FFT kernel as well -- license may determine what of those you could use...
73, John K5IT