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
NIFTy
Commits
198e4750
Commit
198e4750
authored
Jul 18, 2018
by
Martin Reinecke
Browse files
disable min() and max() for Fields and data objects
parent
fee7b4d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
nifty5/data_objects/distributed_do.py
View file @
198e4750
...
...
@@ -158,11 +158,11 @@ class data_object(object):
def
prod
(
self
,
axis
=
None
):
return
self
.
_contraction_helper
(
"prod"
,
MPI
.
PROD
,
axis
)
def
min
(
self
,
axis
=
None
):
return
self
.
_contraction_helper
(
"min"
,
MPI
.
MIN
,
axis
)
#
def min(self, axis=None):
#
return self._contraction_helper("min", MPI.MIN, axis)
def
max
(
self
,
axis
=
None
):
return
self
.
_contraction_helper
(
"max"
,
MPI
.
MAX
,
axis
)
#
def max(self, axis=None):
#
return self._contraction_helper("max", MPI.MAX, axis)
def
mean
(
self
,
axis
=
None
):
if
axis
is
None
:
...
...
nifty5/field.py
View file @
198e4750
...
...
@@ -481,39 +481,39 @@ class Field(object):
def
any
(
self
,
spaces
=
None
):
return
self
.
_contraction_helper
(
'any'
,
spaces
)
def
min
(
self
,
spaces
=
None
):
"""Determines the minimum over the sub-domains given by `spaces`.
Parameters
----------
spaces : None, int or tuple of int (default: None)
The operation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Returns
-------
Field or scalar
The result of the operation. If it is carried out over the entire
domain, this is a scalar, otherwise a Field.
"""
return
self
.
_contraction_helper
(
'min'
,
spaces
)
def
max
(
self
,
spaces
=
None
):
"""Determines the maximum over the sub-domains given by `spaces`.
Parameters
----------
spaces : None, int or tuple of int (default: None)
The operation is only carried out over the sub-domains in this
tuple. If None, it is carried out over all sub-domains.
Returns
-------
Field or scalar
The result of the operation. If it is carried out over the entire
domain, this is a scalar, otherwise a Field.
"""
return
self
.
_contraction_helper
(
'max'
,
spaces
)
#
def min(self, spaces=None):
#
"""Determines the minimum over the sub-domains given by `spaces`.
#
#
Parameters
#
----------
#
spaces : None, int or tuple of int (default: None)
#
The operation is only carried out over the sub-domains in this
#
tuple. If None, it is carried out over all sub-domains.
#
#
Returns
#
-------
#
Field or scalar
#
The result of the operation. If it is carried out over the entire
#
domain, this is a scalar, otherwise a Field.
#
"""
#
return self._contraction_helper('min', spaces)
#
#
def max(self, spaces=None):
#
"""Determines the maximum over the sub-domains given by `spaces`.
#
#
Parameters
#
----------
#
spaces : None, int or tuple of int (default: None)
#
The operation is only carried out over the sub-domains in this
#
tuple. If None, it is carried out over all sub-domains.
#
#
Returns
#
-------
#
Field or scalar
#
The result of the operation. If it is carried out over the entire
#
domain, this is a scalar, otherwise a Field.
#
"""
#
return self._contraction_helper('max', spaces)
def
mean
(
self
,
spaces
=
None
):
"""Determines the mean over the sub-domains given by `spaces`.
...
...
test/test_field.py
View file @
198e4750
...
...
@@ -154,8 +154,8 @@ class Test_Functionality(unittest.TestCase):
assert_equal
(
f1
.
local_data
,
+
f1
.
local_data
)
assert_equal
(
f1
.
sum
(),
f1
.
sum
(
0
))
f1
=
ift
.
from_global_data
(
s1
,
np
.
arange
(
10
))
assert_equal
(
f1
.
min
(),
0
)
assert_equal
(
f1
.
max
(),
9
)
#
assert_equal(f1.min(), 0)
#
assert_equal(f1.max(), 9)
assert_equal
(
f1
.
prod
(),
0
)
def
test_weight
(
self
):
...
...
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