Skip to content

Commit

Permalink
Merge pull request #3 from Sense-Scape/random-features
Browse files Browse the repository at this point in the history
Fix: For tabs
  • Loading branch information
Grabt234 authored Oct 7, 2024
2 parents 3460999 + c9e2d01 commit 08d91d5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ def update_images(self):
msg = self.show_popup("Loading", False)

self.Sxx = {}

if self.num_channels:
for i in range(self.num_channels):
self.remove_plot_tab(i)

for i in range(self.num_channels):
self.add_plot_tab(i)
self.generate_spectrogram_data(i)
Expand Down Expand Up @@ -133,23 +138,23 @@ def update_spectrum_image(self, channel_index, spectrum_column_index):
self.channel_plots[channel_index].spectrum_axes.set_ylabel('Intensity [Arb dB]')
self.channel_plots[channel_index].spectrum_axes.set_title(f'Spectrum Sample at Time of {slice_time} Seconds of \n ' + self.file_path_label.text())

self.set_spectrum_axes_limits()
self.set_spectrum_axes_limits(channel_index)

# Update the column plot canvas
self.channel_plots[channel_index].spectrum_canvas.draw()

def set_spectrum_axes_limits(self):
def set_spectrum_axes_limits(self,channel_index):

selected_spectrum_mode = self.spectrum_mode.getInputText()

if selected_spectrum_mode == "Amplitude [dB]":
self.channel_plots[0].spectrum_axes.set_ylim([-60,60])
self.channel_plots[channel_index].spectrum_axes.set_ylim([-60,60])
elif selected_spectrum_mode == "Amplitude [lin]":
self.channel_plots[0].spectrum_axes.set_ylim([-1,50])
self.channel_plots[channel_index].spectrum_axes.set_ylim([-1,50])
elif selected_spectrum_mode == "Phase [Rad]":
self.channel_plots[0].spectrum_axes.set_ylim([-1.1*np.pi,1.1*np.pi])
self.channel_plots[channel_index].spectrum_axes.set_ylim([-1.1*np.pi,1.1*np.pi])
elif selected_spectrum_mode == "Phase [Deg]":
self.channel_plots[0].spectrum_axes.set_ylim([-185,185])
self.channel_plots[channel_index].spectrum_axes.set_ylim([-185,185])

def on_click(self, event):

Expand All @@ -170,11 +175,6 @@ def on_click(self, event):

def load_file(self):

# Clear current tabs if they exist
if self.num_channels:
for i in range(self.num_channels):
self.remove_plot_tab(i)

# Open a file dialog to let the user select a file
file_path, _ = QFileDialog.getOpenFileName(self, "Select File", "", "*.wav")

Expand Down

0 comments on commit 08d91d5

Please sign in to comment.