Skip to content

Commit 1af25fe

Browse files
authored
Merge branch 'main' into fix/set_core_loss_coeff
2 parents 420c584 + 14e2844 commit 1af25fe

9 files changed

Lines changed: 29 additions & 17 deletions

File tree

doc/changelog.d/5927.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reduce number of units call from odesktop

doc/changelog.d/5935.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
colormap names in folder settings

doc/source/Resources/pyaedt_settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ log:
2020
# Enable or disable the logging of methods' arguments at debug level
2121
enable_debug_methods_argument_logger: false
2222
# Enable or disable the logging to the AEDT message window
23-
enable_desktop_logs: true
23+
enable_desktop_logs: false
2424
# Enable or disable the logging to a file
2525
enable_file_logs: true
2626
# Enable or disable the global PyAEDT log file located in the global temp folder

src/ansys/aedt/core/application/aedt_units.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ def __init__(self, aedt_object=None):
4646
self._mass = self._get_model_unit("Mass")
4747
self._conductance = self._get_model_unit("Conductance")
4848
self._rescale_model = False
49+
self._units_by_system = {}
50+
51+
def get_unit_by_system(self, unit_system):
52+
if unit_system in self._units_by_system:
53+
return self._units_by_system[unit_system]
54+
val = self._get_model_unit(unit_system)
55+
if val:
56+
self._units_by_system[unit_system] = val
57+
return self._units_by_system[unit_system]
58+
return
4959

5060
@property
5161
def rescale_model(self):
@@ -63,7 +73,10 @@ def rescale_model(self, val):
6373

6474
def _get_model_unit(self, unit_system):
6575
if self.__app:
66-
return self.__app._odesktop.GetDefaultUnit(unit_system)
76+
try:
77+
return self.__app._odesktop.GetDefaultUnit(unit_system)
78+
except Exception:
79+
return
6780

6881
@property
6982
def frequency(self):

src/ansys/aedt/core/application/analysis.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,16 +2255,10 @@ def value_with_units(
22552255

22562256
if units is None:
22572257
if units_system == "Length":
2258-
if "GetModelUnits" in dir(self.oeditor):
2259-
units = self.oeditor.GetModelUnits()
2260-
elif "GetActiveUnits" in dir(self.oeditor):
2261-
units = self.oeditor.GetActiveUnits()
2262-
else:
2263-
units = self.odesktop.GetDefaultUnit(units_system)
2258+
units = self.units.length
22642259
else:
2265-
try:
2266-
units = self.odesktop.GetDefaultUnit(units_system)
2267-
except Exception:
2260+
units = self.units.get_unit_by_system(units_system)
2261+
if not units:
22682262
self.logger.warning("Defined unit system is incorrect.")
22692263
units = ""
22702264

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ def wrapper(*args, **kwargs):
201201
try:
202202
settings.time_tick = time.time()
203203
out = user_function(*args, **kwargs)
204-
if settings.enable_debug_logger or settings.enable_debug_edb_logger:
205-
_log_method(user_function, args, kwargs)
204+
_log_method(user_function, args, kwargs)
206205
return out
207206
except MethodNotSupportedError as e:
208207
message = "This method is not supported in current AEDT design type."
@@ -284,6 +283,8 @@ def check_numeric_equivalence(a, b, relative_tolerance=1e-7):
284283

285284

286285
def _log_method(func, new_args, new_kwargs):
286+
if not (settings.enable_debug_logger or settings.enable_debug_edb_logger):
287+
return
287288
if not settings.enable_debug_internal_methods_logger and str(func.__name__)[0] == "_":
288289
return
289290
if not settings.enable_debug_geometry_operator_logger and "GeometryOperators" in str(func):

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def __init__(self):
144144
# Settings related to logging
145145
self.__logger: Optional[logging.Logger] = None
146146
self.__enable_logger: bool = True
147-
self.__enable_desktop_logs: bool = True
147+
self.__enable_desktop_logs: bool = False
148148
self.__enable_screen_logs: bool = True
149149
self.__enable_file_logs: bool = True
150150
self.__logger_file_path: Optional[str] = None

src/ansys/aedt/core/visualization/post/field_data.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ def color(self, v):
156156
"""
157157
if self.map_type == "Spectrum":
158158
self._validate_color_spectrum(v)
159+
if v == "Magenta":
160+
v = "Megenta"
159161
self._color_spectrum = v
160162
else:
161163
self._validate_color(v)
@@ -166,9 +168,9 @@ def color(self, v):
166168

167169
@staticmethod
168170
def _validate_color_spectrum(value):
169-
if value not in ["Magenta", "Rainbow", "Temperature", "Gray"]:
171+
if value not in ["Magenta", "Rainbow", "Temperature", "Grayscale"]:
170172
raise ValueError(
171-
f"{value} is not valid. Only 'Magenta', 'Rainbow', 'Temperature', and 'Gray' are accepted."
173+
f"{value} is not valid. Only 'Magenta', 'Rainbow', 'Temperature', and 'Grayscale' are accepted."
172174
)
173175

174176
@staticmethod

tests/system/general/test_98_Icepak.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ def test078__folder_settings(self, ipk):
19161916
with pytest.raises(ValueError):
19171917
fs.color_map_settings.color = "Hot"
19181918
assert fs.color_map_settings.color == "Rainbow"
1919-
fs.color_map_settings.color = "Temperature"
1919+
fs.color_map_settings.color = "Magenta"
19201920
assert isinstance(fs.color_map_settings.to_dict(), dict)
19211921
assert isinstance(fs.to_dict(), dict)
19221922
fs.update()

0 commit comments

Comments
 (0)