Skip to content

Commit 1f0f77b

Browse files
committed
change self.data into a SortedDict
1 parent c4df694 commit 1f0f77b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

adaptive/learner/sequence_learner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from copy import copy
33

4-
from sortedcontainers import SortedSet
4+
from sortedcontainers import SortedSet, SortedDict
55

66
from adaptive.learner.base_learner import BaseLearner
77

@@ -39,7 +39,7 @@ def __init__(self, function, sequence):
3939
self._to_do_indices = SortedSet({i for i, _ in enumerate(sequence)})
4040
self._ntotal = len(sequence)
4141
self.sequence = copy(sequence)
42-
self.data = {}
42+
self.data = SortedDict()
4343
self.pending_points = set()
4444

4545
def ask(self, n, tell_pending=True):
@@ -97,7 +97,7 @@ def result(self):
9797
"""Get back the data in the same order as ``sequence``."""
9898
if not self.done():
9999
raise Exception("Learner is not yet complete.")
100-
return [self.data[i] for i, _ in enumerate(self.sequence)]
100+
return list(self.data.values())
101101

102102
@property
103103
def npoints(self):

0 commit comments

Comments
 (0)