Skip to content
Snippets Groups Projects
Commit 1a1e95a9 authored by Daniel CARRON's avatar Daniel CARRON :b: Committed by André Anjos
Browse files

[database] Rename split to fold

parent 6dd4de74
No related branches found
No related tags found
1 merge request!46Create common library
...@@ -112,7 +112,7 @@ def list_(): ...@@ -112,7 +112,7 @@ def list_():
""", """,
) )
@click.argument( @click.argument(
"split", "fold",
nargs=1, nargs=1,
) )
@click.option( @click.option(
...@@ -125,6 +125,6 @@ def list_(): ...@@ -125,6 +125,6 @@ def list_():
default=0, default=0,
) )
@verbosity_option(logger=logger, expose_value=False) @verbosity_option(logger=logger, expose_value=False)
def check(split, limit): # numpydoc ignore=PR01 def check(fold, limit): # numpydoc ignore=PR01
"""Check file access on one or more DataModules.""" """Check file access on one or more DataModules."""
check_("mednet.libs.classification.config", split, limit) check_("mednet.libs.classification.config", fold, limit)
...@@ -35,18 +35,18 @@ def list_(config: dict[str, dict[str, str]]) -> None: ...@@ -35,18 +35,18 @@ def list_(config: dict[str, dict[str, str]]) -> None:
click.echo(f'- {k} ({v["module"]}): NOT installed') click.echo(f'- {k} ({v["module"]}): NOT installed')
def check(entry_point_group, split, limit): # numpydoc ignore=PR01 def check(entry_point_group, fold, limit): # numpydoc ignore=PR01
"""Check file access on one or more DataModules.""" """Check file access on one or more DataModules."""
import importlib.metadata import importlib.metadata
import sys import sys
click.secho(f"Checking split `{split}`...", fg="yellow") click.secho(f"Checking fold `{fold}`...", fg="yellow")
try: try:
module = importlib.metadata.entry_points(group=entry_point_group)[ module = importlib.metadata.entry_points(group=entry_point_group)[
split fold
].module ].module
except KeyError: except KeyError:
raise Exception(f"Could not find database split `{split}`") raise Exception(f"Could not find database fold `{fold}`")
datamodule = importlib.import_module(module).datamodule datamodule = importlib.import_module(module).datamodule
...@@ -60,14 +60,14 @@ def check(entry_point_group, split, limit): # numpydoc ignore=PR01 ...@@ -60,14 +60,14 @@ def check(entry_point_group, split, limit): # numpydoc ignore=PR01
for k, loader in loaders.items(): for k, loader in loaders.items():
if limit == 0: if limit == 0:
click.secho( click.secho(
f"Checking all samples of dataset `{k}` at split `{split}`...", f"Checking all samples of dataset `{k}` at fold `{fold}`...",
fg="yellow", fg="yellow",
) )
loader_limit = sys.maxsize loader_limit = sys.maxsize
else: else:
click.secho( click.secho(
f"Checking first {limit} samples of dataset " f"Checking first {limit} samples of dataset "
f"`{k}` at split `{split}`...", f"`{k}` at fold `{fold}`...",
fg="yellow", fg="yellow",
) )
loader_limit = limit loader_limit = limit
...@@ -88,11 +88,11 @@ def check(entry_point_group, split, limit): # numpydoc ignore=PR01 ...@@ -88,11 +88,11 @@ def check(entry_point_group, split, limit): # numpydoc ignore=PR01
if not errors: if not errors:
click.secho( click.secho(
f"OK! No errors were reported for database split `{split}`.", f"OK! No errors were reported for database fold `{fold}`.",
fg="green", fg="green",
) )
else: else:
click.secho( click.secho(
f"Found {errors} errors loading DataModule `{split}`.", f"Found {errors} errors loading DataModule `{fold}`.",
fg="red", fg="red",
) )
...@@ -101,7 +101,7 @@ def list_(): ...@@ -101,7 +101,7 @@ def list_():
@database.command( @database.command(
epilog="""Examples: epilog="""Examples:
1. Check if all files from the split 'montgomery-f0' of the Montgomery 1. Check if all files from the fold 'montgomery-f0' of the Montgomery
database can be loaded: database can be loaded:
.. code:: sh .. code:: sh
...@@ -111,7 +111,7 @@ def list_(): ...@@ -111,7 +111,7 @@ def list_():
""", """,
) )
@click.argument( @click.argument(
"split", "fold",
nargs=1, nargs=1,
) )
@click.option( @click.option(
...@@ -124,6 +124,6 @@ def list_(): ...@@ -124,6 +124,6 @@ def list_():
default=0, default=0,
) )
@verbosity_option(logger=logger, expose_value=False) @verbosity_option(logger=logger, expose_value=False)
def check(split, limit): # numpydoc ignore=PR01 def check(fold, limit): # numpydoc ignore=PR01
"""Check file access on one or more DataModules.""" """Check file access on one or more DataModules."""
check_("mednet.libs.segmentation.config", split, limit) check_("mednet.libs.segmentation.config", fold, limit)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment