From bd7a6c4d5378814e2716d34c78b14e7aa9311c9e Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Fri, 22 Jul 2016 05:20:46 -0700 Subject: [PATCH] blocks/signal/powersquelch: add PowerSquelchBlock resolves #9. --- radio/blocks/init.lua | 1 + radio/blocks/signal/powersquelch.lua | 77 +++++++++++++++++++ tests/blocks/signal/powersquelch_spec.lua | 29 +++++++ .../blocks/signal/powersquelch_spec.py | 20 +++++ 4 files changed, 127 insertions(+) create mode 100644 radio/blocks/signal/powersquelch.lua create mode 100644 tests/blocks/signal/powersquelch_spec.lua create mode 100644 tests/generate/blocks/signal/powersquelch_spec.py diff --git a/radio/blocks/init.lua b/radio/blocks/init.lua index 1b34f3b86..74b20e773 100644 --- a/radio/blocks/init.lua +++ b/radio/blocks/init.lua @@ -83,6 +83,7 @@ return { FloatToComplexBlock = require('radio.blocks.signal.floattocomplex'), --- Miscellaneous ThrottleBlock = require('radio.blocks.signal.throttle'), + PowerSquelchBlock = require('radio.blocks.signal.powersquelch'), -- Protocol Blocks --- RDS diff --git a/radio/blocks/signal/powersquelch.lua b/radio/blocks/signal/powersquelch.lua new file mode 100644 index 000000000..a1c8018fd --- /dev/null +++ b/radio/blocks/signal/powersquelch.lua @@ -0,0 +1,77 @@ +--- +-- Squelch a real or complex valued signal by its average power. +-- +-- $$ y[n] = \begin{cases} x[n] & \text{if } P_\text{average}(x[n]) > P_\text{threshold} \\ 0.0 & \text{otherwise} \end{cases} $$ +-- +-- @category Level Control +-- @block PowerSquelchBlock +-- @tparam number threshold Power threshold in dBFS +-- @tparam[opt=0.001] number tau Time constant of moving average filter in seconds +-- @signature in:Float32 > out:Float32 +-- @signature in:ComplexFloat32 > out:ComplexFloat32 +-- +-- @usage +-- -- Squelch at -40 dBFS power +-- local squelch = radio.PowerSquelchBlock(-40) + +local math = require('math') + +local block = require('radio.core.block') +local types = require('radio.types') + +local PowerSquelchBlock = block.factory("PowerSquelchBlock") + +function PowerSquelchBlock:instantiate(threshold, cutoff) + self.threshold = assert(threshold, "Missing argument #1 (threshold)") + self.tau = tau or 0.001 + + 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 PowerSquelchBlock:initialize() + -- Compute normalized alpha + self.alpha = 1/(1 + self.tau*self:get_rate()) + -- Initialize average power state + self.average_power = 0.0 + -- Linearize logarithmic power threshold + self.threshold = 10^(self.threshold/10) + + self.out = self:get_input_type().vector() +end + +function PowerSquelchBlock:process_real(x) + local out = self.out:resize(x.length) + + for i = 0, x.length-1 do + self.average_power = (1 - self.alpha)*self.average_power + self.alpha*(x.data[i].value*x.data[i].value) + + if self.average_power >= self.threshold then + out.data[i].value = x.data[i].value + else + out.data[i].value = 0.0 + end + end + + return out +end + +function PowerSquelchBlock:process_complex(x) + local out = self.out:resize(x.length) + + for i = 0, x.length-1 do + self.average_power = (1 - self.alpha)*self.average_power + self.alpha*x.data[i]:abs_squared() + + if self.average_power >= self.threshold then + out.data[i].real = x.data[i].real + out.data[i].imag = x.data[i].imag + else + out.data[i].real = 0.0 + out.data[i].imag = 0.0 + end + end + + return out +end + +return PowerSquelchBlock diff --git a/tests/blocks/signal/powersquelch_spec.lua b/tests/blocks/signal/powersquelch_spec.lua new file mode 100644 index 000000000..ad526a43a --- /dev/null +++ b/tests/blocks/signal/powersquelch_spec.lua @@ -0,0 +1,29 @@ +local radio = require('radio') +local jigs = require('tests.jigs') + +jigs.TestBlock(radio.PowerSquelchBlock, { + { + desc = "-43 dBFS cosine input, -30 dBFS squelch", + args = {-30}, + inputs = {radio.types.Float32.vector_from_array({0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000})}, + outputs = {radio.types.Float32.vector_from_array({0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000})} + }, + { + desc = "-43 dBFS cosine input, -55 dBFS squelch", + args = {-55}, + inputs = {radio.types.Float32.vector_from_array({0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000})}, + outputs = {radio.types.Float32.vector_from_array({0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000, -0.00809017, -0.00309017, 0.00309017, 0.00809017, 0.01000000, 0.00809017, 0.00309017, -0.00309017, -0.00809017, -0.01000000})} + }, + { + desc = "-40 dBFS complex exponential input, -30 dBFS squelch", + args = {-30}, + inputs = {radio.types.ComplexFloat32.vector_from_array({{0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}})}, + outputs = {radio.types.ComplexFloat32.vector_from_array({{0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}})} + }, + { + desc = "-40 dBFS complex exponential input, -50 dBFS squelch", + args = {-50}, + inputs = {radio.types.ComplexFloat32.vector_from_array({{0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}})}, + outputs = {radio.types.ComplexFloat32.vector_from_array({{0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, -0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, -0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}, {-0.00809017, -0.00587785}, {-0.00309017, -0.00951057}, {0.00309017, -0.00951057}, {0.00809017, -0.00587785}, {0.01000000, 0.00000000}, {0.00809017, 0.00587785}, {0.00309017, 0.00951057}, {-0.00309017, 0.00951057}, {-0.00809017, 0.00587785}, {-0.01000000, 0.00000000}})} + }, +}, {epsilon = 1.0e-06}) diff --git a/tests/generate/blocks/signal/powersquelch_spec.py b/tests/generate/blocks/signal/powersquelch_spec.py new file mode 100644 index 000000000..15a4097b6 --- /dev/null +++ b/tests/generate/blocks/signal/powersquelch_spec.py @@ -0,0 +1,20 @@ +import numpy +from generate import * + + +def generate(): + vectors = [] + + # Cosine with 100 Hz frequency, 1000 Hz sample rate, 0.01 amplitude + # Average power in dBFS = 10*log10(0.01^2 * 0.5) = -43 dBFS + x = 0.01*numpy.cos(2*numpy.pi*(100/1000)*numpy.arange(256)).astype(numpy.float32) + vectors.append(TestVector([-30], [x], [numpy.array([0.0]*len(x), dtype=numpy.float32)], "-43 dBFS cosine input, -30 dBFS squelch")) + vectors.append(TestVector([-55], [x], [x], "-43 dBFS cosine input, -55 dBFS squelch")) + + # Complex exponential with 100 Hz frequency, 1000 Hz sample rate, 0.01 amplitude + # Average power in dBFS = 10*log10(0.01^2 * 1.0) = -40 dBFS + x = 0.01*numpy.exp(2*numpy.pi*1j*(100/1000)*numpy.arange(256)).astype(numpy.complex64) + vectors.append(TestVector([-30], [x], [numpy.array([0.0]*len(x), dtype=numpy.complex64)], "-40 dBFS complex exponential input, -30 dBFS squelch")) + vectors.append(TestVector([-50], [x], [x], "-40 dBFS complex exponential input, -50 dBFS squelch")) + + return BlockSpec("PowerSquelchBlock", "tests/blocks/signal/powersquelch_spec.lua", vectors, 1e-6)