From aadb39c5e1b99329744b2ed52216f93ea62cc6ee Mon Sep 17 00:00:00 2001 From: Kotaro Uetake <60615504+ktro2828@users.noreply.github.com> Date: Wed, 25 Dec 2024 14:30:27 +0900 Subject: [PATCH] refactor: rename FilterByAre to FilterByRegion (#72) Signed-off-by: ktro2828 --- t4_devkit/filtering/compose.py | 4 ++-- t4_devkit/filtering/functional.py | 6 +++--- tests/fitering/test_filter_function.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/t4_devkit/filtering/compose.py b/t4_devkit/filtering/compose.py index b8eb87b..a5fa888 100644 --- a/t4_devkit/filtering/compose.py +++ b/t4_devkit/filtering/compose.py @@ -3,10 +3,10 @@ from typing import TYPE_CHECKING, Sequence from .functional import ( - FilterByArea, FilterByDistance, FilterByLabel, FilterByNumPoints, + FilterByRegion, FilterBySpeed, FilterByUUID, ) @@ -32,7 +32,7 @@ def __init__(self, params: FilterParams, tf_buffer: TransformBuffer) -> None: FilterByLabel.from_params(params), FilterByUUID.from_params(params), FilterByDistance.from_params(params), - FilterByArea.from_params(params), + FilterByRegion.from_params(params), FilterBySpeed.from_params(params), FilterByNumPoints.from_params(params), ] diff --git a/t4_devkit/filtering/functional.py b/t4_devkit/filtering/functional.py index e26016c..8129868 100644 --- a/t4_devkit/filtering/functional.py +++ b/t4_devkit/filtering/functional.py @@ -18,7 +18,7 @@ "FilterByLabel", "FilterByUUID", "FilterByDistance", - "FilterByArea", + "FilterByRegion", "BoxFilterFunction", ] @@ -139,8 +139,8 @@ def __call__(self, box: BoxType, tf_matrix: HomogeneousMatrix) -> bool: return self.min_distance < box_distance and box_distance < self.max_distance -class FilterByArea(BaseBoxFilter): - """Filter a box by checking if the box xy position is within the specified xy area. +class FilterByRegion(BaseBoxFilter): + """Filter a box by checking if the box xy position is within the specified xy region. Note that, the type box is `Box2D` and its `position` is None, these boxes pass through this filter. diff --git a/tests/fitering/test_filter_function.py b/tests/fitering/test_filter_function.py index 14c0b6d..d185528 100644 --- a/tests/fitering/test_filter_function.py +++ b/tests/fitering/test_filter_function.py @@ -1,8 +1,8 @@ from t4_devkit.filtering.functional import ( - FilterByArea, FilterByDistance, FilterByLabel, FilterByNumPoints, + FilterByRegion, FilterBySpeed, FilterByUUID, ) @@ -66,15 +66,15 @@ def test_filter_by_distance(dummy_box3ds, dummy_box2ds, dummy_tf_buffer) -> None assert len(answer2d) == 3 -def test_filter_by_position(dummy_box3ds, dummy_box2ds, dummy_tf_buffer) -> None: - """Test `FilterByArea`. +def test_filter_by_Region(dummy_box3ds, dummy_box2ds, dummy_tf_buffer) -> None: + """Test `FilterByRegion`. Args: dummy_box3ds (list[Box3D]): List of 3D boxes. dummy_box2ds (list[Box2D]): List of 2D boxes. dummy_tf_buffer (TransformBuffer): Transformation buffer. """ - box_filter = FilterByArea(min_xy=(0.0, 0.0), max_xy=(10.0, 10.0)) + box_filter = FilterByRegion(min_xy=(0.0, 0.0), max_xy=(10.0, 10.0)) answer3d = [ box