Skip to content

Commit

Permalink
Add the "warning" in the function description as well
Browse files Browse the repository at this point in the history
  • Loading branch information
BioinfoTongLI committed Nov 14, 2024
1 parent 9493855 commit e649ca1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/spatialdata/_core/query/spatial_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ def bounding_box_query(
) -> SpatialElement | SpatialData | None:
"""
Query a SpatialData object or SpatialElement within a bounding box.
If the object has `points` element, depending on the number of points, it MAY suffer from performance issues.
Parameters
----------
Expand Down Expand Up @@ -514,11 +515,8 @@ def _(
min_coordinate = _parse_list_into_array(min_coordinate)
max_coordinate = _parse_list_into_array(max_coordinate)
new_elements = {}
if len(sdata.points) > 0:
warnings.warn(
"Your SpatialData object has points element. Thus maybe suffer from performance issues when querying.",
UserWarning,
)
if sdata.points:
warnings.warn(f"Your SpatialData object has points element. Thus maybe suffer from performance issues when querying.", UserWarning)
for element_type in ["points", "images", "labels", "shapes"]:
elements = getattr(sdata, element_type)
queried_elements = _dict_query_dispatcher(
Expand Down

0 comments on commit e649ca1

Please sign in to comment.