Skip to content

Commit 9c55259

Browse files
committed
small code style changes
1 parent c208d67 commit 9c55259

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

adaptive/learner/average_learner1D.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def __init__(
5555
max_samples=np.inf,
5656
min_error=0,
5757
):
58-
# Checks
59-
for k, v in zip(
60-
["delta", "alpha", "neighbor_sampling"], [delta, alpha, neighbor_sampling]
61-
):
62-
if not (0 < v <= 1):
63-
raise ValueError(f"{k} should be positive (0 < {k} <= 1).")
58+
if not (0 < delta <= 1):
59+
raise ValueError("Learner requires 0 < delta <= 1.")
60+
if not (0 < alpha <= 1):
61+
raise ValueError("Learner requires 0 < alpha <= 1.")
62+
if not (0 < neighbor_sampling <= 1):
63+
raise ValueError("Learner requires 0 < neighbor_sampling <= 1.")
6464
if min_samples < 0:
6565
raise ValueError("min_samples should be positive.")
6666
if min_samples > max_samples:
@@ -411,13 +411,12 @@ def plot(self):
411411
p = hv.Scatter([]) * hv.ErrorBars([]) * hv.Path([])
412412
elif not self.vdim > 1:
413413
xs, ys = zip(*sorted(self.data.items()))
414-
p = (
415-
hv.Scatter(self.data)
416-
* hv.ErrorBars(
417-
[(x, self.data[x], self._error_in_mean[x]) for x in self.data]
418-
)
419-
* hv.Path((xs, ys))
414+
scatter = hv.Scatter(self.data)
415+
error = hv.ErrorBars(
416+
[(x, self.data[x], self._error_in_mean[x]) for x in self.data]
420417
)
418+
line = hv.Path((xs, ys))
419+
p = scatter * error * line
421420
else:
422421
raise Exception("plot() not implemented for vector functions.")
423422

0 commit comments

Comments
 (0)