def test_hlog_inv(self):
        expected = _xall
        result = trans.hlog_inv(trans.hlog(_xall))
        d = (result - expected) / expected
        assert_almost_equal(d, np.zeros(len(d)), decimal=2)

        result = trans.hlog_inv(trans.hlog(_xall, b=10), b=10)
        d = (result - expected) / expected
        assert_almost_equal(d, np.zeros(len(d)), decimal=2)
Exemple #2
0
    def test_hlog_inv(self):
        expected = _xall
        result = trans.hlog_inv(trans.hlog(_xall))
        d = (result - expected) / expected
        assert_almost_equal(d, np.zeros(len(d)), decimal=2)

        result = trans.hlog_inv(trans.hlog(_xall, b=10), b=10)
        d = (result - expected) / expected
        assert_almost_equal(d, np.zeros(len(d)), decimal=2)
 def test_hlog(self):
     hlpos = trans.hlog(_xpos)
     hlneg = trans.hlog(_xneg)
     assert_almost_equal((hlpos[-1] - _ymax) / _ymax, 0, decimal=2)
     assert_almost_equal(hlpos, -hlneg[::-1])  # check symmetry
     # test that values get larger as b decreases
     hlpos10 = trans.hlog(_xpos, b=10)
     self.assertTrue(np.all(hlpos10 >= hlpos))
     # check that converges to tlog for large values
     tlpos = trans.tlog(_xpos)
     i = np.where(_xpos > 1e4)[0]
     tlpos_large = tlpos[i]
     hlpos_large = hlpos10[i]
     d = (hlpos_large - tlpos_large) / hlpos_large
     assert_almost_equal(d, np.zeros(len(d)), decimal=2)
     # test spline option
     result1 = trans.hlog(_xall, use_spln=True)
     result2 = trans.hlog(_xall, use_spln=False)
     d = (result1 - result2) / result1
     assert_almost_equal(d, np.zeros(len(d)), decimal=2)
Exemple #4
0
 def test_hlog(self):
     hlpos = trans.hlog(_xpos)
     hlneg = trans.hlog(_xneg)
     assert_almost_equal((hlpos[-1] - _ymax) / _ymax, 0, decimal=2)
     assert_almost_equal(hlpos, -hlneg[::-1])  # check symmetry
     # test that values get larger as b decreases
     hlpos10 = trans.hlog(_xpos, b=10)
     self.assertTrue(np.all(hlpos10 >= hlpos))
     # check that converges to tlog for large values
     tlpos = trans.tlog(_xpos)
     i = np.where(_xpos > 1e4)[0]
     tlpos_large = tlpos[i]
     hlpos_large = hlpos10[i]
     d = (hlpos_large - tlpos_large) / hlpos_large
     assert_almost_equal(d, np.zeros(len(d)), decimal=2)
     # test spline option
     transformation = Transformation(transform='hlog', direction='forward')
     result1 = transformation(_xall, use_spln=True)
     result2 = transformation(_xall, use_spln=False)
     d = (result1 - result2) / result1
     assert_almost_equal(d, np.zeros(len(d)), decimal=2)