40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  40m Log  Not logged in ELOG logo
Entry  Mon Sep 20 15:42:44 2021, Ian MacMillan, Summary, Computers, Quantization Code Summary 472px-Typical_State_Space_model.svg.pngBiquad_filter_DF-IIx.svg.pngSS-IIR-TF.pdf
    Reply  Wed Sep 22 14:22:35 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary IIR64-bitnoisespectrum.pdf
       Reply  Mon Sep 27 12:12:15 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary 
          Reply  Mon Sep 27 16:03:15 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary DeltaNoiseSpectrum.pdf
             Reply  Mon Sep 27 17:04:43 2021, rana, Summary, Computers, Quantization Noise Calculation Summary 
                Reply  Thu Sep 30 11:46:33 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary SS-IIR-Bode.pdfPSD_32bit.pdfPSD_64bit.pdf
                   Reply  Wed Nov 24 11:02:23 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary PSD_IIR_all.pdf
                      Reply  Wed Nov 24 13:44:19 2021, rana, Summary, Computers, Quantization Noise Calculation Summary 
                         Reply  Tue Dec 7 10:55:25 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary DF2_TS.pdfBIQ_TS.pdfScreen_Shot_2021-12-07_at_11.47.57_AM.pngPSD_COMP_BIQ_DF2.pdfPSD_COMP_SS_DF2.pdf
                            Reply  Fri Dec 10 13:02:47 2021, Ian MacMillan, Summary, Computers, Quantization Noise Calculation Summary G0900928-v1_(dragged).pdfPSD_COMP_BIQ_DF2.pdfInput_PSD.pdfInput_Filter.pdfQuantizationN.zip
Message ID: 16481     Entry time: Wed Nov 24 11:02:23 2021     In reply to: 16366     Reply to this: 16482
Author: Ian MacMillan 
Type: Summary 
Category: Computers 
Subject: Quantization Noise Calculation Summary 

I added mpmath to the quantization noise code. mpmath allows me to specify the precision that I am using in calculations. I added this to both the IIR filters and the State-space models although I am only looking at the IIR filters here. I hope to look at the state-space model soon. 

Notebook Summary:

I also added a new notebook which you can find HERE. This notebook creates a signal by summing two sine waves and windowing them.

Then that signal is passed through our filter that has been limited to a specific precision. In our case, we pass the same signal through a number of filters at different precisions.

Next, we take the output from the filter with the highest precision, because this one should have the lowest quantization noise by a significant margin, and we subtract the outputs of the lower precision filters from it. In summary, we are subtracting a clean signal from a noisy signal; because the underlying signal is the same, when we subtract them the only thing that should be left is noise. and since this system is purely digital and theoretical the limiting noise should be quantization noise.

Now we have a time series of the noise for each precision level (except for our highest precision level but that is because we are defining it as noiseless). From here we take a power spectrum of the result and plot it.

After this, we can calculate a frequency-dependent SNR and plot it. I also calculated values for the SNR at the frequencies of our two inputs. 

This is the procedure taken in the notebook and the results are shown below.

Analysis of Results:

The first thing we can see is that the precision levels 256 and 128 bits are not shown on our graph. the 256-bit signal was our clean signal so it was defined to have no noise so it cant be plotted. The 128-bit signal should have some quantization noise but I checked the output array and it contained all zeros. after further investigation, I found that the quantization noise was so small that when the result was being handed over from mpmath to the general python code it was rounding those numbers to zero. To overcome this issue I would have to keep the array as a mpmath object the entire time. I don't think this is useful because matplotlib probably couldn't handle it and it would be easier to just rewrite the code in C. 

The next thing to notice is sort of a sanity check thing. In general, low precision filters yield higher noise than high precision. This is a good quick sanity check. However, this does not hold true at the low end. we can see that 16-bit actually has the highest noise for most of the range. Chris pointed out that at low precisions that quantization noise can become so large that it is no longer a linearly coupled noise source. He also noted that this is prone to happen for low precision coefficients with features far below the Nyquist frequency like I have here. This is one explanation that seems to explain the data especially because this ambiguity is happening at 16-bit and lower as he points out. 

Another thing that I must mention, even if it is just a note to future readers, is that quantization noise is input dependent. by changing the input signal I see different degrees of quantization noise.

Analysis of SNR:

One of the things we hoped to accomplish in the original plan was to play around with the input and see how the results changed. I mainly looked at how the amplitude of the input signal scaled the SNR of the output. Below I include a table of the results. These results were taken from the SNR calculated at the first peak (see the last code block in the notebook) with the amplitude of the given sine wave given at the top of each column. this amplitude was given to both of the two sine waves even though only the first one was reported. To see an example, currently, the notebook is set up for measurement of input amplitude 10.

  0.1 Amplitude of input 1 Amplitude 100 Amplitude 1000 Amplitude
4-bit SNR 5.06e5 5.07e5 5.07e5 5.07e5
8-bit SNR 5.08e5 5.08e5 5.08e5 5.08e5
16-bit SNR 2.57e6 8.39e6 3.94e6 1.27e6
32-bit SNR 7.20e17 6.31e17 1.311e18 1.86e18
64-bit SNR 6.0e32 1.28e32 1.06e32 2.42e32
128-bit SNR unknown unknown unknown unknown

As we can see from the table above the SNR does not seem to relate to the amplitude of the input. in multiple instances, the SNR dips or peaks in the middle of our amplitude range.

 

Attachment 1: PSD_IIR_all.pdf  124 kB  | Hide | Hide all
PSD_IIR_all.pdf
ELOG V3.1.3-