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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.io.stream
Commits
ec188036
Commit
ec188036
authored
3 years ago
by
Vincent POLLET
Browse files
Options
Downloads
Patches
Plain Diff
Write timestamps to file as dataset attributes along with data
parent
4669efb1
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!19
Write timestamps to file as dataset attributes along with data
Pipeline
#54317
failed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/io/stream/stream.py
+10
-1
10 additions, 1 deletion
bob/io/stream/stream.py
bob/io/stream/stream_file.py
+7
-1
7 additions, 1 deletion
bob/io/stream/stream_file.py
with
17 additions
and
2 deletions
bob/io/stream/stream.py
+
10
−
1
View file @
ec188036
...
@@ -862,7 +862,16 @@ class StreamSave(StreamFilter):
...
@@ -862,7 +862,16 @@ class StreamSave(StreamFilter):
raise ValueError(
"
Output
file
is
not
a
valid
StreamFile
.
"
)
raise ValueError(
"
Output
file
is
not
a
valid
StreamFile
.
"
)
def put(self, data, timestamp=None):
def put(self, data, timestamp=None):
self.file.put_frame(self.name, data)
"""
Pass data and timestamp to the :obj:`~bob.io.stream.StreamFile` to write to disk.
Parameters
----------
data : :obj:`numpy.ndarray`
data to write to file.
timestamp : int or float
Timestamp of `data`, by default None.
"""
self.file.put_frame(self.name, data, timestamp)
################################################################################
################################################################################
...
...
This diff is collapsed.
Click to expand it.
bob/io/stream/stream_file.py
+
7
−
1
View file @
ec188036
...
@@ -200,7 +200,7 @@ class StreamFile:
...
@@ -200,7 +200,7 @@ class StreamFile:
# TODO rotate if requested
# TODO rotate if requested
return
data
return
data
def
put_frame
(
self
,
name
,
data
):
def
put_frame
(
self
,
name
,
data
,
timestamp
=
None
):
"""
Appends `data` (a frame of a stream) to the hdf5 file.
"""
Appends `data` (a frame of a stream) to the hdf5 file.
Parameters
Parameters
...
@@ -211,3 +211,9 @@ class StreamFile:
...
@@ -211,3 +211,9 @@ class StreamFile:
Data frame to append.
Data frame to append.
"""
"""
self
.
hdf5_file
.
append
(
name
,
data
)
self
.
hdf5_file
.
append
(
name
,
data
)
if
timestamp
is
not
None
:
try
:
previous_timestamps
=
self
.
hdf5_file
.
get_attribute
(
"
timestamps
"
,
name
)
except
RuntimeError
:
# No previous timestamps
previous_timestamps
=
[]
self
.
hdf5_file
.
set_attribute
(
"
timestamps
"
,
np
.
append
(
previous_timestamps
,
timestamp
),
name
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment