예제 #1
0
파일: am.py 프로젝트: aleneus/dsplab
def main():
    """Run example."""
    T = 10
    fs = 100
    f = 1
    x, t = amp_mod(
        length=T,
        sample_rate=fs,
        freq=f,
        func=modulator,
    )
    plt.plot(t, x)
    plt.show()
예제 #2
0
 def test_noise_ph_touch(self):
     xs = mod.amp_mod(1, 50, lambda t: 1, 1, noise_ph=lambda: 0)[0]
     self.assertEqual(len(xs), 50)
예제 #3
0
 def test_noise_amp(self):
     xs = mod.amp_mod(1, 50, lambda t: 1, 1, noise_amp=lambda: 1)[0]
     self.assertEqual(max(xs), 2)
     self.assertEqual(min(xs), 0)
예제 #4
0
 def test_result_len(self):
     xs, ts = mod.amp_mod(1, 50, lambda t: 1, 10)
     self.assertEqual(len(xs), 50)
     self.assertEqual(len(ts), 50)
예제 #5
0
 def test_empty(self):
     xs, ts = mod.amp_mod(0, 50, lambda t: 1, 10)
     self.assertEqual(len(xs), 0)
     self.assertEqual(len(ts), 0)