Class: Digiproc::Factories::WindowFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/factories/window_factory.rb

Overview

Factory class for Windows. Can output Digiproc::HanningWindow, Digiproc::HammingWindow, and Digiproc::BlackmanWindow

Class Method Summary collapse

Class Method Details

.window_for(normalized_transition_width:, stopband_attenuation:) ⇒ Object

Decision made based off ofstopband_attenuation Digiproc::Factories::WindowFactory.window_for(normalized_transition_width: 0.05, stopband_attenuation: 60) # => outputs Digiproc::BlackmanWindow instance



10
11
12
13
14
15
16
17
18
19
# File 'lib/factories/window_factory.rb', line 10

def self.window_for(normalized_transition_width: , stopband_attenuation: )
    
    if stopband_attenuation < 40
        return Digiproc::HanningWindow.new(norm_trans_freq: normalized_transition_width)
    elsif stopband_attenuation < 50
        return Digiproc::HammingWindow.new(norm_trans_freq: normalized_transition_width)
    else
        return Digiproc::BlackmanWindow.new(norm_trans_freq: normalized_transition_width)
    end
end