Skip to content

Commit dd89f43

Browse files
CHORE: Add numpy as default requirement (#6289)
Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent 7fece27 commit dd89f43

18 files changed

Lines changed: 32 additions & 126 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add numpy as default requirement

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ dependencies = [
4545
"rpyc>=6.0.0,<6.1",
4646
"pyyaml",
4747
"defusedxml>=0.7,<8.0",
48+
"numpy>=1.20.0,<2.3",
4849
]
4950

5051
[project.optional-dependencies]
@@ -55,7 +56,6 @@ unit-tests = [
5556
]
5657
integration-tests = [
5758
"matplotlib>=3.5.0,<3.11",
58-
"numpy>=1.20.0,<2.3",
5959
"pandas>=1.1.0,<2.3",
6060
"pyaedt[unit-tests]",
6161
]
@@ -105,7 +105,6 @@ jupyter = [
105105
]
106106
all = [
107107
"matplotlib>=3.5.0,<3.11",
108-
"numpy>=1.20.0,<2.3",
109108
"openpyxl>=3.1.0,<3.3",
110109
"osmnx>=1.1.0,<2.1",
111110
"pandas>=1.1.0,<2.3",
@@ -120,7 +119,6 @@ all = [
120119
examples = [
121120
"imageio>=2.34.0,<2.38",
122121
"matplotlib>=3.5.0,<3.11",
123-
"numpy>=1.20.0,<2.3",
124122
"openpyxl>=3.1.0,<3.3",
125123
"osmnx>=1.1.0,<2.1",
126124
"pandas>=1.1.0,<2.3",

src/ansys/aedt/core/generic/file_utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -670,11 +670,7 @@ def parse_excitation_file(
670670
tuple or bool
671671
Frequency, magnitude and phase.
672672
"""
673-
try:
674-
import numpy as np
675-
except ImportError: # pragma: no cover
676-
pyaedt_logger.error("NumPy is not available. Install it.")
677-
return False
673+
import numpy as np
678674

679675
try:
680676
import pandas
@@ -880,11 +876,7 @@ def compute_fft(time_values, data_values, window=None) -> Union[tuple, bool]: #
880876
tuple or bool
881877
Frequency and values.
882878
"""
883-
try:
884-
import numpy as np
885-
except ImportError:
886-
pyaedt_logger.error("NumPy is not available. Install it.")
887-
return False
879+
import numpy as np
888880

889881
deltaT = time_values[-1] - time_values[0]
890882
num_points = len(time_values)

src/ansys/aedt/core/generic/general_methods.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,7 @@ def conversion_function(data, function=None): # pragma: no cover
794794
>>> conversion_function(values, "ang_deg")
795795
array([ 0., 0., 0., 0.])
796796
"""
797-
try:
798-
import numpy as np
799-
except ImportError:
800-
logging.error("NumPy is not available. Install it.")
801-
return False
797+
import numpy as np
802798

803799
function = function or "dB10"
804800
available_functions = {

src/ansys/aedt/core/generic/python_optimizers.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,8 @@
2424

2525
import sys
2626
import threading
27-
import warnings
28-
29-
try:
30-
import numpy as np
31-
except ImportError: # pragma: no cover
32-
warnings.warn(
33-
"The NumPy module is required to run some functionalities of PostProcess.\n"
34-
"Install with \n\npip install numpy\n\nRequires CPython."
35-
)
27+
28+
import numpy as np
3629

3730

3831
class ThreadTrace(threading.Thread):

src/ansys/aedt/core/modeler/advanced_cad/oms.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,16 @@
2626
import os
2727
import warnings
2828

29+
import numpy as np
30+
2931
from ansys.aedt.core.generic.general_methods import pyaedt_function_handler
3032
from ansys.aedt.core.generic.general_methods import settings
3133
from ansys.aedt.core.internal.checks import graphics_required
3234

3335
logger = settings.logger
3436

35-
try:
36-
import numpy as np
37-
except ImportError: # pragma: no cover
38-
warnings.warn("The NumPy module is required to use the OpenStreetMap Reader.\nInstall with \n\npip install numpy")
39-
4037
try:
4138
import osmnx as ox
42-
4339
except ImportError: # pragma: no cover
4440
warnings.warn("OpenStreetMap Reader requires osmnx extra package.\nInstall with \n\npip install osmnx")
4541

src/ansys/aedt/core/q3d.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,11 +2044,7 @@ def set_material_thresholds(
20442044

20452045
self.oboundary.SetMaterialThresholds(insulator_threshold, perfect_conductor_threshold, magnetic_threshold)
20462046
return True
2047-
except ImportError: # pragma: no cover
2048-
warnings.warn(
2049-
"The NumPy module is required to use functionalities provided by the module ansys.edt.core.q3d.\n"
2050-
"Install with \n\npip install numpy"
2051-
)
2047+
20522048
except Exception:
20532049
return False
20542050

src/ansys/aedt/core/visualization/advanced/farfield_visualization.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
import os
2828
import shutil
2929
import sys
30-
import warnings
3130

3231
import defusedxml
3332
from defusedxml.ElementTree import ParseError
33+
import numpy as np
3434

3535
from ansys.aedt.core.aedt_logger import pyaedt_logger as logger
3636
from ansys.aedt.core.generic.constants import AEDT_UNITS
@@ -47,16 +47,6 @@
4747
from ansys.aedt.core.visualization.plot.pyvista import ModelPlotter
4848
from ansys.aedt.core.visualization.plot.pyvista import get_structured_mesh
4949

50-
try:
51-
import numpy as np
52-
except ImportError: # pragma: no cover
53-
warnings.warn(
54-
"The NumPy module is required to run some functionalities of FfdSolutionData.\n"
55-
"Install with \n\npip install numpy"
56-
)
57-
np = None
58-
59-
6050
defusedxml.defuse_stdlib()
6151

6252

src/ansys/aedt/core/visualization/advanced/frtm_visualization.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import csv
2626
from pathlib import Path
2727
import sys
28-
import warnings
28+
29+
import numpy as np
2930

3031
from ansys.aedt.core.aedt_logger import pyaedt_logger as logger
3132
from ansys.aedt.core.generic.constants import SpeedOfLight
@@ -38,14 +39,6 @@
3839
if current_python_version < (3, 10): # pragma: no cover
3940
raise Exception("Python 3.10 or higher is required for Monostatic RCS post-processing.")
4041

41-
try:
42-
import numpy as np
43-
except ImportError: # pragma: no cover
44-
warnings.warn(
45-
"The NumPy module is required to use module rcs_visualization.py.\nInstall with \n\npip install numpy"
46-
)
47-
np = None
48-
4942

5043
class FRTMData(object):
5144
"""Provides FRTM data.

src/ansys/aedt/core/visualization/advanced/hdm_plot.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,14 @@
2727
import os
2828
import warnings
2929

30+
import numpy as np
31+
3032
from ansys.aedt.core.generic.constants import AEDT_UNITS
3133
from ansys.aedt.core.generic.general_methods import pyaedt_function_handler
3234
from ansys.aedt.core.internal.checks import graphics_required
3335
from ansys.aedt.core.visualization.plot.pyvista import CommonPlotter
3436
from ansys.aedt.core.visualization.plot.pyvista import ObjClass
3537

36-
try:
37-
import numpy as np
38-
except ImportError:
39-
warnings.warn(
40-
"The NumPy module is required to run some functionalities of PostProcess.\nInstall with \n\npip install numpy"
41-
)
42-
4338

4439
class HDMPlotter(CommonPlotter):
4540
"""

0 commit comments

Comments
 (0)