Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code from ContainsProperlyBinpred paths. #933

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 2 additions & 38 deletions python/cuspatial/cuspatial/core/binpreds/binpreds.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,8 @@ def postprocess(self, point_indices, point_result):
return cudf.Series([False] * len(self.lhs))
result = cudf.DataFrame({"idx": point_indices, "pip": point_result})
df_result = result
# Discrete math recombination
if contains_only_linestrings(self.rhs):
df_result = (
result.groupby("idx").sum().sort_index()
== result.groupby("idx").count().sort_index()
)
elif contains_only_polygons(self.rhs) or contains_only_multipoints(
self.rhs
):
partial_result = result.groupby("idx").sum()
df_result = (partial_result > 0) & (
partial_result < len(point_result)
)
else:
df_result = result.groupby("idx").sum() > 1
partial_result = result.groupby("idx").sum()
df_result = (partial_result > 0) & (partial_result < len(point_result))
point_result = cudf.Series(
df_result["pip"], index=cudf.RangeIndex(0, len(df_result))
)
Expand All @@ -247,26 +234,3 @@ def preprocess(self, lhs, rhs):
if contains_only_polygons(rhs):
(lhs, rhs) = (rhs, lhs)
return super().preprocess(lhs, rhs)

def postprocess(self, point_indices, point_result):
"""Postprocess the output GeoSeries to ensure that they are of the
correct type for the predicate."""
result = cudf.DataFrame({"idx": point_indices, "pip": point_result})
df_result = result
# Discrete math recombination
if (
contains_only_linestrings(self.rhs)
or contains_only_polygons(self.rhs)
or contains_only_multipoints(self.rhs)
):
# process for completed linestrings, polygons, and multipoints.
# Not necessary for points.
df_result = (
result.groupby("idx").sum().sort_index()
== result.groupby("idx").count().sort_index()
)
point_result = cudf.Series(
df_result["pip"], index=cudf.RangeIndex(0, len(df_result))
)
point_result.name = None
return point_result