#!/usr/bin/env python3
#
# Tests Transform functions in Pints
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
from __future__ import division
import unittest
import pints


class TestTransform(unittest.TestCase):

    def test_log_transform(self):

        # Test input parameters
        t1 = pints.LogTransform(1)
        t4 = pints.LogTransform(4)

        p = [0.1, 1., 10., 999.]
        x = [-2.3025850929940455, 0., 2.3025850929940459, 6.9067547786485539]

        # Test forward transform
        for xi, pi in zip(x, p):
            calc_xi = t1.to_search(pi)
            self.assertAlmostEqual(calc_xi, xi)

        # Test inverse transform
        for xi, pi in zip(x, p):
            calc_pi = t1.to_model(xi)
            self.assertAlmostEqual(calc_pi, pi)

        # Test n_parameters
        self.assertEqual(t1.n_parameters(), 1)
        self.assertEqual(t4.n_parameters(), 4)

        # Test Jacobian

        # Test log-Jacobian determinant


if __name__ == '__main__':
    unittest.main()

@@ -317,16 +317,35 @@
 t pints%0A
+import numpy as np%0A
 %0A%0Aclass 
@@ -348,16 +348,19 @@
 ass Test
+Log
 Transfor
@@ -399,28 +399,71 @@
 est_
-log_transform(self):
+creation(self):%0A        # Test transform object is working fine
 %0A%0A  
@@ -673,16 +673,69 @@
 6485539%5D
+%0A        j = np.diag(p)%0A        log_j_det = np.sum(x)
 %0A%0A      
@@ -880,16 +880,73 @@
 _xi, xi)
+%0A        self.assertTrue(np.allclose(t4.to_search(p), x))
 %0A%0A      
@@ -1090,16 +1090,72 @@
 _pi, pi)
+%0A        self.assertTrue(np.allclose(t4.to_model(x), p))
 %0A%0A      
@@ -1299,48 +1299,544 @@
 ian%0A
-%0A        # Test log-Jacobian determinant
+        self.assertTrue(np.allclose(t4.jacobian(x), j))%0A%0A        # Test log-Jacobian determinant%0A        self.assertEqual(t4.log_jacobian_det(x), log_j_det)%0A%0A    def test_optimisation(self):%0A        # Test passing to optimisation%0A        pass%0A%0A        # Test sigma0 inputs?%0A%0A        # Test return solution shape%0A%0A        # Test return solution transform%0A%0A    def test_sampling(self):%0A        # Test passing to sampling%0A        pass%0A%0A        # Test sigma0 inputs?%0A%0A        # Test return chain shape%0A%0A        # Test return chain transform
 %0A%0A%0Ai

Add tests for jacobian and outline more tests