Skip to content

Commit 3ae5858

Browse files
committed
verified typing changes
1 parent 687e2e2 commit 3ae5858

22 files changed

Lines changed: 264 additions & 157 deletions

File tree

‎aerosandbox/aerodynamics/aero_2D/mses.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from aerosandbox.common import ExplicitAnalysis
22
import aerosandbox.numpy as np
3+
from aerosandbox.numpy.typing import ConcreteVectorizable
34
import subprocess
45
from pathlib import Path
56
from aerosandbox.geometry import Airfoil
@@ -184,9 +185,9 @@ def __init__(
184185

185186
def run(
186187
self,
187-
alpha: float | np.ndarray | list = 0.0,
188-
Re: float | np.ndarray | list = 0.0,
189-
mach: float | np.ndarray | list = 0.01,
188+
alpha: ConcreteVectorizable = 0.0,
189+
Re: ConcreteVectorizable = 0.0,
190+
mach: ConcreteVectorizable = 0.01,
190191
):
191192
### Make all inputs iterables:
192193
alphas, Res, machs = np.broadcast_arrays(

‎aerosandbox/aerodynamics/aero_2D/xfoil.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from aerosandbox.common import ExplicitAnalysis
22
import aerosandbox.numpy as np
3+
from aerosandbox.numpy.typing import ConcreteVectorizable, ConcreteArray
34
import subprocess
45
from pathlib import Path
56
from aerosandbox.geometry import Airfoil
@@ -265,7 +266,7 @@ def _run_xfoil(
265266
self,
266267
run_command: str,
267268
read_bl_data_from: str | None = None,
268-
) -> dict[str, np.ndarray]:
269+
) -> dict[str, ConcreteArray]:
269270
"""
270271
Private function to run XFoil.
271272
@@ -597,9 +598,9 @@ def open_interactive(self) -> None:
597598

598599
def alpha(
599600
self,
600-
alpha: float | np.ndarray,
601+
alpha: ConcreteVectorizable,
601602
start_at: float | None = 0,
602-
) -> dict[str, np.ndarray]:
603+
) -> dict[str, ConcreteArray]:
603604
"""
604605
Execute XFoil at a given angle of attack, or at a sequence of angles of attack.
605606
@@ -675,9 +676,9 @@ def schedule_run(alpha: float):
675676

676677
def cl(
677678
self,
678-
cl: float | np.ndarray,
679+
cl: ConcreteVectorizable,
679680
start_at: float | None = 0,
680-
) -> dict[str, np.ndarray]:
681+
) -> dict[str, ConcreteArray]:
681682
"""
682683
Execute XFoil at a given lift coefficient, or at a sequence of lift coefficients.
683684

‎aerosandbox/aerodynamics/aero_3D/singularities/point_source.py‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import aerosandbox.numpy as np
2+
from aerosandbox.numpy.typing import Vectorizable
23

34

45
def calculate_induced_velocity_point_source(
5-
x_field: float | np.ndarray,
6-
y_field: float | np.ndarray,
7-
z_field: float | np.ndarray,
8-
x_source: float | np.ndarray,
9-
y_source: float | np.ndarray,
10-
z_source: float | np.ndarray,
11-
sigma: float | np.ndarray = 1,
6+
x_field: Vectorizable,
7+
y_field: Vectorizable,
8+
z_field: Vectorizable,
9+
x_source: Vectorizable,
10+
y_source: Vectorizable,
11+
z_source: Vectorizable,
12+
sigma: Vectorizable = 1,
1213
viscous_radius=0,
13-
) -> tuple[float | np.ndarray, float | np.ndarray, float | np.ndarray]:
14+
) -> tuple[Vectorizable, Vectorizable, Vectorizable]:
1415
"""
1516
Calculates the induced velocity at a point:
1617
[x_field, y_field, z_field]

‎aerosandbox/aerodynamics/aero_3D/singularities/uniform_strength_horseshoe_singularities.py‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import aerosandbox.numpy as np
2+
from aerosandbox.numpy.typing import Vectorizable
23

34

45
def calculate_induced_velocity_horseshoe(
5-
x_field: float | np.ndarray,
6-
y_field: float | np.ndarray,
7-
z_field: float | np.ndarray,
8-
x_left: float | np.ndarray,
9-
y_left: float | np.ndarray,
10-
z_left: float | np.ndarray,
11-
x_right: float | np.ndarray,
12-
y_right: float | np.ndarray,
13-
z_right: float | np.ndarray,
14-
gamma: float | np.ndarray = 1,
6+
x_field: Vectorizable,
7+
y_field: Vectorizable,
8+
z_field: Vectorizable,
9+
x_left: Vectorizable,
10+
y_left: Vectorizable,
11+
z_left: Vectorizable,
12+
x_right: Vectorizable,
13+
y_right: Vectorizable,
14+
z_right: Vectorizable,
15+
gamma: Vectorizable = 1,
1516
trailing_vortex_direction: np.ndarray | None = None,
1617
vortex_core_radius: float = 0,
17-
) -> tuple[float | np.ndarray, float | np.ndarray, float | np.ndarray]:
18+
) -> tuple[Vectorizable, Vectorizable, Vectorizable]:
1819
"""
1920
Calculates the induced velocity at a point:
2021
[x_field, y_field, z_field]

‎aerosandbox/atmosphere/thermodynamics/gas.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import aerosandbox.numpy as np
2+
from aerosandbox.numpy.typing import Vectorizable
23
from aerosandbox.tools.string_formatting import eng_string
34
from typing import Literal
45

@@ -19,8 +20,8 @@ class PerfectGas:
1920

2021
def __init__(
2122
self,
22-
pressure: float | np.ndarray = 101325,
23-
temperature: float | np.ndarray = 273.15 + 15,
23+
pressure: Vectorizable = 101325,
24+
temperature: Vectorizable = 273.15 + 15,
2425
specific_heat_constant_pressure: float = 1006,
2526
specific_heat_constant_volume: float = 717,
2627
molecular_mass: float = 28.9644e-3,

‎aerosandbox/dynamics/point_mass/common_point_mass.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ def convert_axes(
362362
@abstractmethod
363363
def add_force(
364364
self,
365-
Fx: float | np.ndarray = 0,
366-
Fy: float | np.ndarray = 0,
367-
Fz: float | np.ndarray = 0,
365+
Fx: Vectorizable = 0,
366+
Fy: Vectorizable = 0,
367+
Fz: Vectorizable = 0,
368368
axes: Literal["geometry", "body", "wind", "stability", "earth"] = "wind",
369369
) -> None:
370370
"""

‎aerosandbox/geometry/airfoil/airfoil.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import plotly.graph_objects
22
import matplotlib.figure
33
import aerosandbox.numpy as np
4+
from aerosandbox.numpy.typing import Vectorizable
45
from aerosandbox.geometry.polygon import Polygon
56
from aerosandbox.geometry.airfoil.airfoil_families import (
67
get_NACA_coordinates,
@@ -779,8 +780,8 @@ def plot_polars(
779780
)
780781

781782
def local_camber(
782-
self, x_over_c: float | np.ndarray = np.linspace(0, 1, 101)
783-
) -> float | np.ndarray:
783+
self, x_over_c: Vectorizable = np.linspace(0, 1, 101)
784+
) -> Vectorizable:
784785
"""
785786
Returns the local camber of the airfoil at a given point or points.
786787
@@ -807,8 +808,8 @@ def local_camber(
807808
return (upper_interpolated + lower_interpolated) / 2
808809

809810
def local_thickness(
810-
self, x_over_c: float | np.ndarray = np.linspace(0, 1, 101)
811-
) -> float | np.ndarray:
811+
self, x_over_c: Vectorizable = np.linspace(0, 1, 101)
812+
) -> Vectorizable:
812813
"""
813814
Returns the local thickness of the airfoil at a given point or points.
814815

‎aerosandbox/geometry/airfoil/kulfan_airfoil.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def get_aero_from_neuralfoil(
472472

473473
def upper_coordinates(
474474
self,
475-
x_over_c: float | np.ndarray = np.linspace(1, 0, 101),
475+
x_over_c: Vectorizable = np.linspace(1, 0, 101),
476476
) -> np.ndarray:
477477
x_over_c = np.array(x_over_c)
478478

@@ -528,7 +528,7 @@ def tall(vector):
528528

529529
def lower_coordinates(
530530
self,
531-
x_over_c: float | np.ndarray = np.linspace(0, 1, 101),
531+
x_over_c: Vectorizable = np.linspace(0, 1, 101),
532532
) -> np.ndarray:
533533
x_over_c = np.array(x_over_c)
534534

@@ -578,8 +578,8 @@ def tall(vector):
578578

579579
def local_camber(
580580
self,
581-
x_over_c: float | np.ndarray = np.linspace(0, 1, 101),
582-
) -> float | np.ndarray:
581+
x_over_c: Vectorizable = np.linspace(0, 1, 101),
582+
) -> Vectorizable:
583583
upper = self.upper_coordinates(x_over_c=x_over_c)
584584
lower = self.lower_coordinates(x_over_c=x_over_c)
585585

@@ -590,8 +590,8 @@ def local_camber(
590590

591591
def local_thickness(
592592
self,
593-
x_over_c: float | np.ndarray = np.linspace(0, 1, 101),
594-
) -> float | np.ndarray:
593+
x_over_c: Vectorizable = np.linspace(0, 1, 101),
594+
) -> Vectorizable:
595595
upper = self.upper_coordinates(x_over_c=x_over_c)
596596
lower = self.lower_coordinates(x_over_c=x_over_c)
597597

‎aerosandbox/geometry/fuselage.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from typing import Any, Callable, Literal, Sequence
33
import aerosandbox.numpy as np
44
import copy
5-
from aerosandbox.numpy.typing import Scalar # Type alias including CasADi types
5+
from aerosandbox.numpy.typing import Scalar, Vectorizable
66

77

88
class Fuselage(AeroSandboxObject):
@@ -858,8 +858,8 @@ def compute_frame(self) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
858858
return xg_local, yg_local, zg_local
859859

860860
def get_3D_coordinates(
861-
self, theta: float | np.ndarray | None = None
862-
) -> tuple[float | np.ndarray, float | np.ndarray, float | np.ndarray]:
861+
self, theta: Vectorizable | None = None
862+
) -> tuple[Vectorizable, Vectorizable, Vectorizable]:
863863
"""
864864
Samples points from the perimeter of this FuselageXSec.
865865

‎aerosandbox/geometry/polygon.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import aerosandbox.numpy as np
2+
from aerosandbox.numpy.typing import ConcreteVectorizable
23
from matplotlib import path
34
from aerosandbox.common import AeroSandboxObject
45
from pathlib import Path
@@ -286,9 +287,9 @@ def write_sldcrv(self, filepath: Path | str | None = None):
286287

287288
def contains_points(
288289
self,
289-
x: float | np.ndarray,
290-
y: float | np.ndarray,
291-
) -> float | np.ndarray:
290+
x: ConcreteVectorizable,
291+
y: ConcreteVectorizable,
292+
) -> ConcreteVectorizable:
292293
"""
293294
Returns a boolean array of whether some (x, y) point(s) are contained within the Polygon.
294295

0 commit comments

Comments
 (0)