mirror of
https://github.com/jopohl/urh.git
synced 2026-03-06 00:14:00 +01:00
* rename signalFunctions -> signal_functions * basic methods for auto interpretation * cythonize k means * reorder tests * remove check and update gitignore * estimate tolerance and implement score for choosing modulation type * use absdiff * remove comment * cythonize messsage segmentation * improve message segementation and add test for xavax * integrate OOK special case * add check if psk is possible * integrate xavax and improve score * improve noise detection * add test for noise detection multiple messages * improve noise detection * homematic fix: use percetange of signal length instead of num flanks * homematic has some trash at start of messages, which counts as flanks * additonally set score to 0 if found only one bit length lower 5 * calculate minimum bit length from tolerance * improve noise noise detection * refactor limit and propose new limit calculation * improve minimum bit length penalty * only increase score for mod_type if bit length surpasses a minimum * this way scoring loop later becomes easier and * score is more accurate as there is no division needed which does not scale well with the length of message vectors * remove demodulated complex files and demod live in tests * remove enocean.coco * add a new check to prevent PSK misclassification * add tolerance unit test * use z=2 for finding outlier free max in tolerance estimation * prevent numpy warnings * adapt threshold of unit test * normalize the score by dividing by plateau vector length * improve OOK segmentation: Use minimum pulse length instead pause length for reference * use 50 percentile for detecting n_digits in plateau rounding * add elektromaten integration test * improve center detection to deal with varying signal power levels * use 10% clustering for rect signal * calculate min and max of each cluster * return max(minima) + min(maxima) / 2 * improve the center aggregation, separate between modulation types * add validity checks if message can be ASK or FSK modulated * use a weighted mean for center estimation: 60/40 for high/low * improve bit length estimation: use decimal deviation for filtering * add scislo test * improve tolerance estimation: use 50 percentile + revert to normal mean for bitlength estimation * add haar wavelet transform * add median filter * rename to Wavelet * add signal generation with configurable snr for lab test * add method for testdata generation * prepare fsk test: generate messages and estimate parameters * improve performance of plateau length filtering * remove unused import * improve robustness * improve robustness * add fsk error plot * only append bit length if it surpasses minimum * fix plot title * improve noise level detection, prevent it from being too low * integrate all modulations to test * increase pause threshold for ook * improve tolerance estimation * improve noise detection: take maximum of all maxima of noise clusters * improve scoring algorithm to prevent PSK misclassify as FSK * use histogram based approach for center detection * modulation detection with wavelets * fix median filter when at end of data * integrate modulation detection with wavelets * improve robustness * improve psk parameters * improve psk threshold * improve robustness * swap psk angles for easier demod * better xticks * add message segmentation test and fix noise generation snr * add error print * update audi test * fix runtime warning * improve accuracy of center detection * avoid warning * remove unused functions * fine tune fsk fft threshold * update esaver test * improve fsk fft threshold * change test order * update enocean test signal * update enocean test signal * enhance bit length estimation: use a threshold divisor histogram * improve noise estimation: round to fourth digit * update enocean signal * consider special case if message pause is 0 * remove unused * improve noise detection * improve center detection * improve center detection * prevent warning * refactor * cythonize get_plateau_lengths * improve syntax * use c++ sort * optimize PSK threshold * optimize coverage * fix buffer types * integrate new auto detection routine * update test * remove unused stuff * fix tests * backward compat * backward compat * update test * add threshold for large signals for performance * update changelog * make algorithm more robust against short bit length outliers * make multi button for selecting auto detect options * update unittest
53 lines
2.5 KiB
Python
53 lines
2.5 KiB
Python
from PyQt5.QtCore import QTimer
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from tests.QtTestCase import QtTestCase
|
|
from urh.controller.dialogs.AdvancedModulationOptionsDialog import AdvancedModulationOptionsDialog
|
|
|
|
|
|
class TestAdvancedModulationSettings(QtTestCase):
|
|
def test_pause_threshold(self):
|
|
self.add_signal_to_form("enocean.complex")
|
|
signal_frame = self.form.signal_tab_controller.signal_frames[0]
|
|
signal_frame.ui.cbModulationType.setCurrentText("ASK")
|
|
self.assertGreater(signal_frame.proto_analyzer.num_messages, 1)
|
|
self.__make_setting(signal_frame, pause_threshold=0)
|
|
self.assertEqual(signal_frame.proto_analyzer.num_messages, 1)
|
|
|
|
def test_message_length_divisor(self):
|
|
self.add_signal_to_form("pwm.coco")
|
|
signal_frame = self.form.signal_tab_controller.signal_frames[0]
|
|
signal_frame.ui.cbModulationType.setCurrentText("ASK")
|
|
protocol = signal_frame.proto_analyzer
|
|
|
|
bits = "1000100010001110100011101000111010001000100011101000111010001110100011101000111010001110111011101"
|
|
pauses = [77115, 77113, 58221]
|
|
for i in range(3):
|
|
self.assertEqual(protocol.plain_bits_str[i], bits, msg=str(i))
|
|
self.assertEqual(protocol.messages[i].pause, pauses[i], msg=str(i))
|
|
|
|
self.__make_setting(signal_frame, message_divisor_length=4)
|
|
self.assertEqual(signal_frame.signal.message_length_divisor, 4)
|
|
for i in range(3):
|
|
self.assertEqual(protocol.plain_bits_str[i], bits + "000", msg=str(i))
|
|
self.assertEqual(protocol.messages[i].pause, pauses[i] - 3 * signal_frame.signal.bit_len, msg=str(i))
|
|
|
|
def __make_setting(self, signal_frame, pause_threshold=None, message_divisor_length=None):
|
|
def accept_dialog():
|
|
for widget in QApplication.instance().topLevelWidgets():
|
|
if isinstance(widget, AdvancedModulationOptionsDialog):
|
|
if pause_threshold is not None:
|
|
widget.ui.spinBoxPauseThreshold.setValue(pause_threshold)
|
|
if message_divisor_length is not None:
|
|
widget.ui.spinBoxMessageLengthDivisor.setValue(message_divisor_length)
|
|
widget.ui.buttonBox.accepted.emit()
|
|
return
|
|
|
|
timer = QTimer(self.form)
|
|
timer.setSingleShot(True)
|
|
timer.timeout.connect(accept_dialog)
|
|
timer.setInterval(10)
|
|
timer.start()
|
|
|
|
signal_frame.ui.btnAdvancedModulationSettings.click()
|