-
Notifications
You must be signed in to change notification settings - Fork 882
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add spectrogram view and channel separation
* show getting start hint in interpretation * add test for creating spectrogram * add spectrogram page to signal frame remove parent frame property from epic graphic view * prototype for spectrogram drawing (has performance issues) * enable yscale for spectrogram * regen file * enhance spectrogram performance by using QImage * enable y scale for spectrogram * add initial legend to spectrogram * fix colormap location * remove colormap legend * add more colormaps * make colormap configurable via ini * make colormap configurable in settings * make fft window size configurable * rescale Y on signal frame resize * adapt unittest to new api * allow y move with drag for spectrogram view * refactor painting backend * enable vertical selection in spectrogram graphic view * spectrum: fix order of y values * use fliplr for compat * add bandpass filter function * add narrowband iir filter * set lower bandwidth for test * add windowed sinc to filter class and adapt unittest * change default of hold shift to drag This way making a selection does not require a key modifier by default * add fft convolution * add performance test for fft convolution * speed up performance test * fix error for small data sets * add test for filtering channels * use astype for compatibility with old numpy versions * refactor context menu of graphic views * remove fft convolve performance test to avoid random fails on CI * fix spectrogram calculation * fix spectrogram calculation * improve stft performance * show samples in view for spectrogram and allow deeper zoom * enable zoom to selection for spectrogram * enable start end and selection infos for spectrogram selection * enable bandpass filtering from spectrogram * fix selection start end behavior for spectrogram * update spectrogram infos in start end edited * add unittest for channel separation * enhance architecture of spectrogram management * add class SpectrogramSceneManager * cache spectrogram * fix x axis orientation * move scene managers to painting * redraw on fft size update * add lod slider for spectrogram * remove unused stuff * add tooltip for lod slider * update selected bandwidth on sample rate changed * add update for gv signal on resize * fix fftshift parameter * remove xflip as this is corrected by fftshift now * remove lod slider as it leads to confusion and low lods are hard to see * clip f_low and f_high * update spectrogram images on colormap change * set loading cursor right before bandpass filtering signal * add select all action with ctrl+a to graphic views * use parameters from original signal for newly created signals * fix noise level in unittest * improve spectrogram performance by splitting image into segments * avoid division by zero * fix unittest * improve signal redraw on resize * add created signal right under original signal * adapt unittest to filtered frame created under original signal * add dialog for configure bandwidth and display default values * make bandwidth configurable * fix spectrogram scene rect for small signals * make data min and data max for spectrogram configurable * use object names for indexing settings as texts are not reliable Some OSes insert & before texts probably for shortcuts * use heuristic to choose normal or FFT convolution * suggest a filename for unsaved signals based on their name * fix subpath range calculation * use window for subpath drawing to avoid flickering colors
- Loading branch information
Showing
62 changed files
with
8,991 additions
and
2,182 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from PyQt5.QtCore import pyqtSlot | ||
from PyQt5.QtWidgets import QDialog, QLabel, QRadioButton | ||
|
||
from urh import constants | ||
from urh.signalprocessing.Filter import Filter | ||
from urh.ui.ui_filter_bandwidth_dialog import Ui_DialogFilterBandwidth | ||
|
||
|
||
class FilterBandwidthDialogController(QDialog): | ||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
self.ui = Ui_DialogFilterBandwidth() | ||
self.ui.setupUi(self) | ||
|
||
bw_type = constants.SETTINGS.value("bandpass_filter_bw_type", "Medium", str) | ||
custom_bw = constants.SETTINGS.value("bandpass_filter_custom_bw", 0.1, float) | ||
|
||
for item in dir(self.ui): | ||
item = getattr(self.ui, item) | ||
if isinstance(item, QLabel): | ||
name = item.objectName().replace("label", "") | ||
key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None) | ||
if key is not None and name.endswith("Bandwidth"): | ||
item.setText("{0:n}".format(Filter.BANDWIDTHS[key])) | ||
elif key is not None and name.endswith("KernelLength"): | ||
item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key]))) | ||
elif isinstance(item, QRadioButton): | ||
item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", "")) | ||
|
||
self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw) | ||
self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw)) | ||
|
||
self.create_connects() | ||
|
||
def create_connects(self): | ||
self.ui.doubleSpinBoxCustomBandwidth.valueChanged.connect(self.on_spin_box_custom_bandwidth_value_changed) | ||
self.ui.spinBoxCustomKernelLength.valueChanged.connect(self.on_spin_box_custom_kernel_length_value_changed) | ||
self.ui.buttonBox.accepted.connect(self.on_accepted) | ||
|
||
@property | ||
def checked_radiobutton(self): | ||
for rb in dir(self.ui): | ||
radio_button = getattr(self.ui, rb) | ||
if isinstance(radio_button, QRadioButton) and radio_button.isChecked(): | ||
return radio_button | ||
return None | ||
|
||
@pyqtSlot(float) | ||
def on_spin_box_custom_bandwidth_value_changed(self, bw: float): | ||
self.ui.spinBoxCustomKernelLength.blockSignals(True) | ||
self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(bw)) | ||
self.ui.spinBoxCustomKernelLength.blockSignals(False) | ||
|
||
@pyqtSlot(int) | ||
def on_spin_box_custom_kernel_length_value_changed(self, filter_len: int): | ||
self.ui.doubleSpinBoxCustomBandwidth.blockSignals(True) | ||
self.ui.doubleSpinBoxCustomBandwidth.setValue(Filter.get_bandwidth_from_filter_length(filter_len)) | ||
self.ui.doubleSpinBoxCustomBandwidth.blockSignals(False) | ||
|
||
@pyqtSlot() | ||
def on_accepted(self): | ||
if self.checked_radiobutton is not None: | ||
bw_type = self.checked_radiobutton.objectName().replace("radioButton", "").replace("_", " ") | ||
constants.SETTINGS.setValue("bandpass_filter_bw_type", bw_type) | ||
|
||
constants.SETTINGS.setValue("bandpass_filter_custom_bw", self.ui.doubleSpinBoxCustomBandwidth.value()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.