Skip to content

Commit 37a44b3

Browse files
committed
lint changes & update to do
1 parent 1acb42f commit 37a44b3

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

orthority/camera.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
# If not, see <https://www.gnu.org/licenses/>.
1515

1616
"""Camera models for projecting between 3D world and 2D pixel coordinates."""
17+
1718
from __future__ import annotations
1819

1920
import logging
2021
import warnings
2122
from abc import ABC, abstractmethod
23+
from collections.abc import Sequence
2224
from os import PathLike
23-
from typing import Sequence
2425

2526
import cv2
2627
import numpy as np
@@ -33,7 +34,7 @@
3334

3435
from orthority import common
3536
from orthority.enums import CameraType, Interp
36-
from orthority.errors import CameraInitError, OrthorityWarning, OrthorityError
37+
from orthority.errors import CameraInitError, OrthorityError, OrthorityWarning
3738
from orthority.param_io import _opk_to_rotation
3839

3940
logger = logging.getLogger(__name__)
@@ -63,15 +64,15 @@ def im_size(self) -> tuple[int, int]:
6364
def _validate_world_coords(xyz: np.ndarray) -> None:
6465
"""Utility function to validate world coordinate dimensions."""
6566
if not (xyz.ndim == 2 and xyz.shape[0] == 3):
66-
raise ValueError(f"'xyz' should be a 3xN 2D array.")
67+
raise ValueError("'xyz' should be a 3xN 2D array.")
6768
if xyz.dtype != np.float64:
68-
raise ValueError(f"'xyz' should have 'float64' data type.")
69+
raise ValueError("'xyz' should have 'float64' data type.")
6970

7071
@staticmethod
7172
def _validate_pixel_coords(ji: np.ndarray) -> None:
7273
"""Utility function to validate pixel coordinate dimensions."""
7374
if not (ji.ndim == 2 and ji.shape[0] == 2):
74-
raise ValueError(f"'ji' should be a 2xN 2D array.")
75+
raise ValueError("'ji' should be a 2xN 2D array.")
7576

7677
@staticmethod
7778
def _validate_z(z: np.ndarray, ji: np.ndarray) -> None:
@@ -80,7 +81,7 @@ def _validate_z(z: np.ndarray, ji: np.ndarray) -> None:
8081
z.ndim != 1 or (z.shape[0] != 1 and ji.shape[1] != 1 and z.shape[0] != ji.shape[1])
8182
):
8283
raise ValueError(
83-
f"'z' should be a single value or 1-by-N array where 'ji' is 2-by-N or 2-by-1."
84+
"'z' should be a single value or 1-by-N array where 'ji' is 2-by-N or 2-by-1."
8485
)
8586

8687
def _validate_image(self, im_array: np.ndarray) -> None:
@@ -715,7 +716,7 @@ def _get_extrinsic(
715716
def _test_init(self) -> None:
716717
"""Utility function to test if exterior parameters are initialised."""
717718
if self._R is None or self._T is None:
718-
raise CameraInitError(f'Exterior parameters not initialised.')
719+
raise CameraInitError('Exterior parameters not initialised.')
719720

720721
def _horizon_fov(self) -> bool:
721722
"""Whether this camera's field of view includes, or is above, the horizon."""
@@ -747,7 +748,7 @@ def _get_undistort_intrinsic(self, alpha: float) -> tuple[np.ndarray, np.ndarray
747748
# Note that cv2.fisheye.estimateNewCameraMatrixForUndistortRectify() does not include all
748749
# source pixels for balance=1. This method works for all subclasses including fisheye.
749750
def _get_rectangles(
750-
im_size: tuple[int, int]
751+
im_size: tuple[int, int],
751752
) -> tuple[tuple[np.ndarray, np.ndarray], tuple[np.ndarray, np.ndarray]]:
752753
"""Return inner and outer rectangles for distorted image grid points."""
753754
w, h = np.array(im_size) - 1

orthority/ortho.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ def process(
552552
be set to a dictionary of arguments for a custom `tqdm
553553
<https://tqdm.github.io/docs/tqdm/>`_ bar.
554554
"""
555-
# TODO: clarify creation_options docstring - see issue #23
555+
# TODO: clarify creation_options docstring - see issue #23. it should say driver
556+
# specific. and perhaps we can allow other drivers, but then there are no defaults and
557+
# its up to the user to supply creation_options
556558
exit_stack = ExitStack()
557559
with exit_stack:
558560
# create the progress bar

0 commit comments

Comments
 (0)