Skip to content

Instantly share code, notes, and snippets.

@marcusmueller
Created February 12, 2024 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusmueller/a44da5e91f35d2d27415375e76af760c to your computer and use it in GitHub Desktop.
Save marcusmueller/a44da5e91f35d2d27415375e76af760c to your computer and use it in GitHub Desktop.
options:
parameters:
author: Marcus
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: '2024'
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: no_gui
hier_block_src_path: '.:'
id: repro6795
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: '"Embedded Python block: GRC normalizes case of the name, uncalled for"'
window_size: (1000,1000)
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: epy_block_0
id: epy_block
parameters:
_source_code: "\"\"\"\nEmbedded Python Blocks:\n\nEach time this file is saved,\
\ GRC will instantiate the first class it finds\nto get ports and parameters\
\ of your block. The arguments to __init__ will\nbe the parameters. All of\
\ them are required to have default values!\n\"\"\"\n\nimport numpy as np\n\
from gnuradio import gr\n\n\nclass blk(gr.sync_block): # other base classes\
\ are basic_block, decim_block, interp_block\n \"\"\"Embedded Python Block\
\ example - a simple multiply const\"\"\"\n\n def __init__(self, not_capitalized=1.0):\
\ # only default arguments here\n \"\"\"arguments to this function show\
\ up as parameters in GRC\"\"\"\n gr.sync_block.__init__(\n \
\ self,\n name='Embedded Python Block', # will show up in GRC\n\
\ in_sig=[],\n out_sig=[]\n )\n # if an\
\ attribute with the same name as a parameter is found,\n # a callback\
\ is registered (properties work, too).\n self.not_capitalized = not_capitalized\n\
\n def work(self, input_items, output_items):\n \"\"\"example: multiply\
\ with constant\"\"\"\n output_items[0][:] = input_items[0] * self.example_param\n\
\ return len(output_items[0])\n"
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
not_capitalized: '"wrooong"'
states:
_io_cache: ('Embedded Python Block', 'blk', [('not_capitalized', '1.0')], [],
[], 'Embedded Python Block example - a simple multiply const', ['not_capitalized'])
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [344, 20.0]
rotation: 0
state: enabled
connections: []
metadata:
file_format: 1
grc_version: v3.11.0.0git-649-gd7cdf222
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment