Commit f7cf5ded authored by Philipp Arras's avatar Philipp Arras

Cosmetics and fixups

parent 9c813309
......@@ -16,11 +16,10 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from functools import reduce
import numpy as np
from .. import dobj
from ..field import Field
from ..sugar import exp
from .structured_domain import StructuredDomain
......
......@@ -32,16 +32,16 @@ def _create_cepstrum_amplitude_field(domain, cepstrum):
q_array = domain.get_k_array()
# Fill all non-zero modes
no_zero_modes = (slice(1, None), )*dim
ks = q_array[(slice(None), ) + no_zero_modes]
no_zero_modes = (slice(1, None),)*dim
ks = q_array[(slice(None),) + no_zero_modes]
cepstrum_field = np.zeros(shape)
cepstrum_field[no_zero_modes] = cepstrum(ks)
# Fill zero-mode subspaces
for i in range(dim):
fst_dims = (slice(None), )*i
sl = fst_dims + (slice(1, None), )
sl2 = fst_dims + (0, )
fst_dims = (slice(None),)*i
sl = fst_dims + (slice(1, None),)
sl2 = fst_dims + (0,)
cepstrum_field[sl2] = np.sum(cepstrum_field[sl], axis=i)
return Field.from_global_data(domain, cepstrum_field)
......
......@@ -33,20 +33,13 @@ class SlopeOperator(LinearOperator):
Parameters
----------
domain : domain or DomainTuple, shape=(2,)
It has to be an UnstructuredDomain.
The domain of the slope mean and the y-intercept mean.
target : domain or DomainTuple
The output domain has to a LogRGSpace
sigmas : np.array, shape=(2,)
The slope variance and the y-intercept variance.
target : LogRGSpace
The target of the operator which needs to be one-dimensional.
"""
def __init__(self, target):
if not isinstance(target, LogRGSpace):
raise TypeError
if len(target.shape) != 1:
raise ValueError("Slope Operator only works for ndim == 1")
if not isinstance(target, LogRGSpace) or not len(target.shape) != 1:
raise TypeError("Slope Operator only works for ndim == 1")
self._domain = DomainTuple.make(UnstructuredDomain((2,)))
self._target = DomainTuple.make(target)
self._capability = self.TIMES | self.ADJOINT_TIMES
......
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