Skip to content

Commit

Permalink
blocks/signal: rename argument window_type to window in filters
Browse files Browse the repository at this point in the history
  • Loading branch information
vsergeev committed Jul 2, 2016
1 parent d8d2439 commit 2ba0040
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions radio/blocks/signal/bandpassfilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- @tparam {number,number} cutoffs Cutoff frequencies in Hz
-- @tparam[opt=nil] number nyquist Nyquist frequency, if specifying
-- normalized cutoff frequencies
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:ComplexFloat32 > out:ComplexFloat32
-- @signature in:Float32 > out:Float32
Expand All @@ -29,10 +29,10 @@ local FIRFilterBlock = require('radio.blocks.signal.firfilter')

local BandpassFilterBlock = block.factory("BandpassFilterBlock", FIRFilterBlock)

function BandpassFilterBlock:instantiate(num_taps, cutoffs, nyquist, window_type)
function BandpassFilterBlock:instantiate(num_taps, cutoffs, nyquist, window)
assert(num_taps, "Missing argument #1 (num_taps)")
self.cutoffs = assert(cutoffs, "Missing argument #2 (cutoffs)")
self.window_type = window_type or "hamming"
self.window = window or "hamming"
self.nyquist = nyquist

FIRFilterBlock.instantiate(self, types.Float32.vector(num_taps))
Expand All @@ -44,7 +44,7 @@ function BandpassFilterBlock:initialize()

-- Generate taps
local cutoffs = {self.cutoffs[1]/nyquist, self.cutoffs[2]/nyquist}
local taps = filter_utils.firwin_bandpass(self.taps.length, cutoffs, self.window_type)
local taps = filter_utils.firwin_bandpass(self.taps.length, cutoffs, self.window)
self.taps = types.Float32.vector_from_array(taps)

FIRFilterBlock.initialize(self)
Expand Down
8 changes: 4 additions & 4 deletions radio/blocks/signal/bandstopfilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- @tparam {number,number} cutoffs Cutoff frequencies in Hz
-- @tparam[opt=nil] number nyquist Nyquist frequency, if specifying
-- normalized cutoff frequencies
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:ComplexFloat32 > out:ComplexFloat32
-- @signature in:Float32 > out:Float32
Expand All @@ -29,10 +29,10 @@ local FIRFilterBlock = require('radio.blocks.signal.firfilter')

local BandstopFilterBlock = block.factory("BandstopFilterBlock", FIRFilterBlock)

function BandstopFilterBlock:instantiate(num_taps, cutoffs, nyquist, window_type)
function BandstopFilterBlock:instantiate(num_taps, cutoffs, nyquist, window)
assert(num_taps, "Missing argument #1 (num_taps)")
self.cutoffs = assert(cutoffs, "Missing argument #2 (cutoffs)")
self.window_type = window_type or "hamming"
self.window = window or "hamming"
self.nyquist = nyquist

FIRFilterBlock.instantiate(self, types.Float32.vector(num_taps))
Expand All @@ -44,7 +44,7 @@ function BandstopFilterBlock:initialize()

-- Generate taps
local cutoffs = {self.cutoffs[1]/nyquist, self.cutoffs[2]/nyquist}
local taps = filter_utils.firwin_bandstop(self.taps.length, cutoffs, self.window_type)
local taps = filter_utils.firwin_bandstop(self.taps.length, cutoffs, self.window)
self.taps = types.Float32.vector_from_array(taps)

FIRFilterBlock.initialize(self)
Expand Down
8 changes: 4 additions & 4 deletions radio/blocks/signal/complexbandpassfilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-- @tparam {number,number} cutoffs Cutoff frequencies in Hz
-- @tparam[opt=nil] number nyquist Nyquist frequency, if specifying
-- normalized cutoff frequencies
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:ComplexFloat32 > out:ComplexFloat32
--
Expand All @@ -32,10 +32,10 @@ local FIRFilterBlock = require('radio.blocks.signal.firfilter')

local ComplexBandpassFilterBlock = block.factory("ComplexBandpassFilterBlock", FIRFilterBlock)

function ComplexBandpassFilterBlock:instantiate(num_taps, cutoffs, nyquist, window_type)
function ComplexBandpassFilterBlock:instantiate(num_taps, cutoffs, nyquist, window)
assert(num_taps, "Missing argument #1 (num_taps)")
self.cutoffs = assert(cutoffs, "Missing argument #2 (cutoffs)")
self.window_type = window_type or "hamming"
self.window = window or "hamming"
self.nyquist = nyquist

FIRFilterBlock.instantiate(self, types.ComplexFloat32.vector(num_taps))
Expand All @@ -47,7 +47,7 @@ function ComplexBandpassFilterBlock:initialize()

-- Generate taps
local cutoffs = {self.cutoffs[1]/nyquist, self.cutoffs[2]/nyquist}
local taps = filter_utils.firwin_complex_bandpass(self.taps.length, cutoffs, self.window_type)
local taps = filter_utils.firwin_complex_bandpass(self.taps.length, cutoffs, self.window)
self.taps = types.ComplexFloat32.vector_from_array(taps)

FIRFilterBlock.initialize(self)
Expand Down
8 changes: 4 additions & 4 deletions radio/blocks/signal/complexbandstopfilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-- @tparam {number,number} cutoffs Cutoff frequencies in Hz
-- @tparam[opt=nil] number nyquist Nyquist frequency, if specifying
-- normalized cutoff frequencies
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:ComplexFloat32 > out:ComplexFloat32
--
Expand All @@ -32,10 +32,10 @@ local FIRFilterBlock = require('radio.blocks.signal.firfilter')

local ComplexBandstopFilterBlock = block.factory("ComplexBandstopFilterBlock", FIRFilterBlock)

function ComplexBandstopFilterBlock:instantiate(num_taps, cutoffs, nyquist, window_type)
function ComplexBandstopFilterBlock:instantiate(num_taps, cutoffs, nyquist, window)
assert(num_taps, "Missing argument #1 (num_taps)")
self.cutoffs = assert(cutoffs, "Missing argument #2 (cutoffs)")
self.window_type = window_type or "hamming"
self.window = window or "hamming"
self.nyquist = nyquist

FIRFilterBlock.instantiate(self, types.ComplexFloat32.vector(num_taps))
Expand All @@ -47,7 +47,7 @@ function ComplexBandstopFilterBlock:initialize()

-- Generate taps
local cutoffs = {self.cutoffs[1]/nyquist, self.cutoffs[2]/nyquist}
local taps = filter_utils.firwin_complex_bandstop(self.taps.length, cutoffs, self.window_type)
local taps = filter_utils.firwin_complex_bandstop(self.taps.length, cutoffs, self.window)
self.taps = types.ComplexFloat32.vector_from_array(taps)

FIRFilterBlock.initialize(self)
Expand Down
8 changes: 4 additions & 4 deletions radio/blocks/signal/highpassfilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- @tparam number cutoff Cutoff frequency in Hz
-- @tparam[opt=nil] number nyquist Nyquist frequency, if specifying a
-- normalized cutoff frequency
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:ComplexFloat32 > out:ComplexFloat32
-- @signature in:Float32 > out:Float32
Expand All @@ -29,10 +29,10 @@ local FIRFilterBlock = require('radio.blocks.signal.firfilter')

local HighpassFilterBlock = block.factory("HighpassFilterBlock", FIRFilterBlock)

function HighpassFilterBlock:instantiate(num_taps, cutoff, nyquist, window_type)
function HighpassFilterBlock:instantiate(num_taps, cutoff, nyquist, window)
assert(num_taps, "Missing argument #1 (num_taps)")
self.cutoff = assert(cutoff, "Missing argument #2 (cutoff)")
self.window_type = window_type or "hamming"
self.window = window or "hamming"
self.nyquist = nyquist

FIRFilterBlock.instantiate(self, types.Float32.vector(num_taps))
Expand All @@ -43,7 +43,7 @@ function HighpassFilterBlock:initialize()
local nyquist = self.nyquist or (self:get_rate()/2)

-- Generate taps
local taps = filter_utils.firwin_highpass(self.taps.length, self.cutoff/nyquist, self.window_type)
local taps = filter_utils.firwin_highpass(self.taps.length, self.cutoff/nyquist, self.window)
self.taps = types.Float32.vector_from_array(taps)

FIRFilterBlock.initialize(self)
Expand Down
8 changes: 4 additions & 4 deletions radio/blocks/signal/hilberttransform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-- @category Spectrum Manipulation
-- @block HilbertTransformBlock
-- @tparam number num_taps Number of FIR taps, must be odd
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:Float32 > out:ComplexFloat32
--
Expand All @@ -24,13 +24,13 @@ local filter_utils = require('radio.blocks.signal.filter_utils')

local HilbertTransformBlock = block.factory("HilbertTransformBlock")

function HilbertTransformBlock:instantiate(num_taps, window_type)
function HilbertTransformBlock:instantiate(num_taps, window)
assert(num_taps, "Missing argument #1 (num_taps)")
assert((num_taps % 2) == 1, "Number of taps must be odd")
window_type = window_type or "hamming"
window = window or "hamming"

-- Generate Hilbert transform taps
local taps = filter_utils.fir_hilbert_transform(num_taps, window_type)
local taps = filter_utils.fir_hilbert_transform(num_taps, window)
self.hilbert_taps = types.Float32.vector_from_array(taps)

self:add_type_signature({block.Input("in", types.Float32)}, {block.Output("out", types.ComplexFloat32)})
Expand Down
8 changes: 4 additions & 4 deletions radio/blocks/signal/lowpassfilter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- @tparam number cutoff Cutoff frequency in Hz
-- @tparam[opt=nil] number nyquist Nyquist frequency, if specifying a
-- normalized cutoff frequency
-- @tparam[opt='hamming'] string window_type Window type
-- @tparam[opt='hamming'] string window Window type
--
-- @signature in:ComplexFloat32 > out:ComplexFloat32
-- @signature in:Float32 > out:Float32
Expand All @@ -29,10 +29,10 @@ local FIRFilterBlock = require('radio.blocks.signal.firfilter')

local LowpassFilterBlock = block.factory("LowpassFilterBlock", FIRFilterBlock)

function LowpassFilterBlock:instantiate(num_taps, cutoff, nyquist, window_type)
function LowpassFilterBlock:instantiate(num_taps, cutoff, nyquist, window)
assert(num_taps, "Missing argument #1 (num_taps)")
self.cutoff = assert(cutoff, "Missing argument #2 (cutoff)")
self.window_type = window_type or "hamming"
self.window = window or "hamming"
self.nyquist = nyquist

FIRFilterBlock.instantiate(self, types.Float32.vector(num_taps))
Expand All @@ -43,7 +43,7 @@ function LowpassFilterBlock:initialize()
local nyquist = self.nyquist or (self:get_rate()/2)

-- Generate taps
local taps = filter_utils.firwin_lowpass(self.taps.length, self.cutoff/nyquist, self.window_type)
local taps = filter_utils.firwin_lowpass(self.taps.length, self.cutoff/nyquist, self.window)
self.taps = types.Float32.vector_from_array(taps)

FIRFilterBlock.initialize(self)
Expand Down

0 comments on commit 2ba0040

Please sign in to comment.