Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bob.io.stream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.io.stream
Merge requests
!19
Write timestamps to file as dataset attributes along with data
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Write timestamps to file as dataset attributes along with data
timestamps_writing
into
master
Overview
0
Commits
2
Pipelines
2
Changes
3
Merged
Vincent POLLET
requested to merge
timestamps_writing
into
master
3 years ago
Overview
0
Commits
2
Pipelines
2
Changes
3
0
0
Merge request reports
Compare
master
version 1
ec188036
3 years ago
master (base)
and
latest version
latest version
48b7b75f
2 commits,
3 years ago
version 1
ec188036
1 commit,
3 years ago
3 files
+
30
−
4
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
bob/io/stream/test/test.py
+
13
−
2
View file @ 48b7b75f
Edit in single-file editor
Open in Web IDE
Show full file
@@ -38,19 +38,30 @@ def test_stream_write():
@@ -38,19 +38,30 @@ def test_stream_write():
np
.
arange
(
12
*
52
).
astype
(
np
.
float64
).
reshape
((
12
,
52
)),
np
.
arange
(
12
*
52
).
astype
(
np
.
float64
).
reshape
((
12
,
52
)),
]
]
for
a_test_data
in
test_data
:
test_timestamps
=
[
np
.
linspace
(
0
,
20
*
test_data
[
0
].
shape
[
0
],
test_data
[
0
].
shape
[
0
]),
np
.
linspace
(
10
,
10
*
test_data
[
1
].
shape
[
0
],
test_data
[
1
].
shape
[
0
]),
np
.
linspace
(
100
,
200
*
test_data
[
2
].
shape
[
0
],
test_data
[
2
].
shape
[
0
]),
np
.
linspace
(
5
,
6
*
test_data
[
3
].
shape
[
0
],
test_data
[
3
].
shape
[
0
]),
]
for
a_test_data
,
a_test_timestamps
in
zip
(
test_data
,
test_timestamps
):
with
StreamFile
(
resource_path
(
"
test/data/save_test.h5
"
),
mode
=
"
w
"
)
as
output_file
:
with
StreamFile
(
resource_path
(
"
test/data/save_test.h5
"
),
mode
=
"
w
"
)
as
output_file
:
stream
=
Stream
(
"
test_data
"
)
stream
=
Stream
(
"
test_data
"
)
save_filter
=
stream
.
save
(
output_file
)
save_filter
=
stream
.
save
(
output_file
)
for
i
in
range
(
a_test_data
.
shape
[
0
]):
for
i
in
range
(
a_test_data
.
shape
[
0
]):
stream
.
put
(
a_test_data
[
i
])
stream
.
put
(
a_test_data
[
i
]
,
a_test_timestamps
[
i
]
)
with
StreamFile
(
resource_path
(
"
test/data/save_test.h5
"
),
mode
=
"
r
"
)
as
input_file
:
with
StreamFile
(
resource_path
(
"
test/data/save_test.h5
"
),
mode
=
"
r
"
)
as
input_file
:
stream
=
Stream
(
"
test_data
"
,
input_file
)
stream
=
Stream
(
"
test_data
"
,
input_file
)
data
=
stream
.
load
()
data
=
stream
.
load
()
timestamps
=
input_file
.
get_stream_timestamps
(
"
test_data
"
)
if
np
.
isscalar
(
timestamps
):
# if there is only 1 frame, timestamps are returned as a scalar
timestamps
=
np
.
array
([
timestamps
])
assert
np
.
array_equal
(
data
,
a_test_data
)
assert
np
.
array_equal
(
data
,
a_test_data
)
assert
data
.
dtype
==
a_test_data
.
dtype
assert
data
.
dtype
==
a_test_data
.
dtype
assert
np
.
array_equal
(
timestamps
,
a_test_timestamps
)
os
.
remove
(
resource_path
(
"
test/data/save_test.h5
"
))
os
.
remove
(
resource_path
(
"
test/data/save_test.h5
"
))
Loading