コード例 #1
0
ファイル: test_rtransform.py プロジェクト: tovrstra/grid
 def test_linear_basics(self):
     """Test linear tf."""
     gd = np.ones(100) * 0
     rtf = LinearRTransform(-0.7, 0.8)
     assert abs(rtf.transform(gd)[0] - -0.7) < 1e-15
     gd = np.ones(100) * 99
     assert abs(rtf.transform(gd)[0] - 0.8) < 1e-10
     self.check_consistency(rtf)
     self.check_deriv(rtf)
コード例 #2
0
ファイル: test_rtransform.py プロジェクト: leila-pujal/grid
 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 = LinearRTransform(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)
コード例 #3
0
ファイル: test_rtransform.py プロジェクト: tovrstra/grid
 def test_linear_bounds(self):
     """Test linear tf raise errors."""
     with self.assertRaises(ValueError):
         LinearRTransform(1.1, 0.9)
コード例 #4
0
ファイル: test_rtransform.py プロジェクト: tovrstra/grid
 def test_linear_properties(self):
     """Test linear tf properties."""
     rtf = LinearRTransform(-0.7, 0.8)
     assert rtf.rmin == -0.7
     assert rtf.rmax == 0.8