o.k, I find compiling gnuradio and uhd from source not that easy: I keep getting compiler-error-messages and messages about missing dependencies in the process. I will try to upgrage my Ubuntu. In the meantime I ran across and OOT-module named vave, which does what I want. I tried to modify it to take complex vectors, but upon execution in grc I get the error message:
ValueError: itemsize mismatch: multiply_conjugate_cc0:0 using 8192, vave_cc0:0 using 16384 The original code with float64 in place of complex works fine. Something is wrong with the size of the interface, but I can't figure out what it might be 1024xcomplex should be 1024*2*32/8=8192 and not 16384 ??? Many thanks for your hints, Wolfgang Here is what the top-python looks like self.connect((self.blocks_multiply_conjugate_cc_0, 0), (self.test_blocks_vave_cc_0, 0)) ... self.blocks_multiply_conjugate_cc_0 = blocks.multiply_conjugate_cc(1024) ... self.connect((self.blocks_multiply_conjugate_cc_0, 0)(self.test_blocks_vave_cc_0, 0)) This is vave_cc.py: #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2018 <+YOU OR YOUR COMPANY+>. # # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # import copy from gnuradio import gr class vave_cc(gr.decim_block): """ Vector Average with Decimation. Only one vector is returned for N input. This block is intended to reduce the downstream CPU load. """ def __init__(self, vlen, vdecimate): gr.decim_block.__init__(self, name="vave_cc", in_sig=[(numpy.complex, int(vlen))], out_sig=[(numpy.complex, int(vlen))], decim=int(vdecimate)) self.vlen = int(vlen) self.vdecimate = int(vdecimate) self.sum = numpy.zeros(self.vlen) self.count = 0 self.oneovern = 1./complex(self.vdecimate) def forecast( self, noutput_items, ninput_items): if noutput_items == None: return self.vdecimate # print 'Forecast: ', noutput_items for i in range(len(nout_items)): ninput_items[i] = noutput_items[i]*self.vdecimate # print 'Forecast: ', ninput_items return ninput_items # return self.vdecimate def work(self, input_items, output_items): """ Work averages all input vectors and outputs one vector for all inputs """ inn = input_items[0] # get the number of input vectors n = len( input_items) # number of input PORTS (only 1) nv = len(inn) # number of vectors in this port nout = len( output_items) #number of putput ports ini = inn[0] # first input vector li = len(ini) # length of first input vector # print 'Number work vectors: ', nv, ' Length: ',li ncp = min( li, self.vlen) noutports = len( output_items) if noutports != 1: print '!!!!!!! Unexpected number of output ports: ', noutports out = output_items[0] # vectors in PORT 0 nout = len(out) # number of output vectors out0 = out[0] # get the first output vector lo = len(out0) # length of 1st output vector # print 'Number work outputs: ', nout,' Length: ',lo iout = 0 # count the number of output vectors for i in range(nv): # get the lenght of one input ini = inn[i] ncp = min( li, self.vlen) # now save this vector until all are received self.sum[0:ncp] = self.sum[0:ncp] + ini[0:ncp] self.count = self.count + 1 # indicate consumption of a vector from input if self.count >= self.vdecimate: # normalize output average self.sum = self.oneovern * self.sum# out0[:] = copy.deepcopy(self.sum) outi = out[iout] outi = self.sum out[iout] = outi iout = iout+1 # now reset the count and restart the sum self.count = 0 self.sum = numpy.zeros( self.vlen)# self.produce(0,len(output_items[0])) # self.consume_each(nv) # return no # end for all input vectors # if here, then not enough vectors input to produce an output # self.consume(0,nv) output_items[0] = out# print 'N outputs: ', len(output_items[0]), iout self.sum = self.oneovern * self.sum # out0[:] = copy.deepcopy(self.sum) outi = out[iout] outi = self.sum out[iout] = outi iout = iout+1 # now reset the count and restart the sum self.count = 0 self.sum = numpy.zeros( self.vlen) # self.produce(0,len(output_items[0])) # self.consume_each(nv) # return no # end for all input vectors # if here, then not enough vectors input to produce an output # self.consume(0,nv) output_items[0] = out # print 'N outputs: ', len(output_items[0]), iout return len(output_items[0]) # end vave_cc() _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio