Browse code

run pre-commit run --all

Bas Nijholt authored on 11/12/2019 14:00:39
Showing 1 changed files
... ...
@@ -1,5 +1,3 @@
1
-# -*- coding: utf-8 -*-
2
-
3 1
 from contextlib import suppress
4 2
 
5 3
 from adaptive import learner, runner, utils
Browse code

sort imports

Bas Nijholt authored on 08/10/2019 16:35:57
Showing 1 changed files
... ...
@@ -13,8 +13,8 @@ from adaptive.learner import (
13 13
     Learner1D,
14 14
     Learner2D,
15 15
     LearnerND,
16
-    make_datasaver,
17 16
     SequenceLearner,
17
+    make_datasaver,
18 18
 )
19 19
 from adaptive.notebook_integration import (
20 20
     active_plotting_tasks,
Browse code

add SequenceLearner

Bas Nijholt authored on 09/05/2019 00:59:12
Showing 1 changed files
... ...
@@ -14,6 +14,7 @@ from adaptive.learner import (
14 14
     Learner2D,
15 15
     LearnerND,
16 16
     make_datasaver,
17
+    SequenceLearner,
17 18
 )
18 19
 from adaptive.notebook_integration import (
19 20
     active_plotting_tasks,
... ...
@@ -36,6 +37,7 @@ __all__ = [
36 37
     "Learner2D",
37 38
     "LearnerND",
38 39
     "make_datasaver",
40
+    "SequenceLearner",
39 41
     "active_plotting_tasks",
40 42
     "live_plot",
41 43
     "notebook_extension",
Browse code

add __all__ and fix flake8 issues

Bas Nijholt authored on 08/05/2019 02:07:44
Showing 1 changed files
... ...
@@ -4,17 +4,52 @@ from contextlib import suppress
4 4
 
5 5
 from adaptive import learner, runner, utils
6 6
 from adaptive._version import __version__
7
-from adaptive.learner import (AverageLearner, BalancingLearner, BaseLearner,
8
-                              DataSaver, IntegratorLearner, Learner1D,
9
-                              Learner2D, LearnerND, make_datasaver)
10
-from adaptive.notebook_integration import (active_plotting_tasks, live_plot,
11
-                                           notebook_extension)
7
+from adaptive.learner import (
8
+    AverageLearner,
9
+    BalancingLearner,
10
+    BaseLearner,
11
+    DataSaver,
12
+    IntegratorLearner,
13
+    Learner1D,
14
+    Learner2D,
15
+    LearnerND,
16
+    make_datasaver,
17
+)
18
+from adaptive.notebook_integration import (
19
+    active_plotting_tasks,
20
+    live_plot,
21
+    notebook_extension,
22
+)
12 23
 from adaptive.runner import AsyncRunner, BlockingRunner, Runner
13 24
 
25
+__all__ = [
26
+    "learner",
27
+    "runner",
28
+    "utils",
29
+    "__version__",
30
+    "AverageLearner",
31
+    "BalancingLearner",
32
+    "BaseLearner",
33
+    "DataSaver",
34
+    "IntegratorLearner",
35
+    "Learner1D",
36
+    "Learner2D",
37
+    "LearnerND",
38
+    "make_datasaver",
39
+    "active_plotting_tasks",
40
+    "live_plot",
41
+    "notebook_extension",
42
+    "AsyncRunner",
43
+    "BlockingRunner",
44
+    "Runner",
45
+]
46
+
14 47
 with suppress(ImportError):
15 48
     # Only available if 'scikit-optimize' is installed
16
-    from adaptive.learner import SKOptLearner
49
+    from adaptive.learner import SKOptLearner  # noqa: F401
17 50
 
51
+    __all__.append("SKOptLearner")
18 52
 
19
-del _version
20
-del notebook_integration  # to avoid confusion with `notebook_extension`
53
+# to avoid confusion with `notebook_extension` and `__version__`
54
+del _version  # noqa: F821
55
+del notebook_integration  # noqa: F821
Browse code

fix import order and style

Bas Nijholt authored on 07/05/2019 23:42:40
Showing 1 changed files
... ...
@@ -2,26 +2,19 @@
2 2
 
3 3
 from contextlib import suppress
4 4
 
5
-from adaptive.notebook_integration import (notebook_extension, live_plot,
6
-                                   active_plotting_tasks)
7
-
8
-from adaptive import learner
9
-from adaptive import runner
10
-from adaptive import utils
11
-
12
-from adaptive.learner import (
13
-	BaseLearner, Learner1D, Learner2D, LearnerND,
14
-    AverageLearner, BalancingLearner, make_datasaver,
15
-    DataSaver, IntegratorLearner
16
-)
5
+from adaptive import learner, runner, utils
6
+from adaptive._version import __version__
7
+from adaptive.learner import (AverageLearner, BalancingLearner, BaseLearner,
8
+                              DataSaver, IntegratorLearner, Learner1D,
9
+                              Learner2D, LearnerND, make_datasaver)
10
+from adaptive.notebook_integration import (active_plotting_tasks, live_plot,
11
+                                           notebook_extension)
12
+from adaptive.runner import AsyncRunner, BlockingRunner, Runner
17 13
 
18 14
 with suppress(ImportError):
19 15
     # Only available if 'scikit-optimize' is installed
20 16
     from adaptive.learner import SKOptLearner
21 17
 
22
-from adaptive.runner import Runner, AsyncRunner, BlockingRunner
23 18
 
24
-from adaptive._version import __version__
25 19
 del _version
26
-
27 20
 del notebook_integration  # to avoid confusion with `notebook_extension`
Browse code

adhere to PEP008 by using absolute imports

See https://www.python.org/dev/peps/pep-0008/#imports

Bas Nijholt authored on 26/11/2018 13:39:12
Showing 1 changed files
... ...
@@ -1,24 +1,27 @@
1 1
 # -*- coding: utf-8 -*-
2
+
2 3
 from contextlib import suppress
3 4
 
4
-from .notebook_integration import (notebook_extension, live_plot,
5
+from adaptive.notebook_integration import (notebook_extension, live_plot,
5 6
                                    active_plotting_tasks)
6 7
 
7
-from . import learner
8
-from . import runner
9
-from . import utils
8
+from adaptive import learner
9
+from adaptive import runner
10
+from adaptive import utils
10 11
 
11
-from .learner import (BaseLearner, Learner1D, Learner2D, LearnerND,
12
-                      AverageLearner, BalancingLearner, make_datasaver,
13
-                      DataSaver, IntegratorLearner)
12
+from adaptive.learner import (
13
+	BaseLearner, Learner1D, Learner2D, LearnerND,
14
+    AverageLearner, BalancingLearner, make_datasaver,
15
+    DataSaver, IntegratorLearner
16
+)
14 17
 
15 18
 with suppress(ImportError):
16 19
     # Only available if 'scikit-optimize' is installed
17
-    from .learner import SKOptLearner
20
+    from adaptive.learner import SKOptLearner
18 21
 
19
-from .runner import Runner, AsyncRunner, BlockingRunner
22
+from adaptive.runner import Runner, AsyncRunner, BlockingRunner
20 23
 
21
-from ._version import __version__
24
+from adaptive._version import __version__
22 25
 del _version
23 26
 
24 27
 del notebook_integration  # to avoid confusion with `notebook_extension`
Browse code

add doc files

Bas Nijholt authored on 16/10/2018 18:10:12
Showing 1 changed files
... ...
@@ -8,15 +8,15 @@ from . import learner
8 8
 from . import runner
9 9
 from . import utils
10 10
 
11
-from .learner import (Learner1D, Learner2D, LearnerND, AverageLearner,
12
-                      BalancingLearner, make_datasaver, DataSaver,
13
-                      IntegratorLearner)
11
+from .learner import (BaseLearner, Learner1D, Learner2D, LearnerND,
12
+                      AverageLearner, BalancingLearner, make_datasaver,
13
+                      DataSaver, IntegratorLearner)
14 14
 
15 15
 with suppress(ImportError):
16 16
     # Only available if 'scikit-optimize' is installed
17 17
     from .learner import SKOptLearner
18 18
 
19
-from .runner import Runner, BlockingRunner
19
+from .runner import Runner, AsyncRunner, BlockingRunner
20 20
 
21 21
 from ._version import __version__
22 22
 del _version
Browse code

update to the latest miniver

Bas Nijholt authored on 15/10/2018 14:03:58
Showing 1 changed files
... ...
@@ -17,9 +17,8 @@ with suppress(ImportError):
17 17
     from .learner import SKOptLearner
18 18
 
19 19
 from .runner import Runner, BlockingRunner
20
-from . import version
21 20
 
22
-__version__ = version.version
21
+from ._version import __version__
22
+del _version
23 23
 
24 24
 del notebook_integration  # to avoid confusion with `notebook_extension`
25
-del version
Browse code

add LearnerND to adaptive in standard import add plot_slice function to plot a slice of the evaluated function adapt the ask function to return a point

Jorn Hoofwijk authored on 27/05/2018 17:54:04 • Bas Nijholt committed on 11/07/2018 05:27:20
Showing 1 changed files
... ...
@@ -8,7 +8,7 @@ from . import learner
8 8
 from . import runner
9 9
 from . import utils
10 10
 
11
-from .learner import (Learner1D, Learner2D, AverageLearner,
11
+from .learner import (Learner1D, Learner2D, LearnerND, AverageLearner,
12 12
                       BalancingLearner, make_datasaver, DataSaver,
13 13
                       IntegratorLearner)
14 14
 
Browse code

use contextlib.suppress

Bas Nijholt authored on 10/07/2018 23:25:10
Showing 1 changed files
... ...
@@ -1,4 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2
+from contextlib import suppress
3
+
2 4
 from .notebook_integration import (notebook_extension, live_plot,
3 5
                                    active_plotting_tasks)
4 6
 
... ...
@@ -9,11 +11,10 @@ from . import utils
9 11
 from .learner import (Learner1D, Learner2D, AverageLearner,
10 12
                       BalancingLearner, make_datasaver, DataSaver,
11 13
                       IntegratorLearner)
12
-try:
14
+
15
+with suppress(ImportError):
13 16
     # Only available if 'scikit-optimize' is installed
14 17
     from .learner import SKOptLearner
15
-except ImportError:
16
-    pass
17 18
 
18 19
 from .runner import Runner, BlockingRunner
19 20
 from . import version
Browse code

add 'make_datasaver' that returns a 'DataSaver' of a 'learner_type'

Bas Nijholt authored on 20/06/2018 19:03:39
Showing 1 changed files
... ...
@@ -7,7 +7,8 @@ from . import runner
7 7
 from . import utils
8 8
 
9 9
 from .learner import (Learner1D, Learner2D, AverageLearner,
10
-                      BalancingLearner, DataSaver, IntegratorLearner)
10
+                      BalancingLearner, make_datasaver, DataSaver,
11
+                      IntegratorLearner)
11 12
 try:
12 13
     # Only available if 'scikit-optimize' is installed
13 14
     from .learner import SKOptLearner
Browse code

Merge branch 'feature/skopt' into 'master'

Feature/skopt

See merge request qt/adaptive!64

Joseph Weston authored on 20/06/2018 14:50:23
Showing 0 changed files
Browse code

import utils in __init__

Bas Nijholt authored on 13/06/2018 01:22:47
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@ from .notebook_integration import (notebook_extension, live_plot,
4 4
 
5 5
 from . import learner
6 6
 from . import runner
7
+from . import utils
7 8
 
8 9
 from .learner import (Learner1D, Learner2D, AverageLearner,
9 10
                       BalancingLearner, DataSaver, IntegratorLearner)
Browse code

add scikit-optimize learner

Joseph Weston authored on 23/05/2018 17:31:15
Showing 1 changed files
... ...
@@ -7,6 +7,12 @@ from . import runner
7 7
 
8 8
 from .learner import (Learner1D, Learner2D, AverageLearner,
9 9
                       BalancingLearner, DataSaver, IntegratorLearner)
10
+try:
11
+    # Only available if 'scikit-optimize' is installed
12
+    from .learner import SKOptLearner
13
+except ImportError:
14
+    pass
15
+
10 16
 from .runner import Runner, BlockingRunner
11 17
 from . import version
12 18
 
Browse code

modify filenames and version-module import from setup.py

Remove usage of deprecated 'imp' module in favour of 'importlib'.
Also remove the package name from as many places as possible.

Joseph Weston authored on 21/02/2018 10:06:07
Showing 1 changed files
... ...
@@ -8,9 +8,9 @@ from . import runner
8 8
 from .learner import (Learner1D, Learner2D, AverageLearner,
9 9
                       BalancingLearner, DataSaver, IntegratorLearner)
10 10
 from .runner import Runner, BlockingRunner
11
-from . import _version
11
+from . import version
12 12
 
13
-__version__ = _version.version
13
+__version__ = version.version
14 14
 
15 15
 del notebook_integration  # to avoid confusion with `notebook_extension`
16
-del _version
16
+del version
Browse code

add functionality to get version from git

We want a single source of truth for versioning; we choose
git tags.

Joseph Weston authored on 20/02/2018 14:51:52
Showing 1 changed files
... ...
@@ -8,5 +8,9 @@ from . import runner
8 8
 from .learner import (Learner1D, Learner2D, AverageLearner,
9 9
                       BalancingLearner, DataSaver, IntegratorLearner)
10 10
 from .runner import Runner, BlockingRunner
11
+from . import _version
12
+
13
+__version__ = _version.version
11 14
 
12 15
 del notebook_integration  # to avoid confusion with `notebook_extension`
16
+del _version
Browse code

split runner into synchronous and asynchronous varieties

Joseph Weston authored on 14/02/2018 17:45:15
Showing 1 changed files
... ...
@@ -7,6 +7,6 @@ from . import runner
7 7
 
8 8
 from .learner import (Learner1D, Learner2D, AverageLearner,
9 9
                       BalancingLearner, DataSaver, IntegratorLearner)
10
-from .runner import Runner
10
+from .runner import Runner, BlockingRunner
11 11
 
12 12
 del notebook_integration  # to avoid confusion with `notebook_extension`
Browse code

fix broken live_plot reference and introduce multi plotting option

Bas Nijholt authored on 10/12/2017 12:24:21
Showing 1 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 from .notebook_integration import (notebook_extension, live_plot,
3
-                                   active_plotting_task)
3
+                                   active_plotting_tasks)
4 4
 
5 5
 from . import learner
6 6
 from . import runner
Browse code

allow only 1 active live plot at a time

Typically people will only want one live plot at a time, and this
avoids keeping several (typically expensive) background tasks
around. Also, set the active plot reference to None when the
live plot is cancelled.

Joseph Weston authored on 10/12/2017 00:03:44
Showing 1 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 from .notebook_integration import (notebook_extension, live_plot,
3
-                                   active_plotting_tasks)
3
+                                   active_plotting_task)
4 4
 
5 5
 from . import learner
6 6
 from . import runner
Browse code

save live plotting tasks into internal datastructure

remove references to live plotting tasks from the Runner and
instead maintain a mapping from plot name to task. This avoids
polluting the runner, but also allows users to maintain references
to plotting tasks, so that they can cancel them at will.

Closes #38.

Joseph Weston authored on 09/12/2017 15:10:20
Showing 1 changed files
... ...
@@ -1,5 +1,6 @@
1 1
 # -*- coding: utf-8 -*-
2
-from .notebook_integration import notebook_extension, live_plot
2
+from .notebook_integration import (notebook_extension, live_plot,
3
+                                   active_plotting_tasks)
3 4
 
4 5
 from . import learner
5 6
 from . import runner
Browse code

remove notebook_integration from __init__

Bas Nijholt authored on 08/12/2017 17:40:45
Showing 1 changed files
... ...
@@ -7,3 +7,5 @@ from . import runner
7 7
 from .learner import (Learner1D, Learner2D, AverageLearner,
8 8
                       BalancingLearner, DataSaver, IntegratorLearner)
9 9
 from .runner import Runner
10
+
11
+del notebook_integration  # to avoid confusion with `notebook_extension`
Browse code

fix small problems in notebook that arose in meeting

Bas Nijholt authored on 01/11/2017 14:38:51
Showing 1 changed files
... ...
@@ -4,5 +4,6 @@ from .notebook_integration import notebook_extension, live_plot
4 4
 from . import learner
5 5
 from . import runner
6 6
 
7
-from .learner import Learner1D, AverageLearner
7
+from .learner import (Learner1D, Learner2D, AverageLearner,
8
+                      BalancingLearner, DataSaver, IntegratorLearner)
8 9
 from .runner import Runner
Browse code

add 'AverageLearner' to the root namespace

Joseph Weston authored on 23/08/2017 12:29:19
Showing 1 changed files
... ...
@@ -4,5 +4,5 @@ from .notebook_integration import notebook_extension, live_plot
4 4
 from . import learner
5 5
 from . import runner
6 6
 
7
-from .learner import Learner1D
7
+from .learner import Learner1D, AverageLearner
8 8
 from .runner import Runner
Browse code

reorganise adaptive learners and runners into a package

Joseph Weston authored on 18/08/2017 11:12:32
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,8 @@
1
+# -*- coding: utf-8 -*-
2
+from .notebook_integration import notebook_extension, live_plot
3
+
4
+from . import learner
5
+from . import runner
6
+
7
+from .learner import Learner1D
8
+from .runner import Runner