From 9061442dbe356732f5894fc039bba20fc5a06fa6 Mon Sep 17 00:00:00 2001
From: theos <theo.steininger@ultimanet.de>
Date: Wed, 21 Sep 2016 22:17:32 +0200
Subject: [PATCH] Fixed a bug in apply_scalar_function.

---
 d2o/distributed_data_object.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/d2o/distributed_data_object.py b/d2o/distributed_data_object.py
index eee00b3..6da97b5 100644
--- a/d2o/distributed_data_object.py
+++ b/d2o/distributed_data_object.py
@@ -434,10 +434,12 @@ class distributed_data_object(object):
             result_data = np.vectorize(function,
                                        otypes=[local_data.dtype])(local_data)
 
-        if inplace is True:
+        if inplace:
             result_d2o = self
         else:
-            result_d2o = self.copy_empty(dtype=result_data.dtype)
+            if dtype is None:
+                dtype = result_data.dtype
+            result_d2o = self.copy_empty(dtype=dtype)
 
         result_d2o.set_local_data(result_data, copy=False)
 
-- 
GitLab