diff --git a/README.rst b/README.rst index ab110ccd7f22fc35d571026e4825a5c4fe42d74b..f4a6a25c967ebda78a72136f57b130b72224a49a 100644 --- a/README.rst +++ b/README.rst @@ -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 .. code-block:: python + from bob.io.stream import Stream color = Stream("color") @@ -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 .. code-block:: python + from bob.io.stream import StreamFile f = StreamFile("data.h5") @@ -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 .. code-block:: python + color.source = streaming_source print(color.ndim) # -> 4 @@ -79,6 +82,7 @@ object, the first dimension of a stream :obj:`Stream` is always a time direction our stream to a definite state .. code-block:: python + color.source = f frame = color[0] @@ -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) .. code-block:: python + what = color[3:13, :, 100:200, 300:400] print(what.ndim) # -> 4 @@ -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 .. code-block:: python + print(color.parent == f) # -> True print(color.child == what) # -> True @@ -109,12 +115,14 @@ This processing chain can be further extended by adding 'filters' after the chil implemented by the :obj:`stream` object .. code-block:: python + norm = what.normalise() # -> <class 'StreamNormalise'> 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. .. code-block:: python + # StreamFile("file.h5") # -> Stream("color") # -> 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 ('real') is returned. .. code-block:: python + data = real[0] data = real[0] @@ -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 .. code-block:: python + data0, *meta0 = real.load(0) data1, *meta1 = real.load(slice(3,13,2))