Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.stream
Commits
8c32c23e
Commit
8c32c23e
authored
Sep 19, 2020
by
David GEISSBUHLER
Browse files
view filter frame load ok
parent
5c5824da
Changes
2
Hide whitespace changes
Inline
Side-by-side
api_test.py
View file @
8c32c23e
...
...
@@ -83,8 +83,13 @@ stream_sl = stream_a[1:4]
data_sl
=
data_a
[
1
:
4
]
assert
(
stream_sl
.
shape
==
data_sl
.
shape
)
assert
(
stream_sl
.
ndim
==
data_sl
.
ndim
)
#
assert(np.array_equal(stream_sl.load(), data_sl))
assert
(
np
.
array_equal
(
stream_sl
.
load
(),
data_sl
))
stream_sl
=
stream_a
[
1
::
3
]
data_sl
=
data_a
[
1
::
3
]
assert
(
stream_sl
.
shape
==
data_sl
.
shape
)
assert
(
stream_sl
.
ndim
==
data_sl
.
ndim
)
assert
(
np
.
array_equal
(
stream_sl
.
load
(),
data_sl
))
stream_sl
=
stream_a
[:,
1
]
data_sl
=
data_a
[:,
1
]
...
...
@@ -104,6 +109,14 @@ assert(stream_sl.shape == data_sl.shape)
assert
(
stream_sl
.
ndim
==
data_sl
.
ndim
)
assert
(
np
.
array_equal
(
stream_sl
.
load
(),
data_sl
))
for
t
in
tests
:
s
=
slice
(
t
[
0
],
t
[
1
],
t
[
2
])
dd
=
data_a
[
s
]
sd
=
stream_a
[
s
]
assert
(
sd
.
shape
==
dd
.
shape
)
assert
(
sd
.
ndim
==
dd
.
ndim
)
assert
(
np
.
array_equal
(
sd
.
load
(),
dd
))
###########
#fo = StreamFile('api_test.h5', 'w')
...
...
bob/io/stream/stream.py
View file @
8c32c23e
...
...
@@ -307,7 +307,9 @@ class StreamView(StreamFilter):
return
__ndim
def
load
(
self
,
index
=
None
):
indices
=
get_index_list
(
index
,
self
.
shape
[
0
])
parent_indices
=
get_index_list
(
self
.
frame_view
,
self
.
parent
.
shape
[
0
])
view_indices
=
get_index_list
(
index
,
self
.
shape
[
0
])
indices
=
[
parent_indices
[
i
]
for
i
in
view_indices
]
return
super
().
load
(
indices
)
def
process
(
self
,
data
,
indices
):
...
...
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