mirror of
https://github.com/jopohl/urh.git
synced 2026-03-07 08:46:46 +01:00
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
import os
|
|
import tempfile
|
|
|
|
import numpy as np
|
|
|
|
from tests.QtTestCase import QtTestCase
|
|
from urh.signalprocessing.Modulator import Modulator
|
|
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
|
from urh.signalprocessing.Signal import Signal
|
|
|
|
class GFSK(QtTestCase):
|
|
def setUp(self):
|
|
pass
|
|
|
|
def test_gfsk(self):
|
|
target_file = os.path.join(tempfile.gettempdir(), "test.complex")
|
|
|
|
modulator = Modulator("gfsk")
|
|
modulator.modulation_type_str = "FSK"
|
|
modulator.samples_per_bit = 100
|
|
modulator.sample_rate = 1e6
|
|
modulator.param_for_one = 20e3
|
|
modulator.param_for_zero = -10e3
|
|
modulator.modulate([True, False, False, True, False], 9437)
|
|
s = modulator.modulated_samples
|
|
modulator.modulate([True, False, True], 9845) #, start=len(s))
|
|
s = np.concatenate((s, modulator.modulated_samples))
|
|
modulator.modulate([True, False, True, False], 8457) #, start=len(s))
|
|
s = np.concatenate((s, modulator.modulated_samples))
|
|
|
|
s.tofile(target_file)
|
|
|
|
pa = ProtocolAnalyzer(Signal(target_file, "test", modulation="FSK"))
|
|
pa.get_protocol_from_signal()
|