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

Bugfix/batch logic #188

Merged
merged 5 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Run black
run: black . --check
- name: Run ruff
run: ruff .
run: ruff check .
- name: Run mypy
run: mypy .
- name: Run Tests
Expand Down
11 changes: 7 additions & 4 deletions mappymatch/matchers/lcss/lcss.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import functools as ft
import logging
from multiprocessing import Pool

from shapely.geometry import Point

Expand Down Expand Up @@ -152,10 +151,14 @@ def match_trace_batch(
trace_batch: List[Trace],
processes: int = 1,
) -> List[MatchResult]:
if processes > 1:
if processes <= 1:
results = [self.match_trace(t) for t in trace_batch]
else:
with Pool(processes=processes) as p:
results = p.map(self.match_trace, trace_batch)
raise NotImplementedError(
"Using `processes>1` is not available due to a known issue with rtree serialization."
"See https://github.com/Toblerity/rtree/issues/87 for more information."
)
# with Pool(processes=processes) as p:
# results = p.map(self.match_trace, trace_batch)

return results
4 changes: 2 additions & 2 deletions mappymatch/matchers/match_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def matches_to_dataframe(self) -> pd.DataFrame:
A pandas dataframe
"""
df = pd.DataFrame([m.to_flat_dict() for m in self.matches])
df = df.fillna(np.NAN)
df = df.fillna(np.nan)

return df

Expand All @@ -37,6 +37,6 @@ def path_to_dataframe(self) -> pd.DataFrame:
return pd.DataFrame()

df = pd.DataFrame([r.to_flat_dict() for r in self.path])
df = df.fillna(np.NAN)
df = df.fillna(np.nan)

return df
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mappymatch"
version = "0.4.4"
version = "0.4.5"
description = "Package for mapmatching."
readme = "README.md"
authors = [{ name = "National Renewable Energy Laboratory" }]
Expand Down
Loading