Skip to content

Commit

Permalink
Address comments to pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
vuolleko committed Jan 20, 2017
1 parent 2c79de0 commit aad0683
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion elfi/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions elfi/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 8 additions & 6 deletions elfi/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand All @@ -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:
Expand All @@ -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.
Expand All @@ -66,4 +69,3 @@ def __call__(self, *args, **kwargs):
argv = command.split(" ")
stdout = check_output(argv, universal_newlines=True)
return self.post(stdout)

0 comments on commit aad0683

Please sign in to comment.