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
ift
NIFTy
Commits
a198e78a
Commit
a198e78a
authored
Jun 19, 2018
by
Martin Reinecke
Browse files
small cleanups
parent
58d4b593
Pipeline
#31303
passed with stages
in 2 minutes and 6 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
a198e78a
...
...
@@ -57,4 +57,4 @@ pages:
paths
:
-
public
only
:
-
NIFTy_
4
-
NIFTy_
5
demos/sampling.py
View file @
a198e78a
...
...
@@ -40,14 +40,16 @@ N_iter = 100
tol
=
1e-3
IC
=
ift
.
GradientNormController
(
tol_abs_gradnorm
=
tol
,
iteration_limit
=
N_iter
)
inverter
=
ift
.
ConjugateGradient
(
IC
)
curv
=
ift
.
library
.
WienerFilterCurvature
(
S
=
S
,
N
=
N
,
R
=
R_p
,
inverter
=
inverter
,
sampling_inverter
=
inverter
)
curv
=
ift
.
library
.
WienerFilterCurvature
(
S
=
S
,
N
=
N
,
R
=
R_p
,
inverter
=
inverter
,
sampling_inverter
=
inverter
)
m_xi
=
curv
.
inverse_times
(
j
)
samps_long
=
[
curv
.
draw_sample
(
from_inverse
=
True
)
for
i
in
range
(
N_samps
)]
tol
=
1e2
IC
=
ift
.
GradientNormController
(
tol_abs_gradnorm
=
tol
,
iteration_limit
=
N_iter
)
inverter
=
ift
.
ConjugateGradient
(
IC
)
curv
=
ift
.
library
.
WienerFilterCurvature
(
S
=
S
,
N
=
N
,
R
=
R_p
,
inverter
=
inverter
,
sampling_inverter
=
inverter
)
curv
=
ift
.
library
.
WienerFilterCurvature
(
S
=
S
,
N
=
N
,
R
=
R_p
,
inverter
=
inverter
,
sampling_inverter
=
inverter
)
samps_short
=
[
curv
.
draw_sample
(
from_inverse
=
True
)
for
i
in
range
(
N_samps
)]
# Compute mean
...
...
docs/source/code.rst
View file @
a198e78a
...
...
@@ -215,7 +215,7 @@ Further operator classes provided by NIFTy are
Syntactic sugar
---------------
Nifty
4
allows simple and intuitive construction of altered and combined
Nifty
5
allows simple and intuitive construction of altered and combined
operators.
As an example, if ``A``, ``B`` and ``C`` are of type :class:`LinearOperator`
and ``f1`` and ``f2`` are of type :class:`Field`, writing::
...
...
nifty5/minimization/energy.py
View file @
a198e78a
...
...
@@ -138,14 +138,16 @@ class Energy(NiftyMetaBase()):
def
Add
(
energy1
,
energy2
):
if
isinstance
(
energy1
.
position
,
MultiField
)
and
isinstance
(
energy2
.
position
,
MultiField
):
if
(
isinstance
(
energy1
.
position
,
MultiField
)
and
isinstance
(
energy2
.
position
,
MultiField
)):
a
=
energy1
.
position
.
_val
b
=
energy2
.
position
.
_val
# Note: In python >3.5 one could do {**a, **b}
ab
=
a
.
copy
()
ab
.
update
(
b
)
position
=
MultiField
(
ab
)
elif
isinstance
(
energy1
.
position
,
Field
)
and
isinstance
(
energy2
.
position
,
Field
):
elif
(
isinstance
(
energy1
.
position
,
Field
)
and
isinstance
(
energy2
.
position
,
Field
)):
position
=
energy1
.
position
else
:
raise
TypeError
...
...
nifty5/multi/multi_domain.py
View file @
a198e78a
...
...
@@ -49,7 +49,8 @@ class MultiDomain(frozendict):
def
__init__
(
self
,
domain
,
_callingfrommake
=
False
):
if
not
_callingfrommake
:
raise
NotImplementedError
(
'To create a MultiDomain call `MultiDomain.make()`.'
)
raise
NotImplementedError
(
'To create a MultiDomain call `MultiDomain.make()`.'
)
super
(
MultiDomain
,
self
).
__init__
(
domain
)
@
staticmethod
...
...
Write
Preview
Supports
Markdown
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