Skip to content

Commit a4ec588

Browse files
build: adapting to numpy 2.x (#1265)
Co-authored-by: pyansys-ci-bot <pyansys.github.bot@ansys.com>
1 parent 42d28ed commit a4ec588

File tree

13 files changed

+21
-16
lines changed

13 files changed

+21
-16
lines changed

doc/changelog.d/1265.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build: adapting to numpy 2.x

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies = [
3030
"beartype>=0.11.0,<0.19",
3131
"grpcio>=1.35.0,<2",
3232
"grpcio-health-checking>=1.45.0,<2",
33-
"numpy>=1.20.3,<2",
33+
"numpy>=1.20.3,<3",
3434
"Pint>=0.18,<1",
3535
"protobuf>=3.20.2,<6",
3636
"pyvista>=0.37.0,<1",

src/ansys/geometry/core/shapes/curves/line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def parameterization(self) -> Parameterization:
192192
Parameterization
193193
Information about how the line is parameterized.
194194
"""
195-
return Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(np.NINF, np.inf))
195+
return Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(-np.inf, np.inf))
196196

197197
def contains_param(self, param: Real) -> bool: # noqa: D102
198198
raise NotImplementedError("contains_param() is not implemented.")

src/ansys/geometry/core/shapes/parameterization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def is_closed(self) -> bool:
204204
bool
205205
True if neither bound of the interval is infinite.
206206
"""
207-
return self.start > np.NINF and self.end < np.inf
207+
return self.start > -np.inf and self.end < np.inf
208208

209209
def is_empty(self) -> bool:
210210
"""

src/ansys/geometry/core/shapes/surfaces/cone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def parameterization(self) -> Tuple[Parameterization, Parameterization]:
254254
u = Parameterization(ParamForm.PERIODIC, ParamType.CIRCULAR, Interval(0, 2 * np.pi))
255255

256256
start, end = (
257-
(self.apex_param, np.inf) if self.apex_param < 0 else (np.NINF, self.apex_param)
257+
(self.apex_param, np.inf) if self.apex_param < 0 else (-np.inf, self.apex_param)
258258
)
259259
v = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(start, end))
260260

src/ansys/geometry/core/shapes/surfaces/cylinder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def parameterization(self) -> Tuple[Parameterization, Parameterization]:
263263
Information about how a cylinder's u and v parameters are parameterized, respectively.
264264
"""
265265
u = Parameterization(ParamForm.PERIODIC, ParamType.CIRCULAR, Interval(0, 2 * np.pi))
266-
v = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(np.NINF, np.inf))
266+
v = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(-np.inf, np.inf))
267267

268268
return (u, v)
269269

src/ansys/geometry/core/shapes/surfaces/plane.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def contains_point(self, point: Point3D) -> bool:
111111

112112
def parameterization(self) -> Tuple[Parameterization, Parameterization]:
113113
"""Parametrize the plane."""
114-
u = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(np.NINF, np.inf))
115-
v = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(np.NINF, np.inf))
114+
u = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(-np.inf, np.inf))
115+
v = Parameterization(ParamForm.OPEN, ParamType.LINEAR, Interval(-np.inf, np.inf))
116116

117117
return (u, v)
118118

src/ansys/geometry/core/shapes/surfaces/sphere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def project_point(self, point: Point3D) -> "SphereEvaluation":
197197
x = origin_to_point.dot(self.dir_x)
198198
y = origin_to_point.dot(self.dir_y)
199199
z = origin_to_point.dot(self.dir_z)
200-
if np.allclose((x * x + y * y + z * z), Point3D([0, 0, 0])):
200+
if np.allclose(x * x + y * y + z * z, 0):
201201
return SphereEvaluation(self, ParamUV(0, np.pi / 2))
202202

203203
u = np.arctan2(y, x)

src/ansys/geometry/core/sketch/box.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ def visualization_polydata(self) -> pv.PolyData:
171171
0,
172172
],
173173
],
174-
dtype=np.float_,
174+
dtype=np.float64,
175175
)
176176
)

src/ansys/geometry/core/sketch/segment.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,15 @@ def visualization_polydata(self) -> pv.PolyData:
145145
self.start.y.m_as(DEFAULT_UNITS.LENGTH),
146146
0,
147147
],
148-
dtype=np.float_,
148+
dtype=np.float64,
149149
),
150150
np.array(
151-
[self.end.x.m_as(DEFAULT_UNITS.LENGTH), self.end.y.m_as(DEFAULT_UNITS.LENGTH), 0],
152-
dtype=np.float_,
151+
[
152+
self.end.x.m_as(DEFAULT_UNITS.LENGTH),
153+
self.end.y.m_as(DEFAULT_UNITS.LENGTH),
154+
0,
155+
],
156+
dtype=np.float64,
153157
),
154158
)
155159

0 commit comments

Comments
 (0)