From 89bae811dcb25d90a3822849691be21332ecba10 Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Mon, 25 Jul 2016 00:05:56 -0700 Subject: [PATCH] blocks/signal/agc: add AGCBlock resolves #10. --- radio/blocks/init.lua | 1 + radio/blocks/signal/agc.lua | 117 +++++++++++++++++++++++ tests/blocks/signal/agc_spec.lua | 41 ++++++++ tests/generate/blocks/signal/agc_spec.py | 35 +++++++ 4 files changed, 194 insertions(+) create mode 100644 radio/blocks/signal/agc.lua create mode 100644 tests/blocks/signal/agc_spec.lua create mode 100644 tests/generate/blocks/signal/agc_spec.py diff --git a/radio/blocks/init.lua b/radio/blocks/init.lua index 74b20e773..679758831 100644 --- a/radio/blocks/init.lua +++ b/radio/blocks/init.lua @@ -84,6 +84,7 @@ return { --- Miscellaneous ThrottleBlock = require('radio.blocks.signal.throttle'), PowerSquelchBlock = require('radio.blocks.signal.powersquelch'), + AGCBlock = require('radio.blocks.signal.agc'), -- Protocol Blocks --- RDS diff --git a/radio/blocks/signal/agc.lua b/radio/blocks/signal/agc.lua new file mode 100644 index 000000000..27466b0bc --- /dev/null +++ b/radio/blocks/signal/agc.lua @@ -0,0 +1,117 @@ +--- +-- Apply automatic gain to a real or complex valued signal to maintain a target +-- power. +-- +-- $$ y[n] = \text{AGC}(x[n], \text{mode}, \text{target}, \text{threshold}) $$ +-- +-- Implementation note: this is a feedforward AGC. The `power_tau` time +-- constant controls the moving average of the power estimator. The `gain_tau` +-- time constant controls the speed of the gain adjustment. The gain has +-- symmetric attack and decay dynamics. +-- +-- @category Miscellaneous +-- @block AGCBlock +-- @tparam mode Mode, choice of "fast", "slow", "custom" +-- @tparam[opt=-35] number target Target power in dBFS +-- @tparam[opt=-75] number threshold Threshold power in dBFS +-- @tparam[opt={}] table options Additional options, specifying: +-- * `gain_tau` (number, default 0.1 seconds for +-- fast and 3.0 seconds for slow) +-- * `power_tau` (number, default 1.0 seconds) +-- @signature in:Float32 > out:Float32 +-- @signature in:ComplexFloat32 > out:ComplexFloat32 +-- +-- @usage +-- -- Automatic gain control with fast gain +-- local agc = radio.AGCBlock('fast') +-- +-- -- Automatic gain control with slow gain, -20 dbFS target +-- local agc = radio.AGCBlock('slow', -20) +-- +-- -- Automatic gain control with custom time constant, -30 dbFS target, -100 dbFS threshold +-- local agc = radio.AGCBlock('custom', -30, -100, {gain_tau = 0.5}) + +local math = require('math') + +local block = require('radio.core.block') +local types = require('radio.types') + +local AGCBlock = block.factory("AGCBlock") + +function AGCBlock:instantiate(mode, target, threshold, options) + self.mode = assert(mode, "Missing argument #1 (mode), can be \"fast\", \"slow\", or \"custom\"") + self.target = target or -35 + self.threshold = threshold or -75 + self.options = options or {} + + self.gain_tau = ({fast = 0.1, slow = 3.0})[self.mode] or self.options.gain_tau + self.power_tau = self.options.power_tau or 1.0 + + assert(self.mode == "fast" or self.mode == "slow" or self.mode == "custom", string.format("Invalid mode \"%s\"", tostring(mode))) + assert(self.gain_tau, "Missing gain_tau parameter for \"custom\" mode") + + self:add_type_signature({block.Input("in", types.Float32)}, {block.Output("out", types.Float32)}, self.process_real) + self:add_type_signature({block.Input("in", types.ComplexFloat32)}, {block.Output("out", types.ComplexFloat32)}, self.process_complex) +end + +function AGCBlock:initialize() + -- Compute normalized alpha for power estimator + self.power_alpha = 1/(1 + self.power_tau*self:get_rate()) + -- Compute normalized alpha for gain filter + self.gain_alpha = 1/(1 + self.gain_tau*self:get_rate()) + -- Initialize average power and gain state + self.average_power, self.gain = 0.0, 0.0 + -- Linearize logarithmic power target + self.target = 10^(self.target/10) + -- Linearize logarithmic power threshold + self.threshold = 10^(self.threshold/10) + + self.out = self:get_input_type().vector() +end + +function AGCBlock:process_real(x) + local out = self.out:resize(x.length) + + for i = 0, x.length-1 do + -- Estimate average power + self.average_power = (1 - self.power_alpha)*self.average_power + self.power_alpha*(x.data[i].value*x.data[i].value) + + if self.average_power >= self.threshold then + -- Compute filtered gain + self.gain = (1 - self.gain_alpha)*self.gain + self.gain_alpha*(self.target*(1/self.average_power)) + -- Apply sqrt gain + out.data[i].value = math.sqrt(self.gain)*x.data[i].value + else + -- Pass through without gain + out.data[i].value = x.data[i].value + end + end + + return out +end + +function AGCBlock:process_complex(x) + local out = self.out:resize(x.length) + + for i = 0, x.length-1 do + -- Estimate average power + self.average_power = (1 - self.power_alpha)*self.average_power + self.power_alpha*x.data[i]:abs_squared() + + if self.average_power >= self.threshold then + -- Compute filtered gain + self.gain = (1 - self.gain_alpha)*self.gain + self.gain_alpha*(self.target*(1/self.average_power)) + -- Apply sqrt gain + local gain = math.sqrt(self.gain) + out.data[i].real = gain*x.data[i].real + out.data[i].imag = gain*x.data[i].imag + else + -- Pass through without gain + out.data[i].real = x.data[i].real + out.data[i].imag = x.data[i].imag + end + end + + return out +end + +return AGCBlock diff --git a/tests/blocks/signal/agc_spec.lua b/tests/blocks/signal/agc_spec.lua new file mode 100644 index 000000000..6c7a52289 --- /dev/null +++ b/tests/blocks/signal/agc_spec.lua @@ -0,0 +1,41 @@ +local radio = require('radio') +local jigs = require('tests.jigs') + +jigs.TestBlock(radio.AGCBlock, { + { + desc = "-63 dBFS cosine input, -50 dBFS threshold", + args = {"fast", -35, -50}, + inputs = {radio.types.Float32.vector_from_array({0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000})}, + outputs = {radio.types.Float32.vector_from_array({0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000})} + }, + { + desc = "-63 dBFS cosine input, -35 dbFS target, fast agc", + args = {"fast", -35, -75}, + inputs = {radio.types.Float32.vector_from_array({0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000})}, + outputs = {radio.types.Float32.vector_from_array({0.02811707, 0.02186061, 0.00943121, -0.01076917, -0.02411677, -0.02439772, -0.01863301, -0.00810782, 0.00940591, 0.02231450, 0.02344663, 0.01822668, 0.00796758, -0.00926182, -0.02211050, -0.02333333, -0.01817602, -0.00794971, 0.00924335, 0.02208412, 0.02331859, 0.01816939, 0.00794736, -0.00924092, -0.02208066, -0.02331665, -0.01816852, -0.00794706, 0.00924060, 0.02208020, 0.02331640, 0.01816840, 0.00794701, -0.00924056, -0.02208014, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636, -0.01816839, -0.00794701, 0.00924056, 0.02208013, 0.02331636, 0.01816839, 0.00794701, -0.00924056, -0.02208013, -0.02331636})} + }, + { + desc = "-63 dBFS cosine input, -35 dbFS target, slow agc", + args = {"slow", -35, -75}, + inputs = {radio.types.Float32.vector_from_array({0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000, -0.00080902, -0.00030902, 0.00030902, 0.00080902, 0.00100000, 0.00080902, 0.00030902, -0.00030902, -0.00080902, -0.00100000})}, + outputs = {radio.types.Float32.vector_from_array({0.01164157, 0.01196539, 0.00558215, -0.00663694, -0.01832429, -0.02272420, -0.01838709, -0.00721812, 0.00761226, 0.02021058, 0.02464617, 0.01968362, 0.00761249, -0.00790968, -0.02084616, -0.02531984, -0.02015222, -0.00776165, 0.00802983, 0.02111116, 0.02560446, 0.02035227, 0.00782632, -0.00808304, -0.02122971, -0.02573233, -0.02044245, -0.00785561, 0.00810731, 0.02128395, 0.02579092, 0.02048381, 0.00786907, -0.00811848, -0.02130894, -0.02581793, -0.02050290, -0.00787528, 0.00812364, 0.02132049, 0.02583041, 0.02051171, 0.00787815, -0.00812602, -0.02132583, -0.02583618, -0.02051579, -0.00787948, 0.00812713, 0.02132830, 0.02583886, 0.02051768, 0.00788009, -0.00812764, -0.02132944, -0.02584009, -0.02051855, -0.00788037, 0.00812787, 0.02132997, 0.02584066, 0.02051895, 0.00788050, -0.00812798, -0.02133022, -0.02584093, -0.02051914, -0.00788057, 0.00812803, 0.02133033, 0.02584105, 0.02051922, 0.00788059, -0.00812806, -0.02133038, -0.02584111, -0.02051927, -0.00788061, 0.00812807, 0.02133041, 0.02584113, 0.02051928, 0.00788061, -0.00812807, -0.02133042, -0.02584115, -0.02051929, -0.00788062, 0.00812807, 0.02133042, 0.02584115, 0.02051930, 0.00788062, -0.00812807, -0.02133042, -0.02584115, -0.02051930, -0.00788062, 0.00812807, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812807, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116, -0.02051930, -0.00788062, 0.00812808, 0.02133043, 0.02584116, 0.02051930, 0.00788062, -0.00812808, -0.02133043, -0.02584116})} + }, + { + desc = "-60 dBFS complex exponential input, -50 dBFS threshold", + args = {"fast", -35, -50}, + inputs = {radio.types.ComplexFloat32.vector_from_array({{0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}})}, + outputs = {radio.types.ComplexFloat32.vector_from_array({{0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}})} + }, + { + desc = "-60 dBFS complex exponential input, -35 dBFS target, fast agc", + args = {"fast", -35, -75}, + inputs = {radio.types.ComplexFloat32.vector_from_array({{0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}})}, + outputs = {radio.types.ComplexFloat32.vector_from_array({{0.02811707, 0.00000000}, {0.01991732, 0.01447078}, {0.00673839, 0.02073865}, {-0.00623908, 0.01920192}, {-0.01559177, 0.01132808}, {-0.01872938, 0.00000000}, {-0.01488174, -0.01081222}, {-0.00561883, -0.01729297}, {0.00557657, -0.01716292}, {0.01452745, -0.01055481}, {0.01789824, -0.00000000}, {0.01444863, 0.01049754}, {0.00551095, 0.01696095}, {-0.00550568, 0.01694473}, {-0.01440487, 0.01046575}, {-0.01779786, 0.00000000}, {-0.01439470, -0.01045836}, {-0.00549725, -0.01691880}, {0.00549656, -0.01691668}, {0.01438899, -0.01045421}, {0.01778477, -0.00000000}, {0.01438765, 0.01045324}, {0.00549546, 0.01691328}, {-0.00549537, 0.01691300}, {-0.01438690, 0.01045269}, {-0.01778305, 0.00000000}, {-0.01438672, -0.01045257}, {-0.00549522, -0.01691255}, {0.00549521, -0.01691252}, {0.01438662, -0.01045249}, {0.01778283, -0.00000000}, {0.01438660, 0.01045248}, {0.00549519, 0.01691246}, {-0.00549519, 0.01691245}, {-0.01438659, 0.01045247}, {-0.01778280, 0.00000000}, {-0.01438659, -0.01045247}, {-0.00549519, -0.01691245}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}})} + }, + { + desc = "-60 dBFS complex exponential input, -35 dBFS target, slow agc", + args = {"slow", -35, -75}, + inputs = {radio.types.ComplexFloat32.vector_from_array({{0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, -0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, -0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}, {-0.00080902, -0.00058779}, {-0.00030902, -0.00095106}, {0.00030902, -0.00095106}, {0.00080902, -0.00058779}, {0.00100000, 0.00000000}, {0.00080902, 0.00058779}, {0.00030902, 0.00095106}, {-0.00030902, 0.00095106}, {-0.00080902, 0.00058779}, {-0.00100000, 0.00000000}})}, + outputs = {radio.types.ComplexFloat32.vector_from_array({{0.01164157, 0.00000000}, {0.01136895, 0.00826002}, {0.00472165, 0.01453176}, {-0.00494822, 0.01522906}, {-0.01333789, 0.00969055}, {-0.01680773, 0.00000000}, {-0.01378006, -0.01001180}, {-0.00531374, -0.01635401}, {0.00535081, -0.01646811}, {0.01408177, -0.01023100}, {0.01747547, -0.00000000}, {0.01418184, 0.01030371}, {0.00543027, 0.01671266}, {-0.00544096, 0.01674554}, {-0.01426735, 0.01036584}, {-0.01765849, 0.00000000}, {-0.01430148, -0.01039063}, {-0.00546760, -0.01682755}, {0.00547173, -0.01684025}, {0.01433427, -0.01041446}, {0.01772764, -0.00000000}, {0.01434848, 0.01042478}, {0.00548275, 0.01687417}, {-0.00548455, 0.01687971}, {-0.01436276, 0.01043516}, {-0.01775759, 0.00000000}, {-0.01436913, -0.01043978}, {-0.00548948, -0.01689487}, {0.00549029, -0.01689739}, {0.01437561, -0.01044449}, {0.01777118, -0.00000000}, {0.01437853, 0.01044661}, {0.00549255, 0.01690433}, {-0.00549293, 0.01690549}, {-0.01438151, 0.01044878}, {-0.01777743, 0.00000000}, {-0.01438286, -0.01044976}, {-0.00549397, -0.01690869}, {0.00549414, -0.01690923}, {0.01438424, -0.01045076}, {0.01778031, -0.00000000}, {0.01438486, 0.01045121}, {0.00549462, 0.01691071}, {-0.00549470, 0.01691096}, {-0.01438550, 0.01045168}, {-0.01778165, 0.00000000}, {-0.01438579, -0.01045188}, {-0.00549493, -0.01691164}, {0.00549496, -0.01691175}, {0.01438608, -0.01045210}, {0.01778226, -0.00000000}, {0.01438621, 0.01045220}, {0.00549506, 0.01691207}, {-0.00549508, 0.01691212}, {-0.01438635, 0.01045230}, {-0.01778255, 0.00000000}, {-0.01438641, -0.01045234}, {-0.00549513, -0.01691227}, {0.00549514, -0.01691230}, {0.01438648, -0.01045239}, {0.01778268, -0.00000000}, {0.01438650, 0.01045241}, {0.00549516, 0.01691236}, {-0.00549516, 0.01691238}, {-0.01438653, 0.01045243}, {-0.01778274, -0.00000000}, {-0.01438655, -0.01045244}, {-0.00549517, -0.01691241}, {0.00549518, -0.01691241}, {0.01438656, -0.01045245}, {0.01778277, -0.00000000}, {0.01438657, 0.01045245}, {0.00549518, 0.01691242}, {-0.00549518, 0.01691243}, {-0.01438657, 0.01045246}, {-0.01778278, 0.00000000}, {-0.01438657, -0.01045246}, {-0.00549518, -0.01691243}, {0.00549518, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549518, 0.01691244}, {-0.00549518, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, -0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, -0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}, {-0.01438658, -0.01045246}, {-0.00549519, -0.01691244}, {0.00549519, -0.01691244}, {0.01438658, -0.01045246}, {0.01778279, 0.00000000}, {0.01438658, 0.01045246}, {0.00549519, 0.01691244}, {-0.00549519, 0.01691244}, {-0.01438658, 0.01045246}, {-0.01778279, 0.00000000}})} + }, +}, {epsilon = 1.0e-06}) diff --git a/tests/generate/blocks/signal/agc_spec.py b/tests/generate/blocks/signal/agc_spec.py new file mode 100644 index 000000000..af2768db3 --- /dev/null +++ b/tests/generate/blocks/signal/agc_spec.py @@ -0,0 +1,35 @@ +import numpy +import scipy.signal +from generate import * + + +def generate(): + def agc(target, gain_tau, power_tau, x): + # Compute average power + power_alpha = 1/(1 + power_tau*2) + average_power = scipy.signal.lfilter([power_alpha], [1, -1+power_alpha], numpy.abs(x)**2).astype(x.dtype) + # Compute filtered gain + gain_alpha = 1/(1 + gain_tau*2) + filtered_gain = scipy.signal.lfilter([gain_alpha], [1, -1+gain_alpha], 10**(target/10)/average_power).astype(x.dtype) + # Apply sqrt gain + out = numpy.sqrt(filtered_gain)*x + + return [out] + + vectors = [] + + # Cosine with 100 Hz frequency, 1000 Hz sample rate, 0.001 amplitude + # Average power in dBFS = 10*log10(0.001^2 * 0.5) = -63 dBFS + x = 0.001*numpy.cos(2*numpy.pi*(100/1000)*numpy.arange(256)).astype(numpy.float32) + vectors.append(TestVector(['"fast"', -35, -50], [x], [x], "-63 dBFS cosine input, -50 dBFS threshold")) + vectors.append(TestVector(['"fast"', -35, -75], [x], agc(-35, 0.1, 1.0, x), "-63 dBFS cosine input, -35 dbFS target, fast agc")) + vectors.append(TestVector(['"slow"', -35, -75], [x], agc(-35, 3.0, 1.0, x), "-63 dBFS cosine input, -35 dbFS target, slow agc")) + + # Complex exponential with 100 Hz frequency, 1000 Hz sample rate, 0.001 amplitude + # Average power in dBFS = 10*log10(0.001^2 * 1.0) = -60 dBFS + x = 0.001*numpy.exp(2*numpy.pi*1j*(100/1000)*numpy.arange(256)).astype(numpy.complex64) + vectors.append(TestVector(['"fast"', -35, -50], [x], [x], "-60 dBFS complex exponential input, -50 dBFS threshold")) + vectors.append(TestVector(['"fast"', -35, -75], [x], agc(-35, 0.1, 1.0, x), "-60 dBFS complex exponential input, -35 dBFS target, fast agc")) + vectors.append(TestVector(['"slow"', -35, -75], [x], agc(-35, 3.0, 1.0, x), "-60 dBFS complex exponential input, -35 dBFS target, slow agc")) + + return BlockSpec("AGCBlock", "tests/blocks/signal/agc_spec.lua", vectors, 1e-6)