Example #1
0
 def test_rayleigh_is_rician_high_noise(self):
     '''Verify rayleigh becomes rician high noise scipy's statistics module.
     '''
     # Rayleigh is special case of Rician (A=0)
     sigma = 20
     pM = rayleigh(self.M, sigma)
     pM_rician = rician(self.M, 0, sigma)
     self.assertTrue(np.allclose(pM, pM_rician))
Example #2
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))
Example #3
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))
Example #4
0
 def test_rayleigh_is_rician_high_noise(self):
     # Rayleigh is special case of Rician (A=0)
     sigma = 20
     pM = rayleigh(self.M, sigma)
     pM_rician = rician(self.M, 0, sigma)
     self.assertTrue(np.allclose(pM, pM_rician))