Skip to content

Commit d6b2ace

Browse files
authored
Merge pull request #50 from mapmanager/jtle00-j-dev
Merging in numba changes
2 parents 4dc5149 + 6544174 commit d6b2ace

20 files changed

Lines changed: 1123 additions & 363 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish brightest to test PyPi (johnson)
2+
3+
on:
4+
release:
5+
types: [published] # Runs when a new GitHub release is published
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout source (johnson)
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0 # needed so setuptools_scm can get tags
15+
16+
- name: Set up Python (johnson)
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Install dependencies (johnson)
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -U setuptools wheel twine build
25+
pip install -U .
26+
27+
- name: Build and publish (johnson)
28+
env:
29+
TWINE_USERNAME: __token__
30+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
31+
run: |
32+
git tag
33+
python -m build .
34+
twine upload --repository testpypi dist/*
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
from .astar import AStarSearch
2-
from .nbastar import NBAStarSearch
2+
3+
# Try to import the numba-optimized version first, fall back to non-numba version
4+
try:
5+
import numba
6+
from .numba_nbastar import NBAStarSearch as NBAStarSearch
7+
except (ModuleNotFoundError, ImportError):
8+
# numba not available, use the non-numba version
9+
from .nbastar import NBAStarSearch as NBAStarSearch

brightest_path_lib/algorithm/astar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import numpy as np
3232
from queue import PriorityQueue, Queue
3333
from typing import List, Tuple
34-
from brightest_path_lib.cost import ReciprocalTransonic
35-
from brightest_path_lib.heuristic import EuclideanTransonic
34+
from brightest_path_lib.cost import Reciprocal
35+
from brightest_path_lib.heuristic import Euclidean
3636
from brightest_path_lib.image import ImageStats
3737
from brightest_path_lib.input import CostFunction, HeuristicFunction
3838
from brightest_path_lib.node import Node
@@ -124,12 +124,12 @@ def __init__(
124124
self.open_nodes = open_nodes
125125

126126
if cost_function == CostFunction.RECIPROCAL:
127-
self.cost_function = ReciprocalTransonic(
127+
self.cost_function = Reciprocal(
128128
min_intensity=self.image_stats.min_intensity,
129129
max_intensity=self.image_stats.max_intensity)
130130

131131
if heuristic_function == HeuristicFunction.EUCLIDEAN:
132-
self.heuristic_function = EuclideanTransonic(scale=self.scale)
132+
self.heuristic_function = Euclidean(scale=self.scale)
133133

134134
self.is_canceled = False
135135
self.found_path = False

brightest_path_lib/algorithm/nbastar.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# algorithm/nbastar.py
22

3-
"""The New Bidirectional A* Search Algorithm is an improvement over the
3+
"""
4+
5+
The New Bidirectional A* Search Algorithm is an improvement over the
46
original Bidirectional A* Search algorithm, which is a variation of the
57
A* Search algorithm that searches from both the start and goal nodes
68
simultaneously in order to find the shortest path more efficiently.
@@ -49,7 +51,6 @@
4951
from brightest_path_lib.input import CostFunction, HeuristicFunction
5052
from brightest_path_lib.node import Node, BidirectionalNode
5153

52-
5354
class NBAStarSearch:
5455
"""NBA* Implementation
5556

0 commit comments

Comments
 (0)