diff --git a/src/stcal/jump/circle.py b/src/stcal/jump/circle.py index 09d46cb8..89a40a23 100644 --- a/src/stcal/jump/circle.py +++ b/src/stcal/jump/circle.py @@ -1,5 +1,5 @@ import random -from typing import Union, Optional +from typing import Optional, Union import numpy @@ -87,7 +87,7 @@ def __repr__(self) -> str: def _expand_circle_from_one_point( known_boundary_point: tuple[float, float], points: list[tuple[float, float]], -) -> Circle | None: +) -> Circle: """ iteratively expand a circle from one known boundary point to enclose the given set of points from https://www.nayuki.io/page/smallest-enclosing-circle @@ -107,7 +107,7 @@ def _expand_circle_from_two_points( known_boundary_point_a: tuple[float, float], known_boundary_point_b: tuple[float, float], points: list[tuple[float, float]], -) -> Circle | None: +) -> Circle: """ iteratively expand a circle from two known boundary points to enclose the given set of points from https://www.nayuki.io/page/smallest-enclosing-circle @@ -150,7 +150,7 @@ def _expand_circle_from_two_points( if left is None and right is None: return circle elif left is None: - return right + return right if right is not None else Circle(center=(0.0, 0.0), radius=0.0) elif right is None: return left else: diff --git a/src/stcal/jump/jump.py b/src/stcal/jump/jump.py index d87121ef..bfbc3abb 100644 --- a/src/stcal/jump/jump.py +++ b/src/stcal/jump/jump.py @@ -851,9 +851,9 @@ def area_of_polygon(xy: np.ndarray) -> float: apply shoelace algorithm on collection of xy vertex pairs https://stackoverflow.com/questions/24467972/calculate-area-of-polygon-given-x-y-coordinates """ - return 0.5 * np.abs( + return float(0.5 * np.abs( np.dot(xy[:, 0], np.roll(xy[:, 1], 1)) - np.dot(xy[:, 1], np.roll(xy[:, 0], 1)) - ) + )) def find_circles(dqplane: np.ndarray, bitmask: np.ndarray, min_area: float) -> list[Circle]: