Esempio n. 1
0
 def test_should_return_0_above_alpha_max(self):
     scaler = restraints.NonLinearScaler(0.2, 0.8, 4, 1.0, 0.0)
     self.assertAlmostEqual(scaler(0.9), 0.0)
Esempio n. 2
0
 def test_midpoint_should_return_correct_value(self):
     scaler = restraints.NonLinearScaler(0.2, 0.8, 4, 1.0, 0.0)
     self.assertAlmostEqual(scaler(0.5), 0.119202922)
Esempio n. 3
0
 def test_should_raise_if_alpha_is_above_one(self):
     scaler = restraints.NonLinearScaler(0.2, 0.8, 4)
     with self.assertRaises(RuntimeError):
         scaler(2)
Esempio n. 4
0
 def test_should_return_1_below_alpha_min(self):
     scaler = restraints.NonLinearScaler(0.2, 0.8, 4, 1.0, 0.0)
     self.assertAlmostEqual(scaler(0.1), 1.0)
Esempio n. 5
0
 def test_should_raise_if_alpha_is_below_zero(self):
     scaler = restraints.NonLinearScaler(0.2, 0.8, 4)
     with self.assertRaises(RuntimeError):
         scaler(-1)
Esempio n. 6
0
 def test_should_raise_if_factor_below_one(self):
     with self.assertRaises(RuntimeError):
         restraints.NonLinearScaler(0.0, 1.0, 0.2)
Esempio n. 7
0
 def test_should_raise_if_alpha_max_less_than_alpha_min(self):
     with self.assertRaises(RuntimeError):
         restraints.NonLinearScaler(0.7, 0.6, 4)
Esempio n. 8
0
 def test_should_raise_when_alpha_max_above_one(self):
     with self.assertRaises(RuntimeError):
         restraints.NonLinearScaler(1, 2, 4)
Esempio n. 9
0
 def test_should_raise_when_alpha_max_below_zero(self):
     with self.assertRaises(RuntimeError):
         restraints.NonLinearScaler(1, -1, 4)