class Digiproc::WindowStrategy
Parent class to all types of windows
Constants
- PI
Attributes
data[R]
equation[R]
size[RW]
values[R]
Public Class Methods
new(size: )
click to toggle source
Initialize with size: Numeric (numnber of datapoints in window)
# File lib/strategies/window/window.rb, line 13 def initialize(size: ) @size = size @equation = lambda { |n| 1 } end
Public Instance Methods
calculate()
click to toggle source
No input args calculate the window values
# File lib/strategies/window/window.rb, line 21 def calculate values = [] for n in 0...size values << @equation.call(n) end @values = values @data = values end
make_odd(num)
click to toggle source
Make the number of datapoints in the window odd so that it can be used for all types of filters
# File lib/strategies/window/window.rb, line 33 def make_odd(num) num.odd? ? num : num + 1 end
to_signal()
click to toggle source
Return window values as a Digiproc::DigitalSignal
# File lib/strategies/window/window.rb, line 38 def to_signal Digiproc::DigitalSignal.new(data: values) end