Skip to content

Commit

Permalink
Merge pull request #142 from nschloe/string
Browse files Browse the repository at this point in the history
string
  • Loading branch information
nschloe authored Mar 3, 2022
2 parents 2c55564 + a1b41c7 commit 5c43143
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/perfplot/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.10.1"
__version__ = "0.10.2"
11 changes: 9 additions & 2 deletions src/perfplot/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
}


def default_equality_check(a, b):
if isinstance(a, str):
return a == b

return np.allclose(a, b)


def _auto_time_unit(time_s: float) -> str:
"""Automatically obtains a readable unit at which to plot :py:attr:`timings` of the
benchmarking process. This is accomplished by converting the minimum measured
Expand Down Expand Up @@ -351,7 +358,7 @@ def live(
xlabel: str | None = None,
target_time_per_measurement: float = 1.0,
max_time: float | None = None,
equality_check: Callable | None = np.allclose,
equality_check: Callable | None = default_equality_check,
show_progress: bool = True,
logx: Literal["auto"] | bool = "auto",
logy: Literal["auto"] | bool = "auto",
Expand Down Expand Up @@ -472,7 +479,7 @@ def bench(
title: str | None = None,
target_time_per_measurement: float = 1.0,
max_time: float | None = None,
equality_check: Callable | None = np.allclose,
equality_check: Callable | None = default_equality_check,
show_progress: bool = True,
):
if labels is None:
Expand Down

0 comments on commit 5c43143

Please sign in to comment.