aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/gr-fadingui/grc/fadingui_netsink.block.yml5
-rw-r--r--src/gr-fadingui/python/netsink.py12
2 files changed, 13 insertions, 4 deletions
diff --git a/src/gr-fadingui/grc/fadingui_netsink.block.yml b/src/gr-fadingui/grc/fadingui_netsink.block.yml
index a23dc52..3cd8ae7 100644
--- a/src/gr-fadingui/grc/fadingui_netsink.block.yml
+++ b/src/gr-fadingui/grc/fadingui_netsink.block.yml
@@ -7,7 +7,7 @@ templates:
imports: |-
import fadingui
import numpy as np
- make: fadingui.netsink(address=${address}, dtype=${type}, vlen=${veclen})
+ make: fadingui.netsink(address=${address}, dtype="${type}", vlen=${veclen})
# Make one 'parameters' list entry for every parameter you want settable from the GUI.
# Keys include:
@@ -18,8 +18,7 @@ parameters:
- id: type
label: Type
dtype: enum
- options: [complex, float, int, np.short, np.byte]
- option_labels: [complex, float, int, short, byte]
+ options: [complex, float, int, short, byte]
option_attributes:
size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short, gr.sizeof_char]
hide: part
diff --git a/src/gr-fadingui/python/netsink.py b/src/gr-fadingui/python/netsink.py
index d2dfc92..130e5dc 100644
--- a/src/gr-fadingui/python/netsink.py
+++ b/src/gr-fadingui/python/netsink.py
@@ -15,7 +15,17 @@ class netsink(gr.sync_block):
Keep in mind that is quite slow.
"""
def __init__(self, address, dtype, vlen):
- dt = np.dtype(dtype, (vlen,)) if vlen > 1 else dtype
+ to_numpy = {
+ "complex": np.complex64,
+ "float": np.float32,
+ "int": np.int32,
+ "short": np.short,
+ "byte": np.byte,
+ }
+
+ dt = to_numpy[dtype]
+ if vlen > 1:
+ dt = np.dtype(dt, (vlen,))
print(dt)
gr.sync_block.__init__(self,