From 3974894d60cd1d461384355005b1be4b4df8f47d Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 12 May 2024 19:50:46 +0100 Subject: [PATCH] minor improvements --- src/config.py | 2 +- src/editor/models/__init__.py | 1 + src/editor/utils/__init__.py | 1 + src/editor/utils/get_next_run_name.py | 7 +++++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/editor/models/__init__.py create mode 100644 src/editor/utils/get_next_run_name.py diff --git a/src/config.py b/src/config.py index 2cb16fb..a844c3c 100644 --- a/src/config.py +++ b/src/config.py @@ -5,5 +5,5 @@ DATA = sorted(Path("/mnt/wsl/PHYSICALDRIVE1/data/unsplash").glob("*.jpg")) CACHE_PATH = Path("/mnt/wsl/PHYSICALDRIVE1/data/cache2") CACHE_PATH.mkdir(exist_ok=True, parents=True) -MODELS_PATH = Path("models") +MODELS_PATH = Path("/home/andras/projects/bipolaroid/models") MODELS_PATH.mkdir(exist_ok=True, parents=True) diff --git a/src/editor/models/__init__.py b/src/editor/models/__init__.py new file mode 100644 index 0000000..42279df --- /dev/null +++ b/src/editor/models/__init__.py @@ -0,0 +1 @@ +from .create_model import create_model diff --git a/src/editor/utils/__init__.py b/src/editor/utils/__init__.py index dd196d2..845297c 100644 --- a/src/editor/utils/__init__.py +++ b/src/editor/utils/__init__.py @@ -5,3 +5,4 @@ from .get_colour_lut import get_colour_lut from .compute_histogram import compute_histogram from .kldiv import kldiv from .generate_rotation_matrices import generate_rotation_matrices +from .get_next_run_name import get_next_run_name diff --git a/src/editor/utils/get_next_run_name.py b/src/editor/utils/get_next_run_name.py new file mode 100644 index 0000000..02cadd4 --- /dev/null +++ b/src/editor/utils/get_next_run_name.py @@ -0,0 +1,7 @@ +from pathlib import Path + + +def get_next_run_name(path: Path, prefix: str = "run") -> str: + run_ids = [int(run.stem.split("_")[1]) for run in path.glob(f"{prefix}_*")] + next_run_id = max(run_ids, default=-1) + 1 + return f"{prefix}_{next_run_id}"