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
4373e7e0
Commit
4373e7e0
authored
8 years ago
by
Manuel Günther
Browse files
Options
Downloads
Patches
Plain Diff
Updated dummy databases to work with bob.db.atnt directly and return BioFile or BioFileSet objects
parent
a7a9a0d3
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!37
Issue 8 remove database configuration
,
!33
WIP: Resolve "Preprocessor does not use the load method of the BioFile class"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/bio/base/test/dummy/database.py
+9
-5
9 additions, 5 deletions
bob/bio/base/test/dummy/database.py
bob/bio/base/test/dummy/fileset.py
+5
-10
5 additions, 10 deletions
bob/bio/base/test/dummy/fileset.py
with
14 additions
and
15 deletions
bob/bio/base/test/dummy/database.py
+
9
−
5
View file @
4373e7e0
from
bob.bio.db
import
ZTBioDatabase
,
AtntBioDatabas
e
from
bob.bio.db
import
ZTBioDatabase
,
BioFil
e
from
bob.bio.base.test.utils
import
atnt_database_directory
...
...
@@ -14,13 +14,17 @@ class DummyDatabase(ZTBioDatabase):
training_depends_on_protocol
=
False
,
models_depend_on_protocol
=
False
)
self
.
__db
=
AtntBioDatabase
()
import
bob.db.atnt
self
.
__db
=
bob
.
db
.
atnt
.
Database
()
def
_make_bio
(
self
,
files
):
return
[
BioFile
(
client_id
=
f
.
client_id
,
path
=
f
.
path
,
file_id
=
f
.
id
)
for
f
in
files
]
def
model_ids_with_protocol
(
self
,
groups
=
None
,
protocol
=
None
,
**
kwargs
):
return
self
.
__db
.
model_ids
_with_protocol
(
groups
,
protocol
)
return
self
.
__db
.
model_ids
(
groups
,
protocol
)
def
objects
(
self
,
groups
=
None
,
protocol
=
None
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
return
self
.
__db
.
objects
(
group
s
,
p
ro
tocol
,
purposes
,
model_ids
,
**
kwargs
)
return
self
.
_make_bio
(
self
.
__db
.
objects
(
model_id
s
,
g
ro
ups
,
purposes
,
protocol
,
**
kwargs
)
)
def
tobjects
(
self
,
groups
=
None
,
protocol
=
None
,
model_ids
=
None
,
**
kwargs
):
return
[]
...
...
@@ -29,7 +33,7 @@ class DummyDatabase(ZTBioDatabase):
return
[]
def
tmodel_ids_with_protocol
(
self
,
protocol
=
None
,
groups
=
None
,
**
kwargs
):
return
self
.
__db
.
model_ids
_with_protocol
(
groups
,
protocol
)
return
self
.
__db
.
model_ids
(
groups
)
def
t_enroll_files
(
self
,
t_model_id
,
group
=
'
dev
'
):
return
self
.
enroll_files
(
t_model_id
,
group
)
...
...
This diff is collapsed.
Click to expand it.
bob/bio/base/test/dummy/fileset.py
+
5
−
10
View file @
4373e7e0
from
bob.bio.db
import
ZTBioDatabase
,
BioFileSet
,
BioFile
from
bob.bio.base.test.utils
import
atnt_database_directory
class
DummyDatabase
(
ZTBioDatabase
):
def
__init__
(
self
):
...
...
@@ -20,25 +19,21 @@ class DummyDatabase(ZTBioDatabase):
def
uses_probe_file_sets
(
self
):
return
True
def
_make_bio
(
self
,
files
):
return
[
BioFile
(
client_id
=
f
.
client_id
,
path
=
f
.
path
,
file_id
=
f
.
id
)
for
f
in
files
]
def
probe_file_sets
(
self
,
model_id
=
None
,
group
=
'
dev
'
):
"""
Returns the list of probe File objects (for the given model id, if given).
"""
# import ipdb; ipdb.set_trace()
files
=
self
.
arrange_by_client
(
self
.
sort
(
self
.
objects
(
protocol
=
None
,
groups
=
group
,
purposes
=
'
probe
'
)))
# arrange files by clients
file_sets
=
[]
for
client_files
in
files
:
# convert into our File objects (so that they are tested as well)
our_files
=
[
BioFile
(
f
.
client_id
,
f
.
path
,
f
.
id
)
for
f
in
client_files
]
# generate file set for each client
file_set
=
BioFileSet
(
our_files
[
0
].
client_id
,
our_files
)
file_sets
.
append
(
file_set
)
file_sets
=
[
BioFileSet
(
client_files
[
0
].
client_id
,
client_files
)
for
client_files
in
files
]
return
file_sets
def
model_ids_with_protocol
(
self
,
groups
=
None
,
protocol
=
None
,
**
kwargs
):
return
self
.
__db
.
model_ids
(
groups
,
protocol
)
def
objects
(
self
,
groups
=
None
,
protocol
=
None
,
purposes
=
None
,
model_ids
=
None
,
**
kwargs
):
return
self
.
__db
.
objects
(
model_ids
,
groups
,
purposes
,
protocol
,
**
kwargs
)
return
self
.
_make_bio
(
self
.
__db
.
objects
(
model_ids
,
groups
,
purposes
,
protocol
,
**
kwargs
)
)
def
tobjects
(
self
,
groups
=
None
,
protocol
=
None
,
model_ids
=
None
,
**
kwargs
):
return
[]
...
...
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