Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VERIFY
CIF
Commits
e38c7f2a
Commit
e38c7f2a
authored
Jan 06, 2022
by
Antoine Berchet
Browse files
Fix bug in time interpolation when no file available; some doc
parent
75d8f886
Changes
4
Hide whitespace changes
Inline
Side-by-side
pycif/plugins/modes/variational/execute.py
View file @
e38c7f2a
...
...
@@ -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
)
...
...
pycif/plugins/simulators/gausscost/__init__.py
View file @
e38c7f2a
...
...
@@ -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
):
...
...
pycif/plugins/simulators/gausscost/simul.py
View file @
e38c7f2a
...
...
@@ -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"
):
...
...
pycif/plugins/transforms/basic/time_interpolation/adjoint.py
View file @
e38c7f2a
...
...
@@ -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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment