Commit a198e78a authored by Martin Reinecke's avatar Martin Reinecke

small cleanups

parent 58d4b593
Pipeline #31303 passed with stages
in 2 minutes and 6 seconds
......@@ -57,4 +57,4 @@ pages:
paths:
- public
only:
- NIFTy_4
- NIFTy_5
......@@ -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
......
......@@ -215,7 +215,7 @@ Further operator classes provided by NIFTy are
Syntactic sugar
---------------
Nifty4 allows simple and intuitive construction of altered and combined
Nifty5 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::
......
......@@ -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
......
......@@ -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
......
Markdown is supported
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