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
6df3b1c3
Commit
6df3b1c3
authored
4 years ago
by
David GEISSBUHLER
Browse files
Options
Downloads
Patches
Plain Diff
allow stream files with no config
parent
728f9cfc
No related branches found
No related tags found
1 merge request
!8
Accept file handle
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api_test.py
+27
-21
27 additions, 21 deletions
api_test.py
bob/io/stream/stream_file.py
+11
-1
11 additions, 1 deletion
bob/io/stream/stream_file.py
with
38 additions
and
22 deletions
api_test.py
+
27
−
21
View file @
6df3b1c3
from
bob.io.stream
import
Stream
,
StreamFile
,
StreamFilter
,
stream_filter
,
StreamServer
,
StreamRemote
from
bob.io.stream
import
Stream
,
StreamFile
,
StreamFilter
,
stream_filter
#
, StreamServer, StreamRemote
import
numpy
as
np
import
bob.io.base
...
...
@@ -18,7 +18,7 @@ assert(data_b.shape == data_shape)
# create data file
f
=
bob
.
io
.
base
.
HDF5File
(
'
data_file
.h5
'
,
'
w
'
)
f
=
bob
.
io
.
base
.
HDF5File
(
'
api_test
.h5
'
,
'
w
'
)
f
.
set
(
'
data_a
'
,
data_a
)
f
.
set
(
'
data_b
'
,
data_b
)
del
f
...
...
@@ -26,42 +26,48 @@ del f
# TODO timestamps
# TODO config
#
load as stream
#
minimal streams with no config
f
=
StreamFile
(
'
data_file.h5
'
,
'
configjson
'
))
color
=
Stream
(
'
color
'
,
f
)
nir_left
=
Stream
(
'
nir_left_stereo
'
,
f
).
adjust
(
color
)
f
=
StreamFile
(
'
api_test.h5
'
)
stream_a
=
Stream
(
'
data_a
'
,
f
)
stream_b
=
Stream
(
'
data_b
'
,
f
)
assert
(
stream_a
.
shape
==
data_a
.
shape
)
assert
(
stream_b
.
shape
==
data_b
.
shape
)
assert
(
stream_a
.
timestamps
==
None
)
assert
(
stream_b
.
timestamps
==
None
)
assert
(
stream_a
.
camera
==
None
)
assert
(
stream_b
.
camera
==
None
)
print
(
stream_a
.
image_points
)
###########
fo
=
StreamFile
(
'
test.h5
'
,
'
w
'
)
#
fo = StreamFile('
api_
test.h5', 'w')
so
=
Stream
(
'
out
'
)
co
=
so
.
clean
()
co
.
save
(
fo
)
#
so = Stream('out')
#
co = so.clean()
#
co.save(fo)
for
i
in
range
(
10
):
so
[
i
]
=
data
#
for i in range(10):
#
so[i] = data
# or
so
.
append
(
data
)
#
#
so.append(data)
# or
fo
=
StreamFile
(
'
test.h5
'
,
'
w
'
)
so
=
Stream
(
'
out
'
)
co
=
so
.
clean
()
#
fo = StreamFile('test.h5', 'w')
#
so = Stream('out')
#
co = so.clean()
for
i
in
range
(
10
):
so
[
i
]
=
data
#
for i in range(10):
#
so[i] = data
fo
.
save
(
co
)
#
fo.save(co)
...
...
This diff is collapsed.
Click to expand it.
bob/io/stream/stream_file.py
+
11
−
1
View file @
6df3b1c3
...
...
@@ -46,7 +46,15 @@ class StreamFile:
return
list
(
self
.
data_format_config
.
keys
())
def
get_stream_config
(
self
,
stream_name
):
data_config
=
self
.
data_format_config
[
stream_name
]
if
self
.
data_format_config
is
not
None
:
data_config
=
self
.
data_format_config
[
stream_name
]
else
:
# return a generic config if no config is present
# TODO: make formal
data_config
=
{
'
array_format
'
:
None
,
'
rotation
'
:
None
,
'
camera
'
:
None
,
'
path
'
:
stream_name
}
return
data_config
def
get_stream_shape
(
self
,
stream_name
):
...
...
@@ -78,6 +86,8 @@ class StreamFile:
if
"
use_config_from
"
in
data_config
:
data_config
=
self
.
get_stream_config
(
data_config
[
"
use_config_from
"
])
camera_name
=
data_config
[
"
camera
"
]
if
camera_name
is
None
:
return
None
return
self
.
camera_config
[
camera_name
]
def
load_stream_data
(
self
,
stream_name
,
index
):
...
...
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