Commit 76130897 authored by Torsten Ensslin's avatar Torsten Ensslin

Merge branch 'do_cleanup' into 'NIFTy_6'

Remove standard MPI parallelization

See merge request !387
parents 5765b889 07ef6674
Pipeline #65084 passed with stages
in 8 minutes and 17 seconds
...@@ -39,17 +39,10 @@ test_serial: ...@@ -39,17 +39,10 @@ test_serial:
script: script:
- pytest-3 -q --cov=nifty6 test - pytest-3 -q --cov=nifty6 test
- > - >
python3 -m coverage report --omit "*plot*,*distributed_do*" | tee coverage.txt python3 -m coverage report --omit "*plot*" | tee coverage.txt
- > - >
grep TOTAL coverage.txt | awk '{ print "TOTAL: "$4; }' grep TOTAL coverage.txt | awk '{ print "TOTAL: "$4; }'
test_mpi:
stage: test
variables:
OMPI_MCA_btl_vader_single_copy_mechanism: none
script:
- mpiexec -n 2 --bind-to none pytest-3 -q test
pages: pages:
stage: release stage: release
script: script:
......
...@@ -16,3 +16,24 @@ but it is hard to make explicit tests since the two approaches cannot be mapped ...@@ -16,3 +16,24 @@ but it is hard to make explicit tests since the two approaches cannot be mapped
onto each other exactly. We experienced that preconditioning in the `MetricGaussianKL` onto each other exactly. We experienced that preconditioning in the `MetricGaussianKL`
via `napprox` breaks the inference scheme with the new model so `napprox` may not via `napprox` breaks the inference scheme with the new model so `napprox` may not
be used here. be used here.
Removal of the standard parallelization scheme:
===============================================
When several MPI tasks are present, NIFTy5 distributes every Field over these
tasks by splitting it along the first axis. This approach to parallelism is not
very efficient, and it has not been used by anyone for several years, so we
decided to remove it, which led to many simplifications within NIFTy.
User-visible changes:
- the methods `to_global_data`, `from_global_data`, `from_local_data` and
the property `local_data` have been removed from `Field` and `MultiField`.
Instead there are now the property `val` (returning a read-only numpy.ndarray
for `Field` and a dictionary of read-only numpy.ndarrays for `MultiField`) and
the method `val_rw()` (returning the same structures with writable copies of
the arrays). Fields and MultiFields can be created from such structures using
the static method `from_raw`
- the functions `from_global_data` and `from_local_data` in `sugar` have been
replaced by a single function called `makeField`
- the property `local_shape` has been removed from `Domain` (and subclasses)
and `DomainTuple`.
...@@ -296,9 +296,9 @@ ...@@ -296,9 +296,9 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Get signal data and reconstruction data\n", "# Get signal data and reconstruction data\n",
"s_data = HT(sh).to_global_data()\n", "s_data = HT(sh).val\n",
"m_data = HT(m).to_global_data()\n", "m_data = HT(m).val\n",
"d_data = d.to_global_data()\n", "d_data = d.val\n",
"\n", "\n",
"plt.figure(figsize=(15,10))\n", "plt.figure(figsize=(15,10))\n",
"plt.plot(s_data, 'r', label=\"Signal\", linewidth=3)\n", "plt.plot(s_data, 'r', label=\"Signal\", linewidth=3)\n",
...@@ -350,8 +350,8 @@ ...@@ -350,8 +350,8 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"s_power_data = ift.power_analyze(sh).to_global_data()\n", "s_power_data = ift.power_analyze(sh).val\n",
"m_power_data = ift.power_analyze(m).to_global_data()\n", "m_power_data = ift.power_analyze(m).val\n",
"plt.figure(figsize=(15,10))\n", "plt.figure(figsize=(15,10))\n",
"plt.loglog()\n", "plt.loglog()\n",
"plt.xlim(1, int(N_pixels/2))\n", "plt.xlim(1, int(N_pixels/2))\n",
...@@ -427,12 +427,12 @@ ...@@ -427,12 +427,12 @@
"\n", "\n",
"mask = np.full(s_space.shape, 1.)\n", "mask = np.full(s_space.shape, 1.)\n",
"mask[l:h] = 0\n", "mask[l:h] = 0\n",
"mask = ift.Field.from_global_data(s_space, mask)\n", "mask = ift.Field.from_raw(s_space, mask)\n",
"\n", "\n",
"R = ift.DiagonalOperator(mask)(HT)\n", "R = ift.DiagonalOperator(mask)(HT)\n",
"n = n.to_global_data_rw()\n", "n = n.val_rw()\n",
"n[l:h] = 0\n", "n[l:h] = 0\n",
"n = ift.Field.from_global_data(s_space, n)\n", "n = ift.Field.from_raw(s_space, n)\n",
"\n", "\n",
"d = R(sh) + n" "d = R(sh) + n"
] ]
...@@ -497,11 +497,11 @@ ...@@ -497,11 +497,11 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Get signal data and reconstruction data\n", "# Get signal data and reconstruction data\n",
"s_data = s.to_global_data()\n", "s_data = s.val\n",
"m_data = HT(m).to_global_data()\n", "m_data = HT(m).val\n",
"m_var_data = m_var.to_global_data()\n", "m_var_data = m_var.val\n",
"uncertainty = np.sqrt(m_var_data)\n", "uncertainty = np.sqrt(m_var_data)\n",
"d_data = d.to_global_data_rw()\n", "d_data = d.val_rw()\n",
"\n", "\n",
"# Set lost data to NaN for proper plotting\n", "# Set lost data to NaN for proper plotting\n",
"d_data[d_data == 0] = np.nan" "d_data[d_data == 0] = np.nan"
...@@ -583,12 +583,12 @@ ...@@ -583,12 +583,12 @@
"\n", "\n",
"mask = np.full(s_space.shape, 1.)\n", "mask = np.full(s_space.shape, 1.)\n",
"mask[l:h,l:h] = 0.\n", "mask[l:h,l:h] = 0.\n",
"mask = ift.Field.from_global_data(s_space, mask)\n", "mask = ift.Field.from_raw(s_space, mask)\n",
"\n", "\n",
"R = ift.DiagonalOperator(mask)(HT)\n", "R = ift.DiagonalOperator(mask)(HT)\n",
"n = n.to_global_data_rw()\n", "n = n.val_rw()\n",
"n[l:h, l:h] = 0\n", "n[l:h, l:h] = 0\n",
"n = ift.Field.from_global_data(s_space, n)\n", "n = ift.Field.from_raw(s_space, n)\n",
"curv = Curvature(R=R, N=N, Sh=Sh)\n", "curv = Curvature(R=R, N=N, Sh=Sh)\n",
"D = curv.inverse\n", "D = curv.inverse\n",
"\n", "\n",
...@@ -602,10 +602,10 @@ ...@@ -602,10 +602,10 @@
"m_mean, m_var = ift.probe_with_posterior_samples(curv, HT, 20)\n", "m_mean, m_var = ift.probe_with_posterior_samples(curv, HT, 20)\n",
"\n", "\n",
"# Get data\n", "# Get data\n",
"s_data = HT(sh).to_global_data()\n", "s_data = HT(sh).val\n",
"m_data = HT(m).to_global_data()\n", "m_data = HT(m).val\n",
"m_var_data = m_var.to_global_data()\n", "m_var_data = m_var.val\n",
"d_data = d.to_global_data()\n", "d_data = d.val\n",
"uncertainty = np.sqrt(np.abs(m_var_data))" "uncertainty = np.sqrt(np.abs(m_var_data))"
] ]
}, },
...@@ -653,8 +653,8 @@ ...@@ -653,8 +653,8 @@
"ma = np.max(s_data)\n", "ma = np.max(s_data)\n",
"\n", "\n",
"fig, axes = plt.subplots(3, 2, figsize=(15, 22.5))\n", "fig, axes = plt.subplots(3, 2, figsize=(15, 22.5))\n",
"sample = HT(curv.draw_sample(from_inverse=True)+m).to_global_data()\n", "sample = HT(curv.draw_sample(from_inverse=True)+m).val\n",
"post_mean = (m_mean + HT(m)).to_global_data()\n", "post_mean = (m_mean + HT(m)).val\n",
"\n", "\n",
"data = [s_data, m_data, post_mean, sample, s_data - m_data, uncertainty]\n", "data = [s_data, m_data, post_mean, sample, s_data - m_data, uncertainty]\n",
"caption = [\"Signal\", \"Reconstruction\", \"Posterior mean\", \"Sample\", \"Residuals\", \"Uncertainty Map\"]\n", "caption = [\"Signal\", \"Reconstruction\", \"Posterior mean\", \"Sample\", \"Residuals\", \"Uncertainty Map\"]\n",
...@@ -731,7 +731,7 @@ ...@@ -731,7 +731,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.6" "version": "3.7.5"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
...@@ -24,16 +24,16 @@ for ii in range(10, 26): ...@@ -24,16 +24,16 @@ for ii in range(10, 26):
img = np.random.randn(nu*nv) img = np.random.randn(nu*nv)
img = img.reshape((nu, nv)) img = img.reshape((nu, nv))
img = ift.from_global_data(uvspace, img) img = ift.makeField(uvspace, img)
t0 = time() t0 = time()
GM = ift.GridderMaker(uvspace, eps=1e-7, uv=uv) GM = ift.GridderMaker(uvspace, eps=1e-7, uv=uv)
vis = ift.from_global_data(visspace, vis) vis = ift.makeField(visspace, vis)
op = GM.getFull().adjoint op = GM.getFull().adjoint
t1 = time() t1 = time()
op(img).to_global_data() op(img).val
t2 = time() t2 = time()
op.adjoint(vis).to_global_data() op.adjoint(vis).val
t3 = time() t3 = time()
print(t2-t1, t3-t2) print(t2-t1, t3-t2)
N0s.append(N) N0s.append(N)
......
...@@ -61,9 +61,9 @@ if __name__ == '__main__': ...@@ -61,9 +61,9 @@ if __name__ == '__main__':
# Generate mock data # Generate mock data
p = R(sky) p = R(sky)
mock_position = ift.from_random('normal', harmonic_space) mock_position = ift.from_random('normal', harmonic_space)
tmp = p(mock_position).to_global_data().astype(np.float64) tmp = p(mock_position).val.astype(np.float64)
data = np.random.binomial(1, tmp) data = np.random.binomial(1, tmp)
data = ift.Field.from_global_data(R.target, data) data = ift.Field.from_raw(R.target, data)
# Compute likelihood and Hamiltonian # Compute likelihood and Hamiltonian
position = ift.from_random('normal', harmonic_space) position = ift.from_random('normal', harmonic_space)
......
...@@ -57,7 +57,7 @@ if __name__ == '__main__': ...@@ -57,7 +57,7 @@ if __name__ == '__main__':
for _ in range(n_samps): for _ in range(n_samps):
fld = pspec(ift.from_random('normal', pspec.domain)) fld = pspec(ift.from_random('normal', pspec.domain))
klengths = fld.domain[0].k_lengths klengths = fld.domain[0].k_lengths
ycoord = fld.to_global_data_rw() ycoord = fld.val_rw()
ycoord[0] = ycoord[1] ycoord[0] = ycoord[1]
ax.plot(klengths, ycoord, alpha=1) ax.plot(klengths, ycoord, alpha=1)
...@@ -80,7 +80,7 @@ if __name__ == '__main__': ...@@ -80,7 +80,7 @@ if __name__ == '__main__':
foo = [] foo = []
for ax in axs: for ax in axs:
pos = ift.from_random('normal', correlated_field.domain) pos = ift.from_random('normal', correlated_field.domain)
fld = correlated_field(pos).to_global_data() fld = correlated_field(pos).val
foo.append((ax, fld)) foo.append((ax, fld))
mi, ma = np.inf, -np.inf mi, ma = np.inf, -np.inf
for _, fld in foo: for _, fld in foo:
...@@ -106,7 +106,7 @@ if __name__ == '__main__': ...@@ -106,7 +106,7 @@ if __name__ == '__main__':
flds = [] flds = []
for _ in range(n_samps): for _ in range(n_samps):
pos = ift.from_random('normal', correlated_field.domain) pos = ift.from_random('normal', correlated_field.domain)
ax.plot(correlated_field(pos).to_global_data()) ax.plot(correlated_field(pos).val)
plt.savefig('correlated_fields.png') plt.savefig('correlated_fields.png')
plt.close() plt.close()
...@@ -42,7 +42,7 @@ def make_random_mask(): ...@@ -42,7 +42,7 @@ def make_random_mask():
# Random mask for spherical mode # Random mask for spherical mode
mask = ift.from_random('pm1', position_space) mask = ift.from_random('pm1', position_space)
mask = (mask + 1)/2 mask = (mask + 1)/2
return mask.to_global_data() return mask.val
if __name__ == '__main__': if __name__ == '__main__':
...@@ -95,7 +95,7 @@ if __name__ == '__main__': ...@@ -95,7 +95,7 @@ if __name__ == '__main__':
# and harmonic transformaion # and harmonic transformaion
# Masking operator to model that parts of the field have not been observed # Masking operator to model that parts of the field have not been observed
mask = ift.Field.from_global_data(position_space, mask) mask = ift.Field.from_raw(position_space, mask)
Mask = ift.MaskOperator(mask) Mask = ift.MaskOperator(mask)
# The response operator consists of # The response operator consists of
......
...@@ -40,7 +40,7 @@ def exposure_2d(): ...@@ -40,7 +40,7 @@ def exposure_2d():
exposure[:, x_shape*4//5:x_shape] *= .1 exposure[:, x_shape*4//5:x_shape] *= .1
exposure[:, x_shape//2:x_shape*3//2] *= 3. exposure[:, x_shape//2:x_shape*3//2] *= 3.
return ift.Field.from_global_data(position_space, exposure) return ift.Field.from_raw(position_space, exposure)
if __name__ == '__main__': if __name__ == '__main__':
...@@ -94,8 +94,8 @@ if __name__ == '__main__': ...@@ -94,8 +94,8 @@ if __name__ == '__main__':
lamb = R(sky) lamb = R(sky)
mock_position = ift.from_random('normal', domain) mock_position = ift.from_random('normal', domain)
data = lamb(mock_position) data = lamb(mock_position)
data = np.random.poisson(data.to_global_data().astype(np.float64)) data = np.random.poisson(data.val.astype(np.float64))
data = ift.Field.from_global_data(d_space, data) data = ift.Field.from_raw(d_space, data)
likelihood = ift.PoissonianEnergy(data)(lamb) likelihood = ift.PoissonianEnergy(data)(lamb)
# Settings for minimization # Settings for minimization
......
...@@ -40,7 +40,7 @@ class SingleDomain(ift.LinearOperator): ...@@ -40,7 +40,7 @@ class SingleDomain(ift.LinearOperator):
def apply(self, x, mode): def apply(self, x, mode):
self._check_input(x, mode) self._check_input(x, mode)
return ift.from_global_data(self._tgt(mode), x.to_global_data()) return ift.makeField(self._tgt(mode), x.val)
def random_los(n_los): def random_los(n_los):
......
...@@ -38,11 +38,11 @@ signal_vals = np.zeros(npix, dtype=np.float64) ...@@ -38,11 +38,11 @@ signal_vals = np.zeros(npix, dtype=np.float64)
for i in range(0, npix, npix//12 + 27): for i in range(0, npix, npix//12 + 27):
signal_vals[i] = 500. signal_vals[i] = 500.
signal = ift.from_global_data(domain, signal_vals) signal = ift.makeField(domain, signal_vals)
delta_vals = np.zeros(npix, dtype=np.float64) delta_vals = np.zeros(npix, dtype=np.float64)
delta_vals[0] = 1.0 delta_vals[0] = 1.0
delta = ift.from_global_data(domain, delta_vals) delta = ift.makeField(domain, delta_vals)
# Define kernel function # Define kernel function
...@@ -58,12 +58,12 @@ domain = ift.RGSpace((100, 100)) ...@@ -58,12 +58,12 @@ domain = ift.RGSpace((100, 100))
signal_vals = np.zeros(domain.shape, dtype=np.float64) signal_vals = np.zeros(domain.shape, dtype=np.float64)
signal_vals[35, 70] = 5000. signal_vals[35, 70] = 5000.
signal_vals[45, 8] = 5000. signal_vals[45, 8] = 5000.
signal = ift.from_global_data(domain, signal_vals) signal = ift.makeField(domain, signal_vals)
# Define delta signal, generate kernel image # Define delta signal, generate kernel image
delta_vals = np.zeros(domain.shape, dtype=np.float64) delta_vals = np.zeros(domain.shape, dtype=np.float64)
delta_vals[0, 0] = 1.0 delta_vals[0, 0] = 1.0
delta = ift.from_global_data(domain, delta_vals) delta = ift.makeField(domain, delta_vals)
# Define kernel function # Define kernel function
......
...@@ -9,12 +9,12 @@ def testAmplitudesConsistency(seed, sspace): ...@@ -9,12 +9,12 @@ def testAmplitudesConsistency(seed, sspace):
sc = ift.StatCalculator() sc = ift.StatCalculator()
for s in samples: for s in samples:
sc.add(op(s.extract(op.domain))) sc.add(op(s.extract(op.domain)))
return sc.mean.to_global_data(), sc.var.sqrt().to_global_data() return sc.mean.val, sc.var.sqrt().val
np.random.seed(seed) np.random.seed(seed)
offset_std = .1 offset_std = .1
intergated_fluct_std0 = .003 intergated_fluct_std0 = .003
intergated_fluct_std1 = 0.1 intergated_fluct_std1 = 0.1
nsam = 1000 nsam = 1000
...@@ -32,7 +32,7 @@ def testAmplitudesConsistency(seed, sspace): ...@@ -32,7 +32,7 @@ def testAmplitudesConsistency(seed, sspace):
offset_std,_ = stats(fa.amplitude_total_offset,samples) offset_std,_ = stats(fa.amplitude_total_offset,samples)
intergated_fluct_std0,_ = stats(fa.average_fluctuation(0),samples) intergated_fluct_std0,_ = stats(fa.average_fluctuation(0),samples)
intergated_fluct_std1,_ = stats(fa.average_fluctuation(1),samples) intergated_fluct_std1,_ = stats(fa.average_fluctuation(1),samples)
slice_fluct_std0,_ = stats(fa.slice_fluctuation(0),samples) slice_fluct_std0,_ = stats(fa.slice_fluctuation(0),samples)
slice_fluct_std1,_ = stats(fa.slice_fluctuation(1),samples) slice_fluct_std1,_ = stats(fa.slice_fluctuation(1),samples)
...@@ -54,7 +54,7 @@ def testAmplitudesConsistency(seed, sspace): ...@@ -54,7 +54,7 @@ def testAmplitudesConsistency(seed, sspace):
print("Expected integrated fluct. frequency Std: " + print("Expected integrated fluct. frequency Std: " +
str(intergated_fluct_std1)) str(intergated_fluct_std1))
print("Estimated integrated fluct. frequency Std: " + str(fluct_freq)) print("Estimated integrated fluct. frequency Std: " + str(fluct_freq))
print("Expected slice fluct. space Std: " + print("Expected slice fluct. space Std: " +
str(slice_fluct_std0)) str(slice_fluct_std0))
print("Estimated slice fluct. space Std: " + str(sl_fluct_space)) print("Estimated slice fluct. space Std: " + str(sl_fluct_space))
...@@ -65,8 +65,8 @@ def testAmplitudesConsistency(seed, sspace): ...@@ -65,8 +65,8 @@ def testAmplitudesConsistency(seed, sspace):
print("Expected total fluct. Std: " + str(tot_flm)) print("Expected total fluct. Std: " + str(tot_flm))
print("Estimated total fluct. Std: " + str(fluct_total)) print("Estimated total fluct. Std: " + str(fluct_total))
np.testing.assert_allclose(offset_std, zm_std_mean, rtol=0.5) np.testing.assert_allclose(offset_std, zm_std_mean, rtol=0.5)
np.testing.assert_allclose(intergated_fluct_std0, fluct_space, rtol=0.5) np.testing.assert_allclose(intergated_fluct_std0, fluct_space, rtol=0.5)
np.testing.assert_allclose(intergated_fluct_std1, fluct_freq, rtol=0.5) np.testing.assert_allclose(intergated_fluct_std1, fluct_freq, rtol=0.5)
...@@ -74,7 +74,7 @@ def testAmplitudesConsistency(seed, sspace): ...@@ -74,7 +74,7 @@ def testAmplitudesConsistency(seed, sspace):
np.testing.assert_allclose(slice_fluct_std0, sl_fluct_space, rtol=0.5) np.testing.assert_allclose(slice_fluct_std0, sl_fluct_space, rtol=0.5)
np.testing.assert_allclose(slice_fluct_std1, sl_fluct_freq, rtol=0.5) np.testing.assert_allclose(slice_fluct_std1, sl_fluct_freq, rtol=0.5)
fa = ift.CorrelatedFieldMaker.make(offset_std, .1, '') fa = ift.CorrelatedFieldMaker.make(offset_std, .1, '')
fa.add_fluctuations(fsspace, intergated_fluct_std1, 1., 3.1, 1., .5, .1, fa.add_fluctuations(fsspace, intergated_fluct_std1, 1., 3.1, 1., .5, .1,
-4, 1., 'freq') -4, 1., 'freq')
...@@ -87,7 +87,7 @@ def testAmplitudesConsistency(seed, sspace): ...@@ -87,7 +87,7 @@ def testAmplitudesConsistency(seed, sspace):
print("Forced slice fluct. space Std: "+str(m)) print("Forced slice fluct. space Std: "+str(m))
print("Expected slice fluct. Std: " + str(em)) print("Expected slice fluct. Std: " + str(em))
np.testing.assert_allclose(m, em, rtol=0.5) np.testing.assert_allclose(m, em, rtol=0.5)
assert op.target[0] == sspace assert op.target[0] == sspace
assert op.target[1] == fsspace assert op.target[1] == fsspace
......
...@@ -36,7 +36,7 @@ def polynomial(coefficients, sampling_points): ...@@ -36,7 +36,7 @@ def polynomial(coefficients, sampling_points):
if not (isinstance(coefficients, ift.Field) if not (isinstance(coefficients, ift.Field)
and isinstance(sampling_points, np.ndarray)): and isinstance(sampling_points, np.ndarray)):
raise TypeError raise TypeError
params = coefficients.to_global_data() params = coefficients.val
out = np.zeros_like(sampling_points) out = np.zeros_like(sampling_points)
for ii in range(len(params)): for ii in range(len(params)):
out += params[ii] * sampling_points**ii out += params[ii] * sampling_points**ii
...@@ -71,14 +71,14 @@ class PolynomialResponse(ift.LinearOperator): ...@@ -71,14 +71,14 @@ class PolynomialResponse(ift.LinearOperator):
def apply(self, x, mode): def apply(self, x, mode):
self._check_input(x, mode) self._check_input(x, mode)
val = x.to_global_data_rw() val = x.val_rw()
if mode == self.TIMES: if mode == self.TIMES:
# FIXME Use polynomial() here # FIXME Use polynomial() here
out = self._mat.dot(val) out = self._mat.dot(val)
else: else:
# FIXME Can this be optimized? # FIXME Can this be optimized?
out = self._mat.conj().T.dot(val) out = self._mat.conj().T.dot(val)
return ift.from_global_data(self._tgt(mode), out) return ift.makeField(self._tgt(mode), out)
# Generate some mock data # Generate some mock data
...@@ -99,8 +99,8 @@ R = PolynomialResponse(p_space, x) ...@@ -99,8 +99,8 @@ R = PolynomialResponse(p_space, x)
ift.extra.consistency_check(R) ift.extra.consistency_check(R)
d_space = R.target d_space = R.target
d = ift.from_global_data(d_space, y) d = ift.makeField(d_space, y)
N = ift.DiagonalOperator(ift.from_global_data(d_space, var)) N = ift.DiagonalOperator(ift.makeField(d_space, var))
IC = ift.DeltaEnergyController(tol_rel_deltaE=1e-12, iteration_limit=200) IC = ift.DeltaEnergyController(tol_rel_deltaE=1e-12, iteration_limit=200)
likelihood = ift.GaussianEnergy(d, N)(R) likelihood = ift.GaussianEnergy(d, N)(R)
...@@ -136,9 +136,8 @@ plt.savefig('fit.png') ...@@ -136,9 +136,8 @@ plt.savefig('fit.png')
plt.close() plt.close()
# Print parameters # Print parameters
mean = sc.mean.to_global_data() mean = sc.mean.val
sigma = np.sqrt(sc.var.to_global_data()) sigma = np.sqrt(sc.var.val)
if ift.dobj.master: for ii in range(len(mean)):
for ii in range(len(mean)): print('Coefficient x**{}: {:.2E} +/- {:.2E}'.format(ii, mean[ii],
print('Coefficient x**{}: {:.2E} +/- {:.2E}'.format(ii, mean[ii],
sigma[ii])) sigma[ii]))
from .version import __version__ from .version import __version__
from . import dobj
from .domains.domain import Domain from .domains.domain import Domain
from .domains.structured_domain import StructuredDomain from .domains.structured_domain import StructuredDomain
from .domains.unstructured_domain import UnstructuredDomain from .domains.unstructured_domain import UnstructuredDomain
...@@ -93,10 +91,5 @@ from .linearization import Linearization ...@@ -93,10 +91,5 @@ from .linearization import Linearization
from .operator_spectrum import operator_spectrum from .operator_spectrum import operator_spectrum