Skip to content
Snippets Groups Projects
Commit 2c717320 authored by David GEISSBUHLER's avatar David GEISSBUHLER
Browse files

Update README.rst

parent c7cd96d0
No related branches found
No related tags found
No related merge requests found
Pipeline #47868 failed
...@@ -45,6 +45,7 @@ with a focus on raw multi-channel video. It shares part of the interface of a :o ...@@ -45,6 +45,7 @@ with a focus on raw multi-channel video. It shares part of the interface of a :o
instance the propertises :obj:`ndim` and :obj:`shape`, but with a name on top instance the propertises :obj:`ndim` and :obj:`shape`, but with a name on top
.. code-block:: python .. code-block:: python
from bob.io.stream import Stream from bob.io.stream import Stream
color = Stream("color") color = Stream("color")
...@@ -56,6 +57,7 @@ A :obj:`Stream` object is created in an 'indefinite' state, characterised by a : ...@@ -56,6 +57,7 @@ A :obj:`Stream` object is created in an 'indefinite' state, characterised by a :
Such a newly created can be made to point to a dataset stored in a properly formated HDF5 file Such a newly created can be made to point to a dataset stored in a properly formated HDF5 file
.. code-block:: python .. code-block:: python
from bob.io.stream import StreamFile from bob.io.stream import StreamFile
f = StreamFile("data.h5") f = StreamFile("data.h5")
...@@ -69,6 +71,7 @@ Which is the 'definite' state where the objet points towards a data source, this ...@@ -69,6 +71,7 @@ Which is the 'definite' state where the objet points towards a data source, this
A last possible state for such an object is a 'streaming' state where A last possible state for such an object is a 'streaming' state where
.. code-block:: python .. code-block:: python
color.source = streaming_source color.source = streaming_source
print(color.ndim) # -> 4 print(color.ndim) # -> 4
...@@ -79,6 +82,7 @@ object, the first dimension of a stream :obj:`Stream` is always a time direction ...@@ -79,6 +82,7 @@ object, the first dimension of a stream :obj:`Stream` is always a time direction
our stream to a definite state our stream to a definite state
.. code-block:: python .. code-block:: python
color.source = f color.source = f
frame = color[0] frame = color[0]
...@@ -91,6 +95,7 @@ Similarly to a numpy array of more than one dimension, subscripting on the first ...@@ -91,6 +95,7 @@ Similarly to a numpy array of more than one dimension, subscripting on the first
the first index however is not an integer but a range (a pythonic :obj:`slice` formally) the first index however is not an integer but a range (a pythonic :obj:`slice` formally)
.. code-block:: python .. code-block:: python
what = color[3:13, :, 100:200, 300:400] what = color[3:13, :, 100:200, 300:400]
print(what.ndim) # -> 4 print(what.ndim) # -> 4
...@@ -102,6 +107,7 @@ the data in the object it subscripts. It should be noted that no data is transfe ...@@ -102,6 +107,7 @@ the data in the object it subscripts. It should be noted that no data is transfe
is a only node in a data processing chain, with a parent and a child is a only node in a data processing chain, with a parent and a child
.. code-block:: python .. code-block:: python
print(color.parent == f) # -> True print(color.parent == f) # -> True
print(color.child == what) # -> True print(color.child == what) # -> True
...@@ -109,12 +115,14 @@ This processing chain can be further extended by adding 'filters' after the chil ...@@ -109,12 +115,14 @@ This processing chain can be further extended by adding 'filters' after the chil
implemented by the :obj:`stream` object implemented by the :obj:`stream` object
.. code-block:: python .. code-block:: python
norm = what.normalise() # -> <class 'StreamNormalise'> norm = what.normalise() # -> <class 'StreamNormalise'>
real = norm.as_type('float') # -> <class 'StreamAsType'> real = norm.as_type('float') # -> <class 'StreamAsType'>
A list of filters is returned by the :obj:`get_available_filters()` method of the :obj:`Stream` class. A list of filters is returned by the :obj:`get_available_filters()` method of the :obj:`Stream` class.
.. code-block:: python .. code-block:: python
# StreamFile("file.h5") # StreamFile("file.h5")
# -> Stream("color") # -> Stream("color")
# -> StreamView(index=(slice(3,13), slice(None), slice(100,200), slice(300,400))) # -> StreamView(index=(slice(3,13), slice(None), slice(100,200), slice(300,400)))
...@@ -127,6 +135,7 @@ In the following example, the data goes down the chain on the first line, on the ...@@ -127,6 +135,7 @@ In the following example, the data goes down the chain on the first line, on the
('real') is returned. ('real') is returned.
.. code-block:: python .. code-block:: python
data = real[0] data = real[0]
data = real[0] data = real[0]
...@@ -134,6 +143,7 @@ This buffering avoids useless computation in more complex pipelines. An alternat ...@@ -134,6 +143,7 @@ This buffering avoids useless computation in more complex pipelines. An alternat
the :obj:`load` method that also allows loading several frames at the same time the :obj:`load` method that also allows loading several frames at the same time
.. code-block:: python .. code-block:: python
data0, *meta0 = real.load(0) data0, *meta0 = real.load(0)
data1, *meta1 = real.load(slice(3,13,2)) data1, *meta1 = real.load(slice(3,13,2))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment