Commit c0bedf7c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

Merge branch 'various_pa' into 'NIFTy_6'

Various pa

See merge request !487
parents fd208746 8662faa1
Pipeline #75329 passed with stages
in 8 minutes and 48 seconds
...@@ -531,7 +531,16 @@ class CorrelatedFieldMaker: ...@@ -531,7 +531,16 @@ class CorrelatedFieldMaker:
self._a.append(amp) self._a.append(amp)
self._target_subdomains.append(target_subdomain) self._target_subdomains.append(target_subdomain)
def _finalize_from_op(self): def finalize(self, prior_info=100):
"""Finishes model construction process and returns the constructed
operator.
Parameters
----------
prior_info : integer
How many prior samples to draw for property verification statistics
If zero, skips calculating and displaying statistics.
"""
n_amplitudes = len(self._a) n_amplitudes = len(self._a)
if self._total_N > 0: if self._total_N > 0:
hspace = makeDomain( hspace = makeDomain(
...@@ -562,19 +571,8 @@ class CorrelatedFieldMaker: ...@@ -562,19 +571,8 @@ class CorrelatedFieldMaker:
pd = PowerDistributor(co.target, pp, amp_space) pd = PowerDistributor(co.target, pp, amp_space)
a.append(co.adjoint @ pd @ self._a[ii]) a.append(co.adjoint @ pd @ self._a[ii])
corr = reduce(mul, a) corr = reduce(mul, a)
return ht(azm*corr*ducktape(hspace, None, self._prefix + 'xi')) op = ht(azm*corr*ducktape(hspace, None, self._prefix + 'xi'))
def finalize(self, prior_info=100):
"""Finishes model construction process and returns the constructed
operator.
Parameters
----------
prior_info : integer
How many prior samples to draw for property verification statistics
If zero, skips calculating and displaying statistics.
"""
op = self._finalize_from_op()
if self._offset_mean is not None: if self._offset_mean is not None:
offset = self._offset_mean offset = self._offset_mean
# Deviations from this offset must not be considered here as they # Deviations from this offset must not be considered here as they
......
...@@ -405,7 +405,7 @@ def _plot2D(f, ax, **kwargs): ...@@ -405,7 +405,7 @@ def _plot2D(f, ax, **kwargs):
ax.set_ylabel(kwargs.pop("ylabel", "")) ax.set_ylabel(kwargs.pop("ylabel", ""))
dom = dom[x_space] dom = dom[x_space]
if not have_rgb: if not have_rgb:
cmap = kwargs.pop("colormap", plt.rcParams['image.cmap']) cmap = kwargs.pop("cmap", plt.rcParams['image.cmap'])
if isinstance(dom, RGSpace): if isinstance(dom, RGSpace):
nx, ny = dom.shape nx, ny = dom.shape
...@@ -417,7 +417,7 @@ def _plot2D(f, ax, **kwargs): ...@@ -417,7 +417,7 @@ def _plot2D(f, ax, **kwargs):
else: else:
im = ax.imshow( im = ax.imshow(
f.val.T, extent=[0, nx*dx, 0, ny*dy], f.val.T, extent=[0, nx*dx, 0, ny*dy],
vmin=kwargs.get("zmin"), vmax=kwargs.get("zmax"), vmin=kwargs.get("vmin"), vmax=kwargs.get("vmax"),
cmap=cmap, origin="lower", **norm, **aspect) cmap=cmap, origin="lower", **norm, **aspect)
plt.colorbar(im) plt.colorbar(im)
_limit_xy(**kwargs) _limit_xy(**kwargs)
...@@ -453,7 +453,7 @@ def _plot2D(f, ax, **kwargs): ...@@ -453,7 +453,7 @@ def _plot2D(f, ax, **kwargs):
if have_rgb: if have_rgb:
plt.imshow(res, origin="lower") plt.imshow(res, origin="lower")
else: else:
plt.imshow(res, vmin=kwargs.get("zmin"), vmax=kwargs.get("zmax"), plt.imshow(res, vmin=kwargs.get("vmin"), vmax=kwargs.get("vmax"),
norm=norm.get('norm'), cmap=cmap, origin="lower") norm=norm.get('norm'), cmap=cmap, origin="lower")
plt.colorbar(orientation="horizontal") plt.colorbar(orientation="horizontal")
return return
...@@ -518,7 +518,7 @@ class Plot(object): ...@@ -518,7 +518,7 @@ class Plot(object):
Label for the y axis. Label for the y axis.
[xyz]min, [xyz]max: float [xyz]min, [xyz]max: float
Limits for the values to plot. Limits for the values to plot.
colormap: string cmap: string
Color map to use for the plot (if it is a 2D plot). Color map to use for the plot (if it is a 2D plot).
linewidth: float or list of floats linewidth: float or list of floats
Line width. Line width.
......
...@@ -53,7 +53,7 @@ def test_plots(): ...@@ -53,7 +53,7 @@ def test_plots():
plot.output(title='Three plots', name=next(name)) plot.output(title='Three plots', name=next(name))
plot = ift.Plot() plot = ift.Plot()
plot.add(field_hp, title='HP planck-color', colormap='Planck-like') plot.add(field_hp, title='HP planck-color', cmap='Planck-like')
plot.add(field_rg1_2, title='1d rg') plot.add(field_rg1_2, title='1d rg')
plot.add(field_ps) plot.add(field_ps)
plot.add(field_gl, title='GL') plot.add(field_gl, title='GL')
......
Supports Markdown
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