Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.base
Commits
d1351af8
Commit
d1351af8
authored
Jul 07, 2018
by
Tiago de Freitas Pereira
Browse files
[sphinx] Fixed doctests
parent
f555cb9c
Pipeline
#21741
canceled with stages
in 23 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
bob/bio/base/extractor/stacks.py
View file @
d1351af8
...
...
@@ -106,8 +106,8 @@ class SequentialExtractor(SequentialProcessor, MultipleExtractor):
>>> seq_extractor = SequentialExtractor(
... [CallableExtractor(f) for f in
... [np.cast['float64'], lambda x: x / 2, partial(np.mean, axis=1)]])
>>> seq_extractor(raw_data)
array([ 1., 1.])
>>>
np.allclose(
seq_extractor(raw_data)
,[ 1., 1.])
True
>>> np.all(seq_extractor(raw_data) ==
... np.mean(np.cast['float64'](raw_data) / 2, axis=1))
True
...
...
@@ -166,10 +166,8 @@ class ParallelExtractor(ParallelProcessor, MultipleExtractor):
>>> parallel_extractor = ParallelExtractor(
... [CallableExtractor(f) for f in
... [np.cast['float64'], lambda x: x / 2.0]])
>>> list(parallel_extractor(raw_data))
[array([[ 1., 2., 3.],
[ 1., 2., 3.]]), array([[ 0.5, 1. , 1.5],
[ 0.5, 1. , 1.5]])]
>>> np.allclose(list(parallel_extractor(raw_data)),[[[ 1., 2., 3.],[ 1., 2., 3.]], [[ 0.5, 1. , 1.5],[ 0.5, 1. , 1.5]]])
True
The data may be further processed using a :any:`SequentialExtractor`:
...
...
@@ -177,9 +175,9 @@ class ParallelExtractor(ParallelProcessor, MultipleExtractor):
>>> total_extractor = SequentialExtractor(
... [parallel_extractor, CallableExtractor(list),
... CallableExtractor(partial(np.concatenate, axis=1))])
>>> total_extractor(raw_data)
array([[ 1. , 2. , 3. , 0.5, 1. , 1.5],
[ 1. , 2. , 3. , 0.5, 1. , 1.5]])
>>>
np.allclose(
total_extractor(raw_data)
,[[ 1. , 2. , 3. , 0.5, 1. , 1.5],[ 1. , 2. , 3. , 0.5, 1. , 1.5]])
True
"""
def
__init__
(
self
,
processors
,
**
kwargs
):
...
...
bob/bio/base/preprocessor/stacks.py
View file @
d1351af8
...
...
@@ -23,8 +23,8 @@ class SequentialPreprocessor(SequentialProcessor, Preprocessor):
>>> seq_preprocessor = SequentialPreprocessor(
... [CallablePreprocessor(f, accepts_annotations=False) for f in
... [np.cast['float64'], lambda x: x / 2, partial(np.mean, axis=1)]])
>>> seq_preprocessor(raw_data)
array([ 1., 1.])
>>>
np.allclose(
seq_preprocessor(raw_data)
, [ 1., 1.])
True
>>> np.all(seq_preprocessor(raw_data) ==
... np.mean(np.cast['float64'](raw_data) / 2, axis=1))
True
...
...
@@ -73,10 +73,8 @@ class ParallelPreprocessor(ParallelProcessor, Preprocessor):
>>> parallel_preprocessor = ParallelPreprocessor(
... [CallablePreprocessor(f, accepts_annotations=False) for f in
... [np.cast['float64'], lambda x: x / 2.0]])
>>> list(parallel_preprocessor(raw_data))
[array([[ 1., 2., 3.],
[ 1., 2., 3.]]), array([[ 0.5, 1. , 1.5],
[ 0.5, 1. , 1.5]])]
>>> np.allclose(list(parallel_preprocessor(raw_data)),[[[ 1., 2., 3.],[ 1., 2., 3.]], [[ 0.5, 1. , 1.5],[ 0.5, 1. , 1.5]]])
True
The data may be further processed using a :any:`SequentialPreprocessor`:
...
...
@@ -84,9 +82,9 @@ class ParallelPreprocessor(ParallelProcessor, Preprocessor):
>>> total_preprocessor = SequentialPreprocessor(
... [parallel_preprocessor, CallablePreprocessor(list, False),
... CallablePreprocessor(partial(np.concatenate, axis=1), False)])
>>> total_preprocessor(raw_data)
array([[ 1. , 2. , 3. , 0.5, 1. , 1.5],
[ 1. , 2. , 3. , 0.5, 1. , 1.5]])
>>>
np.allclose(
total_preprocessor(raw_data)
,[[ 1. , 2. , 3. , 0.5, 1. , 1.5],[ 1. , 2. , 3. , 0.5, 1. , 1.5]])
True
"""
def
__init__
(
self
,
processors
,
**
kwargs
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment