Skip to content

Commit

Permalink
Fix get trace data
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelopez-ansys committed Nov 4, 2024
1 parent b60c45d commit 3a42984
Showing 1 changed file with 26 additions and 25 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,25 +377,25 @@ 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):
if data:
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,
pen=self.line_color
)
graph_obj.setTitle("Realized gain at {} {}".format(cut_name, cut))
graph_obj.setLabel(
"left",
"Realized Gain",
)
graph_obj.setLabel(
"bottom",
sweep,
)
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,
pen=self.line_color
)
graph_obj.setTitle("Realized gain at {} {}".format(cut_name, cut))
graph_obj.setLabel(
"left",
"Realized Gain",
)
graph_obj.setLabel(
"bottom",
sweep,
)

0 comments on commit 3a42984

Please sign in to comment.