Controlling averages via REST API

Is there a way to set the amount of averages via the REST API without using LoadFile?
Is there a way to reset the averages buffer via the REST API?
If the averages are set to x and I call DoAcquisition x times after that, will I get the averaged fft or just the last measurement when using for instance PeakDbv?

I expect to get the averaged fft values from all api calls, but if I call DoAcquisition and I do not know what amount of averages are taken then my results will be invalid. I noticed that if I have averages set to 3 and change the frequency of Gen1 than it the first two acquisitions will show the last frequency the generator was set to as well. And if I change the generator frequency after every acquisition then I will also see the last two fundamentals in the UI fft plot.

I also tried to create a file with only the averages tag in it, but that does not work. It resets all other settings as well instead of only the ones in the file.

Thanks!

Hi @breedj, if you are writing code, it’s pretty trivial to do these types of operations yourself. Collect 5 acquisitions, convert to linear (or keep as log, depending on your goal), sum each bin, divide by 5. And then, you aren’t beholden to any REST limitations.

Thanks, Matt

Hi matt, You are right, I will do that. Why didn’t I think of that?
Thanks!

I have some other questions related to this.
If I want to do 3 averages and therefore collect 3 acquisitions, but the amount averages in the UI already has been set to something greater than 1, i.e. 5. What will be the result of those acquisitions when using /Data/Frequency/Input? Will that data each be the result of the last acquisition or will they be the output of the accumulating averages as shown in the UI? If that is the case I need to be able to set the amount of averages to 1 in advance using the API before doing the acquisitions. Otherwise the data is averaged twice. Can you tell me what you think I will receive?

I noticed that the averages in the UI are reset when calling /Settings/OutputSource/Sine. I guess a workaround is to call /Settings/OutputSource/Sine and /Settings/AudioGen/Gen1 before every acquisition even though the frequency and amplitude do not change. Or call /Settings/Default before starting the measurements.

Hi @breedj, if you are using REST, I’d not enable averaging. REST has no notion of averaging, reseting averaging, etc.

Hi Matt, I wonder if you could expand on this, specifically about converting each bin to linear or keeping as log, depending on the goal?

Let’s say I want to take several acquisitions to hone the THD+N, what method would be used?

Hi matt. Does that mean that if averaging is set in the UI it does not influence the data I get with /Data/Frequency/Input?

Hi @Michael1, this is a good experiment to try in excel. Generate some gaussian noise (maybe 10 samples). But do it two ways: Target -120 dBV mean noise, with 1 dB sigma. Do the math in dB (average 10 dB readings) and do the math linearly (average 10 linear readings).

The “all dB approach” will give you a slightly higher average. Teh “all linear approach” will give you the more accurate and slightly lower average.

The QA40x does all averaging on the linear numbers before they are converted to dB for display.

Hi @breedj, I’m not sure and would need to check. I think the message here, though, is averaging used with REST can give unpredictable results PLUS you don’t have a way to programmatically reset the average.

I understand. Thanks.