Skip to content
GitLab
Menu
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
07fc9bc8
Commit
07fc9bc8
authored
Sep 07, 2017
by
Martin Reinecke
Browse files
cleanup
parent
857bb932
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty2go/nifty_utilities.py
View file @
07fc9bc8
...
...
@@ -65,7 +65,6 @@ def get_slice_list(shape, axes):
yield
slice_list
else
:
yield
[
slice
(
None
,
None
)]
return
def
cast_axis_to_tuple
(
axis
,
length
=
None
):
...
...
@@ -152,20 +151,14 @@ def bincount_axis(obj, minlength=None, weights=None, axis=None):
# compute the local bincount results
# -> prepare the local result array
if
weights
is
None
:
result_dtype
=
np
.
int
else
:
result_dtype
=
np
.
float
result_dtype
=
np
.
int
if
weights
is
None
else
np
.
float
local_counts
=
np
.
empty
(
flat_shape
[:
-
1
]
+
(
length
,
),
dtype
=
result_dtype
)
# iterate over all entries in the surviving axes and compute the local
# bincounts
for
slice_list
in
get_slice_list
(
flat_shape
,
axes
=
(
len
(
flat_shape
)
-
1
,
)):
if
weights
is
not
None
:
current_weights
=
weights
[
slice_list
]
else
:
current_weights
=
None
current_weights
=
None
if
weights
is
None
else
weights
[
slice_list
]
local_counts
[
slice_list
]
=
np
.
bincount
(
data
[
slice_list
],
weights
=
current_weights
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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