Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get trace data #297

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading