I think you want
Import numpy as np
On Sat, Jun 22, 2019, at 9:22 PM, Barry Duggan wrote:
I am trying to build an Out of Tree block in Python, but having aproblem. The tutorial on building a Python block (squareme) didn'taddress input and output ports :(Here is my code (just to get the basic structure):"""#!/usr/bin/env python# -*- coding: utf-8 -*-## Copyright 2019 Barry Duggan KV4FV#from gnuradio import grfrom numpy import npITA2 = [ 0x00, 'E', '\n', 'A', ' ', 'S', 'I', 'U', '\r', 'D', 'R', 'J','N', 'F', 'C', 'K','T', 'Z', 'L', 'W', 'H', 'Y', 'P', 'Q', 'O', 'B', 'G', 0x0e,'M', 'X', 'V', 0x0f,0x00, '3', '\n', '-', ' ', 0x07, '8', '7', '\r', '$', '4','\'', ',', '!', ':', '(','5', '\"', ')', '2', '#', '6', '0', '1', '9', '\?', '\&',0x0e, '.', '/', ';', 0x0f ]_figs = 0x1b_ltrs = 0x1f_shift = 0class convUtoI_bb(gr.sync_block):"""convert UTF-8 to ITA2 (Baudot)"""def __init__(self):gr.sync_block.__init__(self,name="convUtoI_bb",in_sig=[np.byte],out_sig=[np.byte])def work(self, input_items, output_items):in0 = input_items[0]out = output_items[0]# if char is in ITA2if (in0 in ITA2):_idx = ITA2.index# store ITA2 char_idx &= 0x1Fout[:] = int(_idx)else:out[:] = in0return len(output_items[0])"""and at execution I get:Traceback (most recent call last):File "/home/pi/gnuradio/test0621.py", line 26, in <module>import UTFtoITAFile "/usr/lib/python2.7/dist-packages/UTFtoITA/__init__.py", line 34,in <module>from convUtoI_bb import convUtoI_bbFile "/usr/lib/python2.7/dist-packages/UTFtoITA/convUtoI_bb.py", line23, in <module>from numpy import npImportError: cannot import name npIf importing numpy is not correct, how do I specify the size of theinput and output ports?Thanks.--Barry Duggan_______________________________________________Discuss-gnuradio mailing listDiscuss-gnuradio@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnuradio
No comments:
Post a Comment