diff --git a/nifty/field_types/field_array.py b/nifty/field_types/field_array.py index bac80ea37fdd739c167058ef2102460d9457c230..4318afa2f3b029c246d992bdaf1cfc25358c8600 100644 --- a/nifty/field_types/field_array.py +++ b/nifty/field_types/field_array.py @@ -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): diff --git a/nifty/operators/invertible_operator_mixin/invertible_operator_mixin.py b/nifty/operators/invertible_operator_mixin/invertible_operator_mixin.py index 4786a4f9375c7e56e6b52d38005263f2b6f69057..5aaff1097cf10aeeee14ca7232067ed783ff85cc 100644 --- a/nifty/operators/invertible_operator_mixin/invertible_operator_mixin.py +++ b/nifty/operators/invertible_operator_mixin/invertible_operator_mixin.py @@ -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'.") diff --git a/nifty/operators/propagator_operator/harmonic_propagator_operator.py b/nifty/operators/propagator_operator/harmonic_propagator_operator.py index 908e2e372f992dbd0c7afc7ce8fdbc0c62c94833..8789847a8a96dbc2dfa679cf388c5e213fdd6636 100644 --- a/nifty/operators/propagator_operator/harmonic_propagator_operator.py +++ b/nifty/operators/propagator_operator/harmonic_propagator_operator.py @@ -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 diff --git a/nifty/spaces/power_space/power_space.py b/nifty/spaces/power_space/power_space.py index ce56812a48db1ddc2751f60dbdd1f60cb101e77c..1e3fbcccff9f9a98d4339fbb7327dcc555a5ce1d 100644 --- a/nifty/spaces/power_space/power_space.py +++ b/nifty/spaces/power_space/power_space.py @@ -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, diff --git a/nifty/spaces/space/space.py b/nifty/spaces/space/space.py index 84314c48cc968c41d94320d26ee0ba9c4f615d3d..624207d9c44e25800c95e8b90ee0c3e9c54a330f 100644 --- a/nifty/spaces/space/space.py +++ b/nifty/spaces/space/space.py @@ -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" diff --git a/nifty/sugar.py b/nifty/sugar.py index 5bf7dbc6f8b23f2753bebe1cde110462549dfcbb..11aa25bc76948de2c8f2757cf28a66399c0cc79e 100644 --- a/nifty/sugar.py +++ b/nifty/sugar.py @@ -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)