コード例 #1
-1
ファイル: test_channel.py プロジェクト: sgwoodjr/velvet
 def test_awgn(self):
     x = np.arange(4) + 1j*np.arange(4)
     np.random.seed(0)
     y = vt.awgn(x, 20)
     yCorrect = np.array([ 0.33002397+0.34938811j,  1.07486256+0.81716805j,
         2.18310511+2.17774527j,  3.41923273+2.97168366j])
   
     for ind in np.arange(len(y)):
         self.assertAlmostEqual(np.real(y[ind]),np.real(yCorrect[ind]))
         self.assertAlmostEqual(np.imag(y[ind]),np.imag(yCorrect[ind]))
コード例 #2
-2
ファイル: test_channel.py プロジェクト: sgwoodjr/velvet
 def test_awgn_real(self):
     x = np.arange(4)
     np.random.seed(0)
     y = vt.awgn(x,20)
   
     # Can't really decide on a good test. Just make sure the input
     # is not equal to the output.
     for ind in np.arange(len(y)):
         self.assertNotEqual(x[ind], y[ind])