Skip to content

Commit

Permalink
Update plugin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufede authored Dec 12, 2023
1 parent 3366d47 commit 24a3c07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pytest_memray/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def cli_hist(data: Iterable[float], bins: int, *, log_scale: bool = True) -> str
high = max(data)
if log_scale:
data = map(math.log, filter(lambda number: number != 0, data))
low = math.log(low) if low != 0 else 0
high = math.log(high)
low = math.log(low) if low > 5e-324 else -750
high = math.log(high) if high > 5e-324 else -750
data_bins = histogram(data, low=low, high=high, bins=bins)
bar_indexes = (int(elem * (len(bars) - 1) / max(data_bins)) for elem in data_bins)
result = " ".join(bars[bar_index] for bar_index in bar_indexes)
Expand Down

0 comments on commit 24a3c07

Please sign in to comment.