Created
July 24, 2018 16:30
-
-
Save haakov/fb381bf3de1dd6a02b697c9d92d7dae5 to your computer and use it in GitHub Desktop.
Multiply Const block
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
id: blocks_multiply_const_vxx | |
label: Multiply Const | |
parameters: | |
- id: type | |
label: IO Type | |
dtype: enum | |
options: [complex, float, int, short] | |
option_attributes: | |
const_type: [complex_vector, real_vector, int_vector, int_vector] | |
fcn: [cc, ff, ii, ss] | |
hide: part | |
- id: const | |
label: Constant | |
dtype: ${ type.const_type } | |
default: '0' | |
- id: vlen | |
label: Vec Length | |
dtype: int | |
default: '1' | |
hide: ${ 'part' if vlen == 1 else 'none' } | |
inputs: | |
- domain: stream | |
dtype: ${ type } | |
vlen: ${ vlen } | |
outputs: | |
- domain: stream | |
dtype: ${ type } | |
vlen: ${ vlen } | |
asserts: | |
- ${ (len(const) == vlen) if str(const).strip().startswith('[') else (vlen == 1) } | |
- ${ vlen > 0 } | |
templates: | |
imports: from gnuradio import blocks | |
make: blocks.multiply_const_v${type.fcn}(${ str(const) if str(const).strip().startswith('[') else ('[' + str(const) + ']') }) | |
callbacks: | |
- set_k(${const}) | |
file_format: 1 |
Hm, looks like you're right!
Okay so I've found the problem.
This namespace property ignores the option_attributes. This is why type
is recognized but not type.const_type
.
Pull request created: gnuradio/gnuradio#1925
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think, the type substitution for the constant dtype entry does not work. If I replace the dtype of const by real_vector the type of constant is now displayed as real_vector and the assertion does not fail any longer.
So why does the type of the constant keep raw and does not change depending on the selected type ?
So far as I can see the dtype entry in the constans parameter recognizes ${type} but not ${type.const_type}. ${type.const_type} seems to evaluate to '' !