Skip to content

Commit

Permalink
type cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Aug 30, 2024
1 parent 5ce54cf commit 72c6fe0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/stcal/jump/circle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import random
from typing import Union, Optional
from typing import Optional, Union

import numpy

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/stcal/jump/jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 72c6fe0

Please sign in to comment.