Skip to content

Commit 45d8630

Browse files
Update type annotation style (OpenwaterHealth#106)
1 parent 287ba20 commit 45d8630

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/openlifu/vf/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from .virtual_fit import VirtualFit
24

35
__all__ = [

src/openlifu/vf/virtual_fit.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
from __future__ import annotations
2+
13
import logging
24
from dataclasses import dataclass, field
3-
from typing import Optional, Tuple
5+
from typing import Tuple
46

57
import numpy as np
68
import scipy.interpolate
@@ -68,8 +70,8 @@ def extract_skin_surface(
6870
self,
6971
volume: xa.Dataset,
7072
quantile: float = 0.05,
71-
scene_origin: Optional[Tuple[float, float, float]] = None,
72-
scene_matrix: Optional[np.ndarray] = None):
73+
scene_origin: Tuple[float, float, float] | None = None,
74+
scene_matrix: np.ndarray | None = None):
7375
"""
7476
Extract skin surface from MRI volume in LPS coordinates
7577
@@ -131,8 +133,8 @@ def lps2pyr(self, l: float, p:float, s:float, origin: Tuple[float, float, float]
131133
def get_transducer_pose(
132134
self,
133135
sph_coords: Tuple[float, float],
134-
skin_origin: Optional[Tuple[float, float, float]] = None,
135-
skin_interpolator: Optional[scipy.interpolate.LinearNDInterpolator] = None,
136+
skin_origin: Tuple[float, float, float] | None = None,
137+
skin_interpolator: scipy.interpolate.LinearNDInterpolator | None = None,
136138
z_offset: float = 13.55,
137139
dzdy: float = 0.15,
138140
search_x: float = 20,
@@ -249,8 +251,8 @@ def analyse_target_position(
249251
self,
250252
target: Point,
251253
transducer_pose: np.ndarray,
252-
radius_in_mm: Optional[float] = None,
253-
steering_limits: Optional[Tuple[TargetConstraints, TargetConstraints, TargetConstraints]] = None):
254+
radius_in_mm: float | None = None,
255+
steering_limits: Tuple[TargetConstraints, TargetConstraints, TargetConstraints] | None = None):
254256
"""
255257
Analyzes the pose of a transducer relative to a specific target point.
256258
Determines whether or not the target is within the transducer's steering limits and
@@ -298,13 +300,13 @@ def analyse_target_position(
298300
def run(
299301
self,
300302
target: Point,
301-
pitch_range: Optional[Tuple[int, int]] = None,
302-
pitch_step: Optional[int] = None,
303-
yaw_range: Optional[Tuple[int, int]] = None,
304-
yaw_step: Optional[int] = None,
305-
radius_in_mm: Optional[float] = None,
306-
steering_limits: Optional[Tuple[TargetConstraints]] = None,
307-
blocked_elems_threshold: Optional[float] = None
303+
pitch_range: Tuple[int, int] | None = None,
304+
pitch_step: int | None = None,
305+
yaw_range: Tuple[int, int] | None = None,
306+
yaw_step: int | None = None,
307+
radius_in_mm: float | None = None,
308+
steering_limits: Tuple[TargetConstraints] | None = None,
309+
blocked_elems_threshold: float | None = None
308310
) -> ArrayTransform:
309311
"""
310312
VirtualFit main process.

0 commit comments

Comments
 (0)