diff options
author | sara <sara.halter@gmx.ch> | 2021-11-29 16:56:27 +0100 |
---|---|---|
committer | sara <sara.halter@gmx.ch> | 2021-11-29 16:56:27 +0100 |
commit | 5481f7cd6fca55a54c4c386204e0971cd1b6c036 (patch) | |
tree | 626bdf5a8be7a6c5ac34cdbd471d7e233e3c56aa /src/gr-fadingui | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | Fading-5481f7cd6fca55a54c4c386204e0971cd1b6c036.tar.gz Fading-5481f7cd6fca55a54c4c386204e0971cd1b6c036.zip |
FIR Block verbessert
Diffstat (limited to '')
-rw-r--r-- | src/gr-fadingui/grc/fadingui_multipath_fading.block.yml | 6 | ||||
-rw-r--r-- | src/gr-fadingui/python/multipath_fading.py | 15 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml b/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml index 1d374ac..b10826f 100644 --- a/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml +++ b/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml @@ -4,7 +4,9 @@ category: '[fadingui]' templates: imports: import fadingui - make: fadingui.multipath_fading(amplitudes=${amplitudes}, delays=${delays}) + make: fadingui.multipath_fading(amplitudes=${amplitudes}, delays=${delays}, los =${los}) + + # Make one 'parameters' list entry for every parameter you want settable from the GUI. # Keys include: @@ -20,7 +22,7 @@ parameters: dtype: raw - id: los label: LOS/NLOS - options: ['True', 'False'] + options: [True, False] option_labels: ['LOS', 'NLOS'] #default: 'False' dtype: bool diff --git a/src/gr-fadingui/python/multipath_fading.py b/src/gr-fadingui/python/multipath_fading.py index 02b3bb4..3c34a79 100644 --- a/src/gr-fadingui/python/multipath_fading.py +++ b/src/gr-fadingui/python/multipath_fading.py @@ -31,7 +31,7 @@ class multipath_fading(gr.sync_block): """ docstring for block multipath_fading """ - def __init__(self, amplitudes=[], delays=[], los=True): # only default arguments here + def __init__(self, amplitudes, delays, los): # only default arguments here """arguments to this function show up as parameters in GRC""" gr.sync_block.__init__( self, @@ -61,22 +61,20 @@ class multipath_fading(gr.sync_block): inp = input_items[0] oup = output_items[0] + if len(self.amplitudes) != len(self.delays): # Test: Es muss gleich viele Werte für Delays und Amplituden haben. raise Exception("Amplitudes and Delay length dont match") - - - #TO DO negativ check + if np.min(self.delays)<0: #Negativ Check + raise Exception("Delay can't be negativ") - # raise Exception("Delay length can't be one") #if np.min(self.delays)<=1: # raise Exception("Delay length can't be one") - #max_len = np.max(self.delays) #Max Werte herausfinden für länge - #sum_x = np.zeros(max_len) - max_order = 2 * np.floor(np.max(self.delays)) + 1 + + max_order = 2 * np.floor(np.max(self.delays)) + 1 #Max Werte herausfinden für länge max_samples = np.arange(0, max_order +1) max_len = len(max_samples) #Für Filter @@ -110,7 +108,6 @@ class multipath_fading(gr.sync_block): # signal_shifted = np.convolve(h, inp, mode='full') # y = signal_shifted - #y+=np.concatenate([self.temp,np.zeros(len(y)-len(self.temp))]) y+=np.concatenate([self.temp,np.zeros(len(y)-len(self.temp))]) oup[:] = y[:len(inp)] |