Exemplo n.º 1
0
    def test_rayleigh_mean_high_noise(self):
        sigma = 20
        rv = rayleigh_scipy()
        M_scipy = rv.mean() * sigma

        # Do ours
        M = rayleigh_mean(sigma)

        self.assertEqual(M, M_scipy)
Exemplo n.º 2
0
    def test_rayleigh_mean_high_noise(self):
        '''Verify mean of high noise case with scipy's statistics module.'''
        sigma = 20
        rv = rayleigh_scipy()
        M_scipy = rv.mean() * sigma

        # Do ours
        M = rayleigh_mean(sigma)

        self.assertEqual(M, M_scipy)
Exemplo n.º 3
0
    def test_rayleigh_high_noise(self):
        sigma = 20
        rv = rayleigh_scipy()
        pM_scipy = rv.pdf(self.M)
        # Expressions for dist are different in paper and scipy, correction
        # factor to convert between them
        pM_scipy *= np.exp(self.M**2 / 2 - self.M**2 /
                           (2 * sigma**2)) / (sigma**2)

        # Do ours
        pM = rayleigh(self.M, sigma)

        self.assertTrue(np.allclose(pM, pM_scipy))
Exemplo n.º 4
0
    def test_rayleigh_low_noise(self):
        '''Verify rayleigh low noise case against scipy's statistics module.'''
        sigma = .8
        rv = rayleigh_scipy()
        pM_scipy = rv.pdf(self.M)
        # Expressions for dist are different in paper and scipy, correction
        # factor to convert between them
        pM_scipy *= np.exp(self.M**2 / 2 - self.M**2 /
                           (2 * sigma**2)) / (sigma**2)

        # Do ours
        pM = rayleigh(self.M, sigma)

        self.assertTrue(np.allclose(pM, pM_scipy))