Skip to content

Commit

Permalink
REFACTOR: Regular code improvement (#5319)
Browse files Browse the repository at this point in the history
  • Loading branch information
SMoraisAnsys authored Oct 25, 2024
1 parent a06a08a commit 457def8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/ansys/aedt/core/visualization/advanced/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def convert_nearfield_data(dat_folder, frequency=6, invert_phase_for_lower_faces
real.append(line[3])
imag.append(line[4])

assert face in components, "Wrong file name format. Face not found."
if face not in components:
raise RuntimeError("Wrong file name format. Face not found.")

if not components[face].x:
components[face].set_xyz_points(x, y, z)
components[face].fill_empty_data()
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/aedt/core/visualization/plot/pyvista.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,8 @@ def animate(self):
-------
bool
"""

assert len(self.frames) > 0, "Number of Fields have to be greater than 1 to do an animation."
if len(self.frames) <= 0:
raise RuntimeError("Number of Fields have to be greater than 1 to do an animation.")
if self.is_notebook:
self.pv = pv.Plotter(notebook=self.is_notebook, off_screen=True, window_size=self.windows_size)
else:
Expand Down Expand Up @@ -1526,7 +1526,7 @@ def p_callback():
try:
self.pv.update(1, force_redraw=True)
except Exception:
pass
pyaedt_logger.debug("Something went wrong while updating plotter.")
if self.gif_file:
first_loop = True
self.pv.write_frame()
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/aedt/core/visualization/report/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def polyline(self):
try:
self._props["context"]["polyline"] = self.traces[0].properties["Geometry"]
except Exception:
pass
self._post._app.logger.debug("Something went wrong while processing polyline.")
return self._props["context"].get("polyline", None)

@polyline.setter
Expand Down Expand Up @@ -1133,7 +1133,7 @@ def variations(self):
variations[tr.properties["Secondary Sweep"]] = ["All"]
self._props["context"]["variations"] = variations
except Exception:
pass
self._post._app.logger.debug("Something went wrong while processing variations.")
return self._props["context"]["variations"]

@variations.setter
Expand Down Expand Up @@ -1292,7 +1292,7 @@ def domain(self):
try:
return self.traces[0].properties["Domain"]
except Exception:
pass
self._post._app.logger.debug("Something went wrong while accessing trace's Domain property.")
return self._props["context"]["domain"]

@domain.setter
Expand Down

0 comments on commit 457def8

Please sign in to comment.