Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: debug-statements
- id: check-ast
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
Expand Down
3 changes: 2 additions & 1 deletion adaptive/learner/learner1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ def vdim(self) -> int:

def to_numpy(self):
"""Data as NumPy array of size ``(npoints, 2)`` if ``learner.function`` returns a scalar
and ``(npoints, 1+vdim)`` if ``learner.function`` returns a vector of length ``vdim``."""
and ``(npoints, 1+vdim)`` if ``learner.function`` returns a vector of length ``vdim``.
"""
return np.array([(x, *np.atleast_1d(y)) for x, y in sorted(self.data.items())])

def to_dataframe(
Expand Down
3 changes: 2 additions & 1 deletion adaptive/learner/learner2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ def xy_scale(self) -> np.ndarray:

def to_numpy(self):
"""Data as NumPy array of size ``(npoints, 3)`` if ``learner.function`` returns a scalar
and ``(npoints, 2+vdim)`` if ``learner.function`` returns a vector of length ``vdim``."""
and ``(npoints, 2+vdim)`` if ``learner.function`` returns a vector of length ``vdim``.
"""
return np.array(
[(x, y, *np.atleast_1d(z)) for (x, y), z in sorted(self.data.items())]
)
Expand Down
3 changes: 1 addition & 2 deletions adaptive/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def __init__(
raise_if_retries_exceeded: bool = True,
allow_running_forever: bool = False,
):

self.executor = _ensure_executor(executor)
self.goal = _goal(
learner,
Expand Down Expand Up @@ -638,7 +637,6 @@ def __init__(
retries: int = 0,
raise_if_retries_exceeded: bool = True,
) -> None:

if (
executor is None
and _default_executor is concurrent.ProcessPoolExecutor
Expand Down Expand Up @@ -977,6 +975,7 @@ def _get_ncores(

# --- Useful runner goals


# TODO: deprecate
def stop_after(*, seconds=0, minutes=0, hours=0) -> Callable[[BaseLearner], bool]:
"""Stop a runner after a specified time.
Expand Down
1 change: 0 additions & 1 deletion adaptive/tests/test_learner1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def f(x):


def test_termination_on_discontinuities():

learner = _run_on_discontinuity(0, (-1, 1))
smallest_interval = min(abs(a - b) for a, b in learner.losses.keys())
assert smallest_interval >= np.finfo(float).eps
Expand Down