Skip to content

Commit

Permalink
Fix get trace data (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys authored Nov 4, 2024
1 parent f94c847 commit 413458c
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ def antenna_results_finished(self):
output_file=None,
show=False,
is_polar=False)

self.__plot_2d_cut(self.farfield_2d_phi_graph, data, phi[0], "Phi", "Theta")
if data:
self.__plot_2d_cut(self.farfield_2d_phi_graph, data, phi[0], "Phi", "Theta")

data = self.farfield_data.plot_cut(quantity="RealizedGain",
primary_sweep="phi",
Expand All @@ -328,8 +328,8 @@ def antenna_results_finished(self):
output_file=None,
show=False,
is_polar=False)

self.__plot_2d_cut(self.farfield_2d_theta_graph, data, theta[0], "Theta", "Phi")
if data:
self.__plot_2d_cut(self.farfield_2d_theta_graph, data, theta[0], "Theta", "Phi")

# 3D Plot
background_hex = self.main_window.ui.themes["app_color"]["bg_one"]
Expand Down Expand Up @@ -358,7 +358,8 @@ def phi_cut_combobox_clicked(self):
overlap = self.phi_cut_overlap.isChecked()
if not overlap:
self.farfield_2d_phi_graph.clear()
self.__plot_2d_cut(self.farfield_2d_phi_graph, data, phi, "Phi", "Theta")
if data:
self.__plot_2d_cut(self.farfield_2d_phi_graph, data, phi, "Phi", "Theta")

def theta_cut_combobox_clicked(self):
if self.farfield_data:
Expand All @@ -376,12 +377,14 @@ def theta_cut_combobox_clicked(self):
overlap = self.theta_cut_overlap.isChecked()
if not overlap:
self.farfield_2d_theta_graph.clear()
self.__plot_2d_cut(self.farfield_2d_theta_graph, data, theta, "Theta", "Phi")
if data:
self.__plot_2d_cut(self.farfield_2d_theta_graph, data, theta, "Theta", "Phi")

def __plot_2d_cut(self, graph_obj, data, cut, cut_name, sweep):
lines = data.ax.get_lines()
x_data = lines[-1].get_xdata()
y_data = lines[-1].get_ydata()
trace_name = data.trace_names[0]
cartesian_data = data.traces[trace_name].cartesian_data
x_data = cartesian_data[0]
y_data = cartesian_data[1]
graph_obj.plot(
x_data,
y_data,
Expand Down

0 comments on commit 413458c

Please sign in to comment.