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()
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)
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)
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)
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)