Commit 22d3e25c authored by Martin Reinecke's avatar Martin Reinecke

various small proposed changes

parent 9bed8f72
Pipeline #12613 passed with stage
in 4 minutes and 43 seconds
......@@ -22,12 +22,11 @@ from field_type import FieldType
class FieldArray(FieldType):
def __init__(self, shape):
super(FieldArray, self).__init__()
try:
new_shape = tuple([int(i) for i in shape])
self._shape = tuple([int(i) for i in shape])
except TypeError:
new_shape = (int(shape), )
self._shape = new_shape
super(FieldArray, self).__init__()
self._shape = (int(shape), )
@property
def shape(self):
......
......@@ -104,6 +104,7 @@ class InvertibleOperatorMixin(object):
x0=x0)
return result
#MR FIXME: why? shouldn't this be equivalent to the adjoint inverse?
def _inverse_adjoint_times(self, x, spaces):
raise NotImplementedError(
"no generic instance method 'inverse_adjoint_times'.")
......@@ -83,7 +83,7 @@ class HarmonicPropagatorOperator(InvertibleOperatorMixin, EndomorphicOperator):
# ---Overwritten properties and methods---
def __init__(self, S=None, M=None, R=None, N=None, inverter=None,
def __init__(self, S, M=None, R=None, N=None, inverter=None,
preconditioner=None):
"""
Sets the standard operator properties and `codomain`, `_A1`, `_A2`,
......@@ -102,7 +102,6 @@ class HarmonicPropagatorOperator(InvertibleOperatorMixin, EndomorphicOperator):
"""
# infer domain, and target
# infer domain, and target
if M is not None:
self._codomain = M.domain
self._likelihood = M.times
......
......@@ -261,6 +261,7 @@ class PowerSpace(Space):
hdf5_group.attrs['nbin'] = str(self.config["nbin"])
hdf5_group.attrs['binbounds'] = str(self.config["binbounds"])
#MR FIXME: why not "return None" as happens everywhere else?
return {
'harmonic_partner': self.harmonic_partner,
'pindex': self.pindex,
......
......@@ -202,6 +202,4 @@ class Space(DomainObject):
raise NotImplementedError
def __repr__(self):
string = ""
string += str(type(self)) + "\n"
return string
return str(type(self)) + "\n"
......@@ -18,27 +18,18 @@
from nifty import PowerSpace,\
Field,\
DiagonalOperator,\
FFTOperator
DiagonalOperator
__all__ = ['create_power_operator']
def create_power_operator(domain, power_spectrum, dtype=None,
distribution_strategy='not'):
if not domain.harmonic:
fft = FFTOperator(domain)
domain = fft.target[0]
power_domain = PowerSpace(domain,
distribution_strategy=distribution_strategy)
fp = Field(power_domain,
val=power_spectrum, dtype=dtype,
fp = Field(power_domain, val=power_spectrum, dtype=dtype,
distribution_strategy=distribution_strategy)
f = fp.power_synthesize(mean=1, std=0, real_signal=False)
power_operator = DiagonalOperator(domain, diagonal=f, bare=True)
return power_operator
\ No newline at end of file
return DiagonalOperator(domain, diagonal=f, bare=True)
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