From aad068360884b6b385a0108f49f58a79dc676332 Mon Sep 17 00:00:00 2001 From: Henri Vuollekoski Date: Mon, 16 Jan 2017 11:17:54 +0200 Subject: [PATCH] Address comments to pull request --- elfi/env.py | 1 - elfi/methods.py | 1 + elfi/wrapper.py | 14 ++++++++------ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/elfi/env.py b/elfi/env.py index 17c10620..9a546c9d 100644 --- a/elfi/env.py +++ b/elfi/env.py @@ -7,7 +7,6 @@ logging.getLogger('tornado').setLevel(logging.WARNING) -logging.getLogger('elfi.methods').setLevel(logging.INFO) _globals = defaultdict(lambda: None) _whitelist = ["client", "inference_task"] diff --git a/elfi/methods.py b/elfi/methods.py index 139e30cc..e8e9a2a5 100644 --- a/elfi/methods.py +++ b/elfi/methods.py @@ -16,6 +16,7 @@ from elfi.bo.acquisition import LCBAcquisition, SecondDerivativeNoiseMixin, RbfAtPendingPointsMixin logger = logging.getLogger(__name__) +logger.setLevel(logging.INFO) """Implementations of some ABC algorithms. diff --git a/elfi/wrapper.py b/elfi/wrapper.py index a31fdeec..a0945eca 100644 --- a/elfi/wrapper.py +++ b/elfi/wrapper.py @@ -5,8 +5,8 @@ class Wrapper(): """ Wraps an external command to work as a callable operation for a node. - Currently only supports sequential operations (not vectorized). - You can force this by setting batch_size=1 in the ABC method. + Currently only supports sequential operations (not vectorized). This should be + enforced in ELFI by setting batch_size=1 in the ABC method. Parameters ---------- @@ -31,7 +31,7 @@ def process_elfi_internals(command_template, args, kwargs): proc_args = list() for a in args: if isinstance(a, np.ndarray): - if a.shape[0] == 1: + if a.shape == (1, 1): # take single values out of array proc_args.append(a.item()) else: @@ -47,8 +47,11 @@ def process_elfi_internals(command_template, args, kwargs): @staticmethod def read_nparray(stdout): - """ Interpret the stdout as a space-separated numpy array """ - return np.fromstring(stdout, sep=" ")[None, :] + """ Interpret the stdout as a space-separated numpy array. + """ + arr = np.fromstring(stdout, sep=" ") + arr = arr[None, :] # for compatibility with core + return arr def __call__(self, *args, **kwargs): """ Executes the wrapped command, with additional arguments and keyword arguments. @@ -66,4 +69,3 @@ def __call__(self, *args, **kwargs): argv = command.split(" ") stdout = check_output(argv, universal_newlines=True) return self.post(stdout) -