class StdEnKFTest(ExtendedTestCase): def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.module = AnalysisModule( self.rng , name = "STD_ENKF" ) def toggleKey(self, key): self.assertTrue( self.module.hasVar( key )) # check it is true self.assertTrue( self.module.setVar( key , True ) ) self.assertTrue( self.module.getBool(key) ) # set it to false self.assertTrue( self.module.setVar( key , False ) ) self.assertFalse( self.module.getBool(key) ) def test_EE_option(self): self.toggleKey( 'USE_EE' ) def test_GE_option(self): self.toggleKey( 'USE_GE' ) def test_scaledata_option(self): self.toggleKey( 'ANALYSIS_SCALE_DATA' )
def test_set_get_var(self): mod = AnalysisModule( self.rng , name = "STD_ENKF" ) with self.assertRaises(KeyError): mod.setVar("NO-NOT_THIS_KEY" , 100) with self.assertRaises(KeyError): mod.getInt("NO-NOT_THIS_KEY")
def test_initX_enkf_linalg_lowrankCinv(self): """Test AnalysisModule.initX with EE=False and GE=False""" mod = AnalysisModule(self.rng, name="STD_ENKF") A, S, R, dObs, E, D = self._n_identity_mcs() self.assertFalse(mod.getBool('USE_EE')) self.assertFalse(mod.getBool('USE_GE')) elt_a, elt_b = 1.222, -0.111 vals = (elt_a, elt_b, elt_b, elt_b, elt_a, elt_b, elt_b, elt_b, elt_a) expected = self.construct_matrix(3, vals) X = mod.initX(A, S, R, dObs, E, D) self._matrix_close(X, expected)
def test_initX_enkf_linalg_lowrankCinv(self): """Test AnalysisModule.initX with EE=False and GE=False""" mod = AnalysisModule( self.rng , name = "STD_ENKF" ) A, S, R, dObs, E, D = self._n_identity_mcs() self.assertFalse(mod.getBool('USE_EE')) self.assertFalse(mod.getBool('USE_GE')) elt_a, elt_b = 1.222, -0.111 vals = (elt_a, elt_b, elt_b, elt_b, elt_a, elt_b, elt_b, elt_b, elt_a) expected = self.construct_matrix(3, vals) X = mod.initX(A, S, R, dObs, E, D) self._matrix_close(X, expected)
def test_initX_subspace_inversion_algorithm(self): """Test AnalysisModule.initX with EE=True and GE=True, the subspace inversion algorithm""" mod = AnalysisModule( self.rng , name = "STD_ENKF" ) A, S, R, dObs, E, D = self._n_identity_mcs() mod.setVar('USE_EE', True) mod.setVar('USE_GE', True) self.assertTrue(mod.getBool('USE_EE')) self.assertTrue(mod.getBool('USE_GE')) vals = ( 1.39, -0.111, -0.278, -0.111, 1.39, -0.278, -0.278, -0.278, 1.56 ) expected = self.construct_matrix(3, vals) X = mod.initX(A, S, R, dObs, E, D) self._matrix_close(X, expected)
class StdEnKFTest(ExtendedTestCase): def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.module = AnalysisModule(self.rng, name="STD_ENKF") def test_EE_option(self): self.assertTrue(self.module.setVar("USE_EE", True))
class StdEnKFDebugTest(ExtendedTestCase): def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.libname = ert.ert_lib_path + "/std_enkf_debug.so" self.module = AnalysisModule(self.rng, lib_name=self.libname) def toggleKey(self, key): self.assertTrue(self.module.hasVar(key)) # check it is true self.assertTrue(self.module.setVar(key, True)) self.assertTrue(self.module.getBool(key)) # set it to false self.assertTrue(self.module.setVar(key, False)) self.assertFalse(self.module.getBool(key)) def test_EE_option(self): self.toggleKey('USE_EE') def test_scaledata_option(self): self.toggleKey('ANALYSIS_SCALE_DATA') def test_prefix(self): self.assertTrue(self.module.hasVar("PREFIX")) self.assertTrue(self.module.setVar("PREFIX", "Path"))
class StdEnKFDebugTest(ExtendedTestCase): def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.libname = ert.ert_lib_path + "/std_enkf_debug.so" self.module = AnalysisModule(self.rng, lib_name=self.libname) def toggleKey(self, key): self.assertTrue(self.module.hasVar(key)) # check it is true self.assertTrue(self.module.setVar(key, True)) self.assertTrue(self.module.getBool(key)) # set it to false self.assertTrue(self.module.setVar(key, False)) self.assertFalse(self.module.getBool(key)) def test_EE_option(self): self.toggleKey("USE_EE") def test_scaledata_option(self): self.toggleKey("ANALYSIS_SCALE_DATA") def test_prefix(self): self.assertTrue(self.module.hasVar("PREFIX")) self.assertTrue(self.module.setVar("PREFIX", "Path"))
def test_set_get_var(self): mod = AnalysisModule(self.rng, name="STD_ENKF") with self.assertRaises(KeyError): mod.setVar("NO-NOT_THIS_KEY", 100) with self.assertRaises(KeyError): mod.getInt("NO-NOT_THIS_KEY")
class StdEnKFTest(ExtendedTestCase): def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.module = AnalysisModule(self.rng, name="STD_ENKF") def toggleKey(self, key): self.assertTrue(self.module.hasVar(key)) # check it is true self.assertTrue(self.module.setVar(key, True)) self.assertTrue(self.module.getBool(key)) # set it to false self.assertTrue(self.module.setVar(key, False)) self.assertFalse(self.module.getBool(key)) def test_EE_option(self): self.toggleKey('USE_EE') def test_scaledata_option(self): self.toggleKey('ANALYSIS_SCALE_DATA')
def test_initX_subspace_inversion_algorithm(self): """Test AnalysisModule.initX with EE=True and GE=True, the subspace inversion algorithm""" mod = AnalysisModule(self.rng, name="STD_ENKF") A, S, R, dObs, E, D = self._n_identity_mcs() mod.setVar('USE_EE', True) mod.setVar('USE_GE', True) self.assertTrue(mod.getBool('USE_EE')) self.assertTrue(mod.getBool('USE_GE')) vals = (1.39, -0.111, -0.278, -0.111, 1.39, -0.278, -0.278, -0.278, 1.56) expected = self.construct_matrix(3, vals) X = mod.initX(A, S, R, dObs, E, D) self._matrix_close(X, expected)
def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.module = AnalysisModule(self.rng, name="STD_ENKF")
def createAnalysisModule(self): return AnalysisModule(self.rng, lib_name = self.libname)
def createAnalysisModule(self): rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) return AnalysisModule(rng, self.user, self.libname)
def createAnalysisModule(self): return AnalysisModule(self.rng, self.user, self.libname)
def setUp(self): self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT) self.libname = ert.ert_lib_path + "/std_enkf_debug.so" self.module = AnalysisModule(self.rng, lib_name=self.libname)
def test_create_internal(self): with self.assertRaises(KeyError): mod = AnalysisModule(self.rng, name="STD_ENKFXXX") mod = AnalysisModule(self.rng, name="STD_ENKF")