From d32d38e682afd75182e63ee37a4df22d8a6701f8 Mon Sep 17 00:00:00 2001 From: Thomas Berlok Date: Fri, 1 Mar 2024 12:06:46 +0100 Subject: [PATCH] Update histogram2D.py --- paicos/histograms/histogram2D.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/paicos/histograms/histogram2D.py b/paicos/histograms/histogram2D.py index 0d6a8e1..d212754 100644 --- a/paicos/histograms/histogram2D.py +++ b/paicos/histograms/histogram2D.py @@ -79,12 +79,16 @@ def __init__(self, snap, x, y, weights=None, bins_x=200, bins_y=200, if logscale: bins_x[0] = self.x[self.x > 0].min() + else: + assert bins_x[0] < bins_x[1], 'min and max values swapped!' if isinstance(bins_y, int): bins_y = [self.y.min(), self.y.max(), bins_y] if logscale: bins_y[0] = self.y[self.y > 0].min() + else: + assert bins_y[0] < bins_y[1], 'min and max values swapped!' self.logscale = logscale @@ -245,8 +249,8 @@ def _make_histogram(self): hist2d = hist2d.T if settings.use_units: - hist2d = pu.PaicosQuantity(hist2d, self.hist_units, a=self.x.a, - h=self.x.h, + hist2d = pu.PaicosQuantity(hist2d, self.hist_units, a=self.x._a, + h=self.x._h, comoving_sim=self.x.comoving_sim) if normalize: norm = np.sum(self.area_per_bin * hist2d)