Commit e38c7f2a authored by Antoine Berchet's avatar Antoine Berchet
Browse files

Fix bug in time interpolation when no file available; some doc

parent 75d8f886
......@@ -48,8 +48,11 @@ def execute(self, **kwargs):
Running a variational inversion with the following modules:
Minimizer: {}
Simulator: {}
Size of the control vector: {}
Size of the observation vector: {}
""".format(
minimizer.plugin.name, simulator.plugin.name
minimizer.plugin.name, simulator.plugin.name,
controlvect.dim, obsvect.dim
)
info(towrite)
......
......@@ -10,6 +10,18 @@ The defining equation is:
J(\\mathbf{x}) = \\frac{1}{2} (\\mathbf{x} - \\mathbf{x}^\\textrm{b})^\\textrm{T} (\\mathbf{P}^\\textrm{b})^{-1} (\\mathbf{x} - \\mathbf{x}^\\textrm{b})
+ \\frac{1}{2} (\\mathcal{H}(\\mathbf{x}) - \\mathbf{y}^\\textrm{o})^\\textrm{T}\\mathbf{R}^{-1}(\\mathcal{H}(\\mathbf{x}) - \\mathbf{y}^\\textrm{o})
The Plugin returns both the cost function and its gradient.
The gradient is computed using the formula:
.. math::
\\nabla J_\\mathbf{x} = (\\mathbf{P}^\\textrm{b})^{-1} (\\mathbf{x} - \\mathbf{x}^\\textrm{b})
+ \\mathcal{H}^*\\left[\\mathbf{R}^{-1}(\\mathcal{H}(\\mathbf{x}) - \\mathbf{y}^\\textrm{o})\\right]
All computations of the cost function and its gradient are saved in the folder
:bash:`$workdir/simulator` to make debugging easier, as well as monitoring conveniently
variational inversions during their computation.
"""
import os
......@@ -33,6 +45,21 @@ requirements = {
},
}
input_arguments = {
"reload_from_previous": {
"doc": "Use results from previous computations, i.e., reload simulated "
"concentrations, or adjoint sensitivities from previous observation "
"operator computations",
"default": False,
"accepted": bool
},
"do_svd": {
"doc": "Computes the cost function based on the SVD decomposition",
"default": False,
"accepted": bool
}
}
def ini_data(plugin, **kwargs):
......
......@@ -35,7 +35,7 @@ def simul(self, chi, grad=True, run_id=-1,
datei = self.datei
datef = self.datef
workdir = self.workdir
reload_results = getattr(self, "reload_from_previous", False)
reload_results = self.reload_from_previous
# Get the observation operator from extra arguments
if not hasattr(self, "obsoperator"):
......
......@@ -110,12 +110,11 @@ def adjoint(
continue
if not mapper["do_interpolation"][ddi]:
if mapper["reorder_periods"][ddi]:
if sum(mapper["reorder_periods"][ddi]) != 0:
interpol_indexes = mapper["interpol_indexes"][ddi]
target_period = list(interpol_indexes.keys())[0]
inout_datastore["inputs"][trid][target_period] = \
outputs
continue
all_interpol_indexes = mapper["interpol_indexes"][ddi]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment