Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.bio.base
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
Package registry
Model registry
Operate
Environments
Terraform modules
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.bio.base
Commits
4a1731f6
There was a problem fetching the pipeline summary.
Commit
4a1731f6
authored
8 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Turned lambda function into named function
parent
fafbda49
No related branches found
No related tags found
1 merge request
!38
Issue 8 remove database configuration
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/base/preprocessor/Preprocessor.py
+1
-1
1 addition, 1 deletion
bob/bio/base/preprocessor/Preprocessor.py
bob/bio/base/utils/io.py
+28
-0
28 additions, 0 deletions
bob/bio/base/utils/io.py
with
29 additions
and
1 deletion
bob/bio/base/preprocessor/Preprocessor.py
+
1
−
1
View file @
4a1731f6
...
...
@@ -22,7 +22,7 @@ class Preprocessor:
A list of keyword arguments to be written in the :py:meth:`__str__` function.
"""
def
__init__
(
self
,
writes_data
=
True
,
read_original_data
=
lambda
biofile
,
directory
,
extension
:
biofile
.
load
(
directory
,
extension
)
,
**
kwargs
):
def
__init__
(
self
,
writes_data
=
True
,
read_original_data
=
utils
.
read_original_data
,
**
kwargs
):
# Each class needs to have a constructor taking
# all the parameters that are required for the preprocessing as arguments
self
.
writes_data
=
writes_data
...
...
This diff is collapsed.
Click to expand it.
bob/bio/base/utils/io.py
+
28
−
0
View file @
4a1731f6
...
...
@@ -4,6 +4,7 @@ import tempfile, tarfile
import
logging
logger
=
logging
.
getLogger
(
"
bob.bio.base
"
)
from
..
import
database
import
bob.io.base
def
filter_missing_files
(
file_names
,
split_by_client
=
False
,
allow_missing_files
=
True
):
...
...
@@ -51,6 +52,33 @@ def check_file(filename, force, expected_file_size = 1):
return
False
def
read_original_data
(
biofile
,
directory
,
extension
):
"""
read_original_data(biofile, directory, extension) -> data
This function reads the original data using the given ``biofile`` instance.
It simply calls ``load(directory, extension)`` from :py:class:`bob.bio.base.database.BioFile` or one of its derivatives.
**Parameters:**
``biofile`` : :py:class:`bob.bio.base.database.BioFile` or one of its derivatives
The file to read the original data.
``directory`` : str
The base directory of the database.
``extension`` : str or ``None``
The extension of the original data.
Might be ``None`` if the ``biofile`` itself has the extension stored.
**Returns**
``data`` : object
Whatver ``biofile.load`` returns; usually a :py:class:`numpy.ndarray`
"""
assert
isinstance
(
biofile
,
database
.
BioFile
)
return
biofile
.
load
(
directory
,
extension
)
def
load
(
file
):
"""
Loads data from file. The given file might be an HDF5 file open for reading or a string.
"""
if
isinstance
(
file
,
bob
.
io
.
base
.
HDF5File
):
...
...
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