Skip to content

Commit 4434ccb

Browse files
committed
add _get_data and _set_data to AverageLearner1D
1 parent 9b47e03 commit 4434ccb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

adaptive/learner/average_learner1D.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def tell_many_at_point(self, x, ys):
386386
self._data_samples.update({x: ys + self._data_samples[x]})
387387
n = len(self._data_samples[x])
388388
self._number_samples[x] = n
389-
# self._update_data(x,y,"new") included the point
389+
# `self._update_data(x, y, "new")` included the point
390390
# in _undersampled_points. We remove it if there are
391391
# more than min_samples samples, disregarding neighbor_sampling.
392392
if n > self.min_samples:
@@ -403,6 +403,14 @@ def tell_many_at_point(self, x, ys):
403403
self._update_interpolated_loss_in_interval(*interval)
404404
self._oldscale = deepcopy(self._scale)
405405

406+
def _get_data(self):
407+
return self._data_samples
408+
409+
def _set_data(self, data):
410+
if data:
411+
for x, samples in data.items():
412+
self.tell_many_at_point(x, samples)
413+
406414
def plot(self):
407415
"""Returns a plot of the evaluated data with error bars (not implemented
408416
for vector functions, i.e., it requires vdim=1).

0 commit comments

Comments
 (0)