There is a maintenance of MPCDF Gitlab on Thursday, April 22st 2020, 9:00 am CEST - Expect some service interruptions during this time

Commit b1a824c8 authored by theos's avatar theos

Bugfixes: Added h5py to dependency_injector. Fixed apply_scalar_function (np.vectorize) and argmax.

parent 889b7964
Pipeline #3842 skipped
......@@ -4,8 +4,9 @@ import keepers
# Setup the dependency injector
dependency_injector = keepers.DependencyInjector(
[('mpi4py.MPI', 'MPI'),
('mpi_dummy', 'MPI_dummy')]
('mpi4py.MPI', 'MPI'),
('d2o.mpi_dummy.mpi_dummy', 'MPI_dummy')]
dependency_injector.register('pyfftw', lambda z: hasattr(z, 'FFTW_MPI'))
......@@ -417,7 +417,8 @@ class distributed_data_object(object):
"WARNING: Trying to use np.vectorize!")
result_data = np.vectorize(function)(local_data)
result_data = np.vectorize(function,
if inplace is True:
result_d2o = self
......@@ -1244,13 +1245,17 @@ class distributed_data_object(object):
if 0 in self.local_shape:
local_argmax = np.nan
local_argmax_value = np.nan
local_argmax_value = -np.inf
globalized_local_argmax = np.nan
local_argmax = np.argmax(
local_argmax_value =[np.unravel_index(local_argmax,]
globalized_local_argmax = self.distributor.globalize_flat_index(
local_argmax_value =[np.unravel_index(local_argmax,]
# instead of inverting the sign of local_argmax_value, invert
# the value of the index. Inverting the former leads to errors
# when the dtype is unsigned (uint). By inverting the latter
# we can extract the last entry from the sorted list below
globalized_local_argmax = -self.distributor.globalize_flat_index(
local_argmax_list = self.distributor._allgather(
......@@ -1260,7 +1265,8 @@ class distributed_data_object(object):
('index', np.dtype('float'))])
local_argmax_list = np.sort(local_argmax_list,
order=['value', 'index'])
# take the last entry here and correct the minus sign of the index
def argmin_nonflat(self, axis=None):
""" Returns the unraveld index of the d2o's smallest value.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment