Esempio n. 1
0
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' )
Esempio n. 2
0
    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")
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
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))
Esempio n. 7
0
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"))
Esempio n. 8
0
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"))
Esempio n. 9
0
    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")
Esempio n. 10
0
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')
Esempio n. 11
0
    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)
Esempio n. 12
0
 def setUp(self):
     self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT)
     self.module = AnalysisModule(self.rng, name="STD_ENKF")
Esempio n. 13
0
 def createAnalysisModule(self):
     return AnalysisModule(self.rng, lib_name = self.libname)
Esempio n. 14
0
 def createAnalysisModule(self):
     rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN, RngInitModeEnum.INIT_DEFAULT)
     return AnalysisModule(rng, self.user, self.libname)
Esempio n. 15
0
 def createAnalysisModule(self):
     return AnalysisModule(self.rng, self.user, self.libname)
Esempio n. 16
0
 def setUp(self):
     self.rng = RandomNumberGenerator(RngAlgTypeEnum.MZRAN,
                                      RngInitModeEnum.INIT_DEFAULT)
     self.module = AnalysisModule(self.rng, name="STD_ENKF")
Esempio n. 17
0
 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)
Esempio n. 18
0
 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)
Esempio n. 19
0
    def test_create_internal(self):
        with self.assertRaises(KeyError):
            mod = AnalysisModule(self.rng, name="STD_ENKFXXX")

        mod = AnalysisModule(self.rng, name="STD_ENKF")