def test_NRZ_bits(self):
     x, b, data = ss.NRZ_bits(25, 8)
     b_check = np.array([ 0.125,  0.125,  0.125,  0.125,  0.125,  0.125,  0.125,  0.125])
     x_vals = [-1, 1]
     data_vals = [0, 1]
     for bit in x:
         x_check = bit in x_vals
         self.assertEqual(x_check, True)
     npt.assert_equal(b, b_check)
     for bit in data:
         data_check = bit in data_vals
         self.assertEqual(data_check, True)
Exemple #2
0
 def test_bit_errors(self):
     x, b, data = ss.NRZ_bits(1000000, 10)
     y = ss.cpx_AWGN(x, 12, 10)
     z = signal.lfilter(b, 1, y)
     Pe_hat = ss.bit_errors(z, data, 10, 10)
     npt.assert_almost_equal(Pe_hat, 3.0000030000030001e-06, decimal=5)
Exemple #3
0
 def test_NRZ_bits_value_error(self):
     with self.assertRaisesRegexp(
             ValueError, 'pulse type must be rec, rc, or src') as NRZ_err:
         x, b, data = ss.NRZ_bits(100, 10, pulse='value')
Exemple #4
0
 def test_NRZ_bits_3(self):
     Tspan = 10  # Time span in seconds
     PN, b, data = ss.NRZ_bits(1000 * Tspan, 8000 / 1000)