def testLinearOddSamples(self): """Tests the correct computation of sample standard deviation for a straight line with an odd number of samples.""" expected = numpy.resize(1.0,self.data.shape) stdRand = numpy.sqrt((2.0*(1.0-2.0/3)**2+4.0/9.0)*0.5) expected[0] = stdRand expected[-1]= stdRand result = OE.localNoise(self.data,samples=3) numpy.testing.assert_array_almost_equal(expected,result,err_msg='Expected local noise is %s, but should be %s.' % (result,expected))
def testLinearEvenSamples(self): """Tests the correct computation of sample standard deviation for a straight line with an even set of samples. """ std = numpy.sqrt(5./3) expected = numpy.resize(std,self.data.shape) stdRand = numpy.sqrt(2./3) expected[:2] = stdRand expected[-1:]= stdRand result = OE.localNoise(self.data,samples=4) numpy.testing.assert_array_almost_equal(expected,result,err_msg='Expected local noise is %s, but should be %s.' % (result,expected))
def testLinearOddSamples(self): """Tests the correct computation of sample standard deviation for a straight line with an odd number of samples.""" expected = numpy.resize(1.0, self.data.shape) stdRand = numpy.sqrt((2.0 * (1.0 - 2.0 / 3)**2 + 4.0 / 9.0) * 0.5) expected[0] = stdRand expected[-1] = stdRand result = OE.localNoise(self.data, samples=3) numpy.testing.assert_array_almost_equal( expected, result, err_msg='Expected local noise is %s, but should be %s.' % (result, expected))
def testLinearEvenSamples(self): """Tests the correct computation of sample standard deviation for a straight line with an even set of samples. """ std = numpy.sqrt(5. / 3) expected = numpy.resize(std, self.data.shape) stdRand = numpy.sqrt(2. / 3) expected[:2] = stdRand expected[-1:] = stdRand result = OE.localNoise(self.data, samples=4) numpy.testing.assert_array_almost_equal( expected, result, err_msg='Expected local noise is %s, but should be %s.' % (result, expected))