Skip to content

Commit

Permalink
Update histogram2D.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tberlok committed Mar 1, 2024
1 parent b0c07b3 commit d32d38e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions paicos/histograms/histogram2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d32d38e

Please sign in to comment.