예제 #1
0
    def test_setup_binup_logbinFalse(self):

        x = [1234.,3365.,4407.,5657.,4479.0,6535.]
        y = [1]*len(x)
        yerr = y
        logbin = False
        binsize = 100
        xarr = calc.big_spec(x,binsize,logbin)

        x_control = numpy.array(x)

        x, xarr, y, m_yerr, nx, xbin, yarr, outerr, count, skipit = calc.setup_binup_arrays(y, x, xarr, binsize, yerr, logbin=logbin)

        numpy.testing.assert_array_almost_equal(x, x_control)
        self.assertEqual(xbin, 50.0)
        self.assertEqual(len(m_yerr), len(x))
예제 #2
0
    def test_setup_binup_logbinTrue(self):

        x = [1234.,3365.,4407.,5657.,4479.0,6535.]
        y = [1]*len(x)
        yerr = y
        logbin = True
        binsize = 0.1
        xarr = calc.big_spec(x,binsize,logbin)

        x_control = numpy.log10(x)

        x, xarr, y, m_yerr, nx, xbin, yarr, outerr, count, skipit = calc.setup_binup_arrays(y, x, xarr, binsize, yerr, logbin=logbin)

        numpy.testing.assert_array_almost_equal(x, x_control)
        self.assert_(isinstance(xarr, numpy.ndarray))
        self.assertEqual(xbin, 0.05)
        self.assertEqual(len(yarr), nx)