Beispiel #1
0
    def testSine(self):
        """
        TEST length, discontinuity, period etc.
        """
        plugin_path = os.path.dirname(WaveGen.__file__) + "/plugins"
        plugin_name = "Sine"

        available_plugins = importPluginModulesIn(plugin_path)
        plugin_creator = findPluginCreator(plugin_name, available_plugins)

        param = {"SAMPLING_RATE": 1024, "BIAS": 15.0, "F": 4.0, "AMP": 1.5}

        T = 4.0
        selected_plugin = plugin_creator(**param)
        waveform = WaveGen.SomeWave()
        waveform.bind(selected_plugin)

        sin_wave = waveform.getAll(T=T)
        self.assertEqual(len(sin_wave), T * param["SAMPLING_RATE"], "Wrong length")
Beispiel #2
0
    def testSeq(self):
        """
        TEST length
        """
        plugin_path = os.path.dirname(WaveGen.__file__) + "/plugins"
        plugin_name = "Seq"

        available_plugins = importPluginModulesIn(plugin_path)
        plugin_creator = findPluginCreator(plugin_name, available_plugins)

        param = {
            "SAMPLING_RATE": 1024,
            "TIME": [0.0, 0.06, 0.07, 0.24, 0.26, 0.43, 0.44, 0.5, 0.5, 0.56, 0.57, 0.74, 0.76, 0.93, 0.94, 1.0],
            "VALUE": [0.0, 0.0, 1.0, 1.0, -1.0, -1.0, 0.0, 0.0, 0.0, 0.0, -1.0, -1.0, 1.0, 1.0, 0.0, 0.0],
        }
        T = 4.0
        selected_plugin = plugin_creator(**param)
        some_wave = WaveGen.SomeWave()
        some_wave.bind(selected_plugin)
        wave_dut = some_wave.getAll(T=T)
        self.assertEqual(len(wave_dut), T * param["SAMPLING_RATE"], "Wrong length")
        plot(wave_dut)
        show()
Beispiel #3
0
    nerfModel.onClkRate(sim_speed) # 1x realtime
    xemList.append(nerfModel)
    
    


    
    
    """ test WaveGen """
    import os
    from WaveGen.utils import importPluginModulesIn, findPluginCreator
    plugin_path = os.path.dirname(WaveGen.__file__) + '/plugins'
    plugin_name = "Sine"
    
    available_plugins = importPluginModulesIn(plugin_path)
    plugin_creator = findPluginCreator(plugin_name, available_plugins)
    
    #sampling rate 1024
    param = {'SAMPLING_RATE' : 128, \
    'BIAS' : 0.0, \
    'F': 1.0, \
    'AMP': 20.0}
    T=2.0
    #param = {'SAMPLING_RATE' : 100, \
    #'TIME' :  [0.0, 0.2, 0.4, 1.0], \
    #'VALUE' : [0.0, 30.0, 30.0, 0.0]}
    #T = 1.0
    
    #T = 2.0  # length of data in s
    selected_plugin = plugin_creator(**param)
    waveform = WaveGen.SomeWave()