diff --git a/nifty6/library/correlated_fields.py b/nifty6/library/correlated_fields.py index 98b9181589db24d6c416b4f672b51c02f0065815..cd124a14b518e6594fb68259dbda9a2119ba9a6b 100644 --- a/nifty6/library/correlated_fields.py +++ b/nifty6/library/correlated_fields.py @@ -531,7 +531,16 @@ class CorrelatedFieldMaker: self._a.append(amp) 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) if self._total_N > 0: hspace = makeDomain( @@ -562,19 +571,8 @@ class CorrelatedFieldMaker: pd = PowerDistributor(co.target, pp, amp_space) a.append(co.adjoint @ pd @ self._a[ii]) 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: offset = self._offset_mean # Deviations from this offset must not be considered here as they diff --git a/nifty6/plot.py b/nifty6/plot.py index 8ba30f87cef1c762a3b9b0bbb7e7b54fc4d00e97..afa8878282beaf21a0fdbc27f519630419bdd811 100644 --- a/nifty6/plot.py +++ b/nifty6/plot.py @@ -405,7 +405,7 @@ def _plot2D(f, ax, **kwargs): ax.set_ylabel(kwargs.pop("ylabel", "")) dom = dom[x_space] if not have_rgb: - cmap = kwargs.pop("colormap", plt.rcParams['image.cmap']) + cmap = kwargs.pop("cmap", plt.rcParams['image.cmap']) if isinstance(dom, RGSpace): nx, ny = dom.shape @@ -417,7 +417,7 @@ def _plot2D(f, ax, **kwargs): else: im = ax.imshow( 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) plt.colorbar(im) _limit_xy(**kwargs) @@ -453,7 +453,7 @@ def _plot2D(f, ax, **kwargs): if have_rgb: plt.imshow(res, origin="lower") 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") plt.colorbar(orientation="horizontal") return @@ -518,7 +518,7 @@ class Plot(object): Label for the y axis. [xyz]min, [xyz]max: float Limits for the values to plot. - colormap: string + cmap: string Color map to use for the plot (if it is a 2D plot). linewidth: float or list of floats Line width. diff --git a/test/test_plot.py b/test/test_plot.py index 75d2e5e41b7a7b8276c8d5190e33d27feb6b95c3..239f7a25bd0a574c424255a06500c9c11fd00e1b 100644 --- a/test/test_plot.py +++ b/test/test_plot.py @@ -53,7 +53,7 @@ def test_plots(): plot.output(title='Three plots', name=next(name)) 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_ps) plot.add(field_gl, title='GL')