2D learner specifies a 1D point causing 2D learner to fail
This test was picked up by my online test builds for PycQED (https://travis-ci.org/DiCarloLab-Delft/PycQED_py3) and then reproduced locally.
The problem did not occur in the 0.4.0dev release with latest commit 65ca5f7b63ab387b3e
.
It does occur in the 0.4.0 version on PyPi.
It is not clear to me what changed at this point or what exactly is going on. Below is the traceback of my (failing test) that was working with the previous version. All the test tests is if a simple wrapping around the adaptive package works correctly.
====================================================== FAILURES ======================================================
___________________________________ Test_MeasurementControl.test_adaptive_sampling ___________________________________
self = <pycqed.tests.test_MeasurementControl.Test_MeasurementControl testMethod=test_adaptive_sampling>
def test_adaptive_sampling(self):
self.MC.soft_avg(1)
self.mock_parabola.noise(0)
self.MC.set_sweep_functions(
[self.mock_parabola.x, self.mock_parabola.y])
self.MC.set_adaptive_function_parameters({'adaptive_function': adaptive.Learner2D,
'goal':lambda l: l.npoints>20*20,
'bounds':((-50, +50),
(-20, +30))})
self.MC.set_detector_function(self.mock_parabola.parabola)
> dat = self.MC.run('2D adaptive sampling test', mode='adaptive')
pycqed/tests/test_MeasurementControl.py:570:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pycqed/measurement/measurement_control.py:201: in run
self.measure_soft_adaptive()
pycqed/measurement/measurement_control.py:301: in measure_soft_adaptive
goal=self.af_pars['goal'])
../../../anaconda/lib/python3.6/site-packages/adaptive/runner.py:435: in simple
learner.tell(x, y)
../../../anaconda/lib/python3.6/site-packages/adaptive/learner/base_learner.py:40: in tell
self._tell(x, y)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <adaptive.learner.learner2D.Learner2D object at 0x1c25b5aa58>, point = -50, value = 2900.0000012161895
def _tell(self, point, value):
> point = tuple(point)
E TypeError: 'int' object is not iterable
../../../anaconda/lib/python3.6/site-packages/adaptive/learner/learner2D.py:291: TypeError
------------------------------------------------ Captured stdout call ------------------------------------------------
Starting measurement: 2D adaptive sampling test
Sweep function 0: x
Sweep function 1: y
Detector function: parabola
Acquired 1 points, elapsed time: 3.6s
------------------------------------------------- Captured log call --------------------------------------------------