def test_compute_conversion(self): rmg = OptimizeTest.rmg target_label = OptimizeTest.target_label reactionModel = rmg.reactionModel atol, rtol = rmg.absoluteTolerance, rmg.relativeTolerance index = 0 reactionSystem = rmg.reactionSystems[index] conv = compute_conversion(target_label, reactionModel, reactionSystem, index,\ rmg.absoluteTolerance, rmg.relativeTolerance) self.assertIsNotNone(conv)
def test_reduce_compute(self): rmg = OptimizeTest.rmg target_label = OptimizeTest.target_label reactionModel = rmg.reactionModel atol, rtol = rmg.absoluteTolerance, rmg.relativeTolerance index = 0 reactionSystem = rmg.reactionSystems[index] orig_conv = compute_conversion(target_label, reactionModel, reactionSystem, index,\ rmg.absoluteTolerance, rmg.relativeTolerance) tols = [0.7, 1e-3, 1e-6] for tol in tols: conv = reduce_compute(tol, target_label, reactionModel, rmg, index) self.assertIsNotNone(conv)
def test_optimize(self): rmg = OptimizeTest.rmg target_label = OptimizeTest.target_label error = OptimizeTest.error reactionModel = rmg.reactionModel atol, rtol = rmg.absoluteTolerance, rmg.relativeTolerance index = 0 reactionSystem = rmg.reactionSystems[index] #compute original target conversion Xorig = compute_conversion(target_label, reactionModel, reactionSystem, index,\ rmg.absoluteTolerance, rmg.relativeTolerance) # optimize reduction tolerance tol = optimize_tolerance(target_label, reactionModel, rmg, index, error, Xorig) self.assertAlmostEqual(1e-04, tol)