From 1966ee34e2e6a2f1a24bacdb6bc283fb6121b701 Mon Sep 17 00:00:00 2001 From: ppizarror Date: Sun, 31 Mar 2024 21:31:07 -0300 Subject: [PATCH] Added scale limits --- MLStructFP/__init__.py | 2 +- MLStructFP/db/_db_loader.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/MLStructFP/__init__.py b/MLStructFP/__init__.py index 71a9196..1a273da 100644 --- a/MLStructFP/__init__.py +++ b/MLStructFP/__init__.py @@ -9,7 +9,7 @@ __description__ = 'Machine learning structural floor plan dataset' __keywords__ = ['ml', 'ai', 'dataset', 'calc', 'matrix analysis', 'cnn', 'structural analysis', 'structural design'] __email__ = 'pablo@ppizarror.com' -__version__ = '0.5.6' +__version__ = '0.5.7' # URL __url__ = 'https://github.com/MLSTRUCT/MLSTRUCT-FP' diff --git a/MLStructFP/db/_db_loader.py b/MLStructFP/db/_db_loader.py index 9709b5c..f1d4eb8 100644 --- a/MLStructFP/db/_db_loader.py +++ b/MLStructFP/db/_db_loader.py @@ -13,6 +13,7 @@ from MLStructFP._types import Tuple import json +import math import os import tabulate @@ -110,6 +111,15 @@ def floors(self) -> Tuple['Floor', ...]: def path(self) -> str: return self.__path + @property + def scale_limits(self) -> Tuple[float, float]: + sc_min = math.inf + sc_max = 0 + for f in self.floors: + sc_min = min(sc_min, f.image_scale) + sc_max = max(sc_max, f.image_scale) + return sc_min, sc_max + def set_filter(self, f_filter: Callable[['Floor'], bool]) -> None: """ Set floor filter.