Exemple #1
0
 def test_domain(self):
     """Test domain errors."""
     rad = GaussLegendre(10)
     with self.assertRaises(ValueError):
         tf = IdentityRTransform()
         tf.transform_1d_grid(rad)
     with self.assertRaises(ValueError):
         tf = LinearInfiniteRTransform(0.1, 1.5)
         tf.transform_1d_grid(rad)
     with self.assertRaises(ValueError):
         tf = ExpRTransform(0.1, 1e1)
         tf.transform_1d_grid(rad)
     with self.assertRaises(ValueError):
         tf = PowerRTransform(1e-3, 1e2)
         tf.transform_1d_grid(rad)
     with self.assertRaises(ValueError):
         tf = HyperbolicRTransform(0.4 / 450, 1.0 / 450)
         tf.transform_1d_grid(rad)
Exemple #2
0
 def test_hyperbolic_bounds(self):
     """Test hyperbolic tf raise errors."""
     with self.assertRaises(ValueError):
         HyperbolicRTransform(0, 1.0 / 450)
     with self.assertRaises(ValueError):
         HyperbolicRTransform(-0.1, 1.0 / 450)
     a = np.ones(450)
     tf = HyperbolicRTransform(0.4, 1.0)
     with self.assertRaises(ValueError):
         tf.transform(a)
     with self.assertRaises(ValueError):
         tf.deriv(a)
     with self.assertRaises(ValueError):
         tf.deriv2(a)
     with self.assertRaises(ValueError):
         tf.deriv3(a)
     with self.assertRaises(ValueError):
         tf.inverse(a)
     with self.assertRaises(ValueError):
         a = np.ones(3)
         tf = HyperbolicRTransform(0.4, 0.5)
         tf.transform(a)
     with self.assertRaises(ValueError):
         HyperbolicRTransform(0.2, 0.0)
     with self.assertRaises(ValueError):
         HyperbolicRTransform(0.2, -1.0)
Exemple #3
0
 def test_hyperbolic_properties(self):
     """Test hyperbolic tf properties."""
     rtf = HyperbolicRTransform(0.4 / 450, 1.0 / 450)
     assert rtf.a == 0.4 / 450
     assert rtf.b == 1.0 / 450
Exemple #4
0
 def test_hyperbolic_basics(self):
     """Test hyperbolic tf."""
     rtf = HyperbolicRTransform(0.4 / 450, 1.0 / 450)
     self.check_consistency(rtf)
     self.check_deriv(rtf)