__init__.py 1.11 KB
Newer Older
1
2
3
4
5
6
7
"""
Python version of the congrad minimization algorithm

Mike Fisher (ECMWF), April 2002
Frederic Chevallier (LSCE), April 2004, for the Python adaptation
"""

Antoine Berchet's avatar
Antoine Berchet committed
8
9
from types import MethodType

10
11
from .check import check_options
from .congrad import congrad
Antoine Berchet's avatar
Antoine Berchet committed
12
from .minimize import minimize
13

14
15
_name = "congrad"

Antoine Berchet's avatar
Antoine Berchet committed
16
17
18
19
20
21
22
23
requirements = {
    "simulator": {
        "any": True,
        "empty": True,
        "name": "gausscost",
        "version": "std",
    },
}
24

25
26
27
28
29
30
31
32
33
34
input_arguments = {
    "save_uncertainties": {
        "doc": "Save the estimated eigenvectors of the inverse of the hessian. "
               "They allow the reconstruction of the uncertainty reduction "
               "matrix",
        "default": False,
        "accepted": bool
    }
}

35
36

def ini_data(plugin, **kwargs):
37
38
39
40
41
42
43
44
45
    """Initializes congrad.

    Args:
        plugin (Plugin): options for the variational inversion

    Returns:
        updated plugin

    """
Antoine Berchet's avatar
Antoine Berchet committed
46

47
48
    # Function to check the consistency of options and arguments
    plugin.check_options = MethodType(check_options, plugin)
Antoine Berchet's avatar
Antoine Berchet committed
49

50
51
    # M1QN3 itself
    plugin.congrad = MethodType(congrad, plugin)
Antoine Berchet's avatar
Antoine Berchet committed
52

53
    return plugin