Commit d7853ed7 authored by theos's avatar theos

Fixed dependency on nifty.about.

parent af321e6c
Pipeline #3815 skipped
# -*- coding: utf-8 -*-
import numpy as np
from nifty import about
def cast_axis_to_tuple(axis):
......@@ -13,6 +12,6 @@ def cast_axis_to_tuple(axis):
if np.isscalar(axis):
axis = (int(axis), )
else:
raise TypeError(about._errors.cstring(
"ERROR: Could not convert axis-input to tuple of ints"))
raise TypeError(
"ERROR: Could not convert axis-input to tuple of ints")
return axis
......@@ -4,7 +4,7 @@ import numpy as np
from d2o.config import configuration as gc,\
dependency_injector as gdi
dependency_injector as gdi
from d2o_librarian import d2o_librarian
from cast_axis_to_tuple import cast_axis_to_tuple
......@@ -13,8 +13,11 @@ from strategies import STRATEGIES
MPI = gdi[gc['mpi_module']]
about_cstring = lambda z: z
from sys import stdout
warn_print = lambda z: stdout.write(z + "\n"); stdout.flush()
about_warnings_cprint = lambda z: stdout.write(z + "\n"); stdout.flush()
about_infos_cprint = lambda z: stdout.write(z + "\n"); stdout.flush()
class distributed_data_object(object):
"""A multidimensional array with modular MPI-based distribution schemes.
......@@ -124,7 +127,7 @@ class distributed_data_object(object):
only one local object on a specific node is given.
In order to speed up the init process the distributor_factory checks
if the global_configuration object gc yields gc['d2o_init_checks'] == True.
if the global_configuration object gc yields gc['mpi_init_checks'] == True.
If yes, all checks expensive checks are skipped; namely those which need
mpi communication. Use this in order to get a fast init speed without
loosing d2o's init parsing logic.
......@@ -412,7 +415,7 @@ class distributed_data_object(object):
try:
result_data = function(local_data)
except:
about.warnings.cprint(
about_warnings_cprint(
"WARNING: Trying to use np.vectorize!")
result_data = np.vectorize(function)(local_data)
......@@ -1301,7 +1304,7 @@ class distributed_data_object(object):
expensive.
"""
about.warnings.cprint(
about_warnings_cprint(
"WARNING: The current implementation of median is very expensive!")
median = np.median(self.get_full_data(), axis=axis, **kwargs)
if np.isscalar(median):
......@@ -1437,7 +1440,7 @@ class distributed_data_object(object):
if self.dtype not in [np.dtype('int16'), np.dtype('int32'),
np.dtype('int64'), np.dtype('uint16'),
np.dtype('uint32'), np.dtype('uint64')]:
raise TypeError(about._errors.cstring(
raise TypeError(about_cstring(
"ERROR: Distributed-data-object must be of integer datatype!"))
minlength = max(self.amax() + 1, minlength)
......
This diff is collapsed.
......@@ -2,8 +2,8 @@
import numpy as np
from nifty.keepers import global_configuration as gc,\
global_dependency_injector as gdi
from d2o.config import configuration as gc,\
dependency_injector as gdi
MPI = gdi[gc['mpi_module']]
......
# -*- coding: utf-8 -*-
from nifty.keepers import global_dependency_injector as gdi
from d2o.config import dependency_injector as gdi
pyfftw = gdi.get('pyfftw')
......
......@@ -2,8 +2,8 @@
import numpy as np
from nifty.keepers import global_configuration as gc,\
global_dependency_injector as gdi
from d2o.config import configuration as gc,\
dependency_injector as gdi
MPI = gdi[gc['mpi_module']]
......
......@@ -13,9 +13,9 @@ import numpy as np
import warnings
import tempfile
import nifty
from nifty.d2o import distributed_data_object,\
STRATEGIES
import d2o
from d2o import distributed_data_object,\
STRATEGIES
from distutils.version import LooseVersion as lv
......@@ -81,10 +81,10 @@ comparison_operators = ['__ne__', '__lt__', '__le__', '__eq__', '__ge__',
###############################################################################
hdf5_test_paths = [ # ('hdf5_init_test.hdf5', None),
('hdf5_init_test.hdf5', os.path.join(os.path.dirname(nifty.__file__),
('hdf5_init_test.hdf5', os.path.join(os.path.dirname(d2o.__file__),
'test/hdf5_init_test.hdf5')),
('hdf5_init_test.hdf5',
os.path.join(os.path.dirname(nifty.__file__),
os.path.join(os.path.dirname(d2o.__file__),
'test//hdf5_test_folder/hdf5_init_test.hdf5'))]
###############################################################################
......
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