Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
D2O
Commits
083f6433
Commit
083f6433
authored
May 02, 2017
by
Theo Steininger
Browse files
Ported to keepers.Logging.
parent
8c7d198b
Pipeline
#11901
passed with stage
in 7 minutes and 9 seconds
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
d2o/distributed_data_object.py
View file @
083f6433
...
...
@@ -17,7 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
numpy
as
np
from
keepers
import
Versionable
from
keepers
import
Versionable
,
\
Loggable
from
d2o.config
import
configuration
as
gc
,
\
dependency_injector
as
gdi
...
...
@@ -29,13 +30,8 @@ from strategies import STRATEGIES
MPI
=
gdi
[
gc
[
'mpi_module'
]]
about_cstring
=
lambda
z
:
z
from
sys
import
stdout
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
(
Versionable
,
object
):
class
distributed_data_object
(
Loggable
,
Versionable
,
object
):
"""A multidimensional array with modular MPI-based distribution schemes.
The purpose of a distributed_data_object (d2o) is to provide the user
...
...
@@ -429,8 +425,7 @@ class distributed_data_object(Versionable, object):
try
:
result_data
=
function
(
local_data
)
except
:
about_warnings_cprint
(
"WARNING: Trying to use np.vectorize!"
)
self
.
logger
.
warn
(
"Trying to use np.vectorize!"
)
result_data
=
np
.
vectorize
(
function
,
otypes
=
[
local_data
.
dtype
])(
local_data
)
...
...
@@ -1221,11 +1216,9 @@ class distributed_data_object(Versionable, object):
"""
if
0
in
self
.
shape
:
raise
ValueError
(
"ERROR: attempt to get argmin of an empty object"
)
raise
ValueError
(
"Attempt to get argmin of an empty object"
)
if
axis
is
not
None
:
raise
NotImplementedError
(
"ERROR: argmin doesn't support axis "
"keyword"
)
raise
NotImplementedError
(
"argmin doesn't support axis keyword"
)
if
self
.
shape
==
():
return
0
...
...
@@ -1259,9 +1252,9 @@ class distributed_data_object(Versionable, object):
if
0
in
self
.
shape
:
raise
ValueError
(
"
ERROR: a
ttempt to get argmax of an empty object"
)
"
A
ttempt to get argmax of an empty object"
)
if
axis
is
not
None
:
raise
NotImplementedError
(
"
ERROR:
argmax doesn't support axis "
raise
NotImplementedError
(
"argmax doesn't support axis "
"keyword"
)
if
self
.
shape
==
():
return
0
...
...
@@ -1337,8 +1330,8 @@ class distributed_data_object(Versionable, object):
expensive.
"""
about_warnings_cprint
(
"WARNING: The current implementation of median is very
expensive!"
)
self
.
logger
.
warn
(
"The current implementation of median is very "
"
expensive!"
)
median
=
np
.
median
(
self
.
get_full_data
(),
axis
=
axis
,
**
kwargs
)
if
np
.
isscalar
(
median
):
return
median
...
...
@@ -1473,8 +1466,8 @@ class distributed_data_object(Versionable, 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_cstring
(
"ERROR: Distributed-data-object must be of integer
datatype!"
)
)
raise
TypeError
(
"Distributed-data-object must be of integer "
"
datatype!"
)
if
axis
is
():
return
self
.
copy
()
...
...
d2o/distributor_factory.py
View file @
083f6433
This diff is collapsed.
Click to expand it.
d2o/version.py
View file @
083f6433
...
...
@@ -20,4 +20,4 @@
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__
=
'1.
0.8
'
__version__
=
'1.
1.0
'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment