Commit f14b80e3 by Lukas Platz

### revert deprecation

parent b4531533
Pipeline #62732 passed with stages
in 7 minutes and 22 seconds
 ... ... @@ -234,8 +234,6 @@ class Field(object): def scalar_weight(self, spaces=None): """Returns the uniform volume element for a sub-domain of `self`. DEPRECATED! Use `self.domain.scalar_weight` instead. Parameters ---------- spaces : int, tuple of int or None ... ... @@ -253,8 +251,6 @@ class Field(object): def total_volume(self, spaces=None): """Returns the total volume of the field's domain or of a subspace of it. DEPRECATED! Use `self.domain.total_volume` instead. Parameters ---------- spaces : int, tuple of int or None ... ... @@ -457,7 +453,7 @@ class Field(object): The result of the integration. If it is carried out over the entire domain, this is a scalar, otherwise a Field. """ swgt = self._domain.scalar_weight(spaces) swgt = self.scalar_weight(spaces) if swgt is not None: res = self.sum(spaces) res = res*swgt ... ... @@ -527,7 +523,7 @@ class Field(object): """Determines the mean over the sub-domains given by `spaces`. ``x.mean(spaces)`` is equivalent to ``x.integrate(spaces)/x.domain.total_volume(spaces)``. ``x.integrate(spaces)/x.total_volume(spaces)``. Parameters ---------- ... ... @@ -541,12 +537,12 @@ class Field(object): The result of the operation. If it is carried out over the entire domain, this is a scalar, otherwise a Field. """ if self._domain.scalar_weight(spaces) is not None: if self.scalar_weight(spaces) is not None: return self._contraction_helper('mean', spaces) # MR FIXME: not very efficient # MR FIXME: do we need "spaces" here? tmp = self.weight(1, spaces) return tmp.sum(spaces)*(1./tmp._domain.total_volume(spaces)) return tmp.sum(spaces)*(1./tmp.total_volume(spaces)) def var(self, spaces=None): """Determines the variance over the sub-domains given by `spaces`. ... ... @@ -564,7 +560,7 @@ class Field(object): The result of the operation. If it is carried out over the entire domain, this is a scalar, otherwise a Field. """ if self._domain.scalar_weight(spaces) is not None: if self.scalar_weight(spaces) is not None: return self._contraction_helper('var', spaces) # MR FIXME: not very efficient or accurate m1 = self.mean(spaces) ... ... @@ -594,7 +590,7 @@ class Field(object): domain, this is a scalar, otherwise a Field. """ from .sugar import sqrt if self._domain.scalar_weight(spaces) is not None: if self.scalar_weight(spaces) is not None: return self._contraction_helper('std', spaces) return sqrt(self.var(spaces)) ... ...
 ... ... @@ -222,9 +222,15 @@ def test_weight(): assert_equal(f.domain.total_volume(), 1) assert_equal(f.domain.total_volume(0), 1) assert_equal(f.domain.total_volume((0,)), 1) assert_equal(f.total_volume(), 1) assert_equal(f.total_volume(0), 1) assert_equal(f.total_volume((0,)), 1) assert_equal(f.domain.scalar_weight(), 0.1) assert_equal(f.domain.scalar_weight(0), 0.1) assert_equal(f.domain.scalar_weight((0,)), 0.1) assert_equal(f.scalar_weight(), 0.1) assert_equal(f.scalar_weight(0), 0.1) assert_equal(f.scalar_weight((0,)), 0.1) s1 = ift.GLSpace(10) f = ift.Field.full(s1, 10.) assert_equal(f.domain.scalar_weight(), None) ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!