Here's a vector-subtract graph that should do what Ed wants, might need some tweaking.If you're somewhat familiar with how to write/modify blocks, it probably wouldn't be difficult to implement that functionality by making a new block that is a copy of gr_multiply_const_vcc.cc (for instance) and changing the work function to do what you want.Sean
Performance won't be as good as with a dedicated block to do the same thing, but if the data rates aren't obscene, this should work reasonably well, I think. Ed mentioned that the vector is the result of an FFT, so I simply placed an FFT block in there for
illustrative purposes. -- Marcus Leech Principal Investigator Shirleys Bay Radio Astronomy Consortium http://www.sbrac.org
vector_subtract.grc
Description: application/gnuradio-grc
#!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph # Title: Vector Subtract # Generated: Mon Dec 19 17:18:29 2011 ################################################## from gnuradio import eng_notation from gnuradio import gr from gnuradio import window from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import wx class vector_subtract(grc_wxgui.top_block_gui): def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Vector Subtract") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.veclen = veclen = 1024 self.samp_rate = samp_rate = 32000 ################################################## # Blocks ################################################## self.gr_vector_to_stream_0 = gr.vector_to_stream(gr.sizeof_gr_complex*1, veclen) self.gr_sub_xx_0 = gr.sub_cc(1) self.gr_stream_to_vector_0 = gr.stream_to_vector(gr.sizeof_gr_complex*1, veclen) self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*veclen) self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*veclen, "", False) self.gr_fft_vxx_0 = gr.fft_vcc(veclen, True, (window.blackmanharris(veclen)), True) self.gr_delay_0 = gr.delay(gr.sizeof_gr_complex*1, 1) ################################################## # Connections ################################################## self.connect((self.gr_vector_to_stream_0, 0), (self.gr_delay_0, 0)) self.connect((self.gr_delay_0, 0), (self.gr_sub_xx_0, 1)) self.connect((self.gr_vector_to_stream_0, 0), (self.gr_sub_xx_0, 0)) self.connect((self.gr_sub_xx_0, 0), (self.gr_stream_to_vector_0, 0)) self.connect((self.gr_stream_to_vector_0, 0), (self.gr_null_sink_0, 0)) self.connect((self.gr_file_source_0, 0), (self.gr_fft_vxx_0, 0)) self.connect((self.gr_fft_vxx_0, 0), (self.gr_vector_to_stream_0, 0)) def get_veclen(self): return self.veclen def set_veclen(self, veclen): self.veclen = veclen def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") (options, args) = parser.parse_args() tb = vector_subtract() tb.Run(True)
_______________________________________________ Discuss-gnuradio mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
