def key_factory(index): print "FACTORY CALLED index = %d" % (index) r = es.es_pyhandler() excess_bw = 0.5 sps = 4 amplitude = sig_amp taps = gr.firdes.root_raised_cosine( sps * amplitude, # Gain sps, # Sampling rate 1.0, # Symbol rate excess_bw, # Roll-off factor 11 * sps) # Number of taps blocks = {} blocks["src"] = es.vector_source([1]) blocks["scrambler"] = digital.scrambler_bb(0x8A, 0x7F, 7) blocks["mapper"] = digital.chunks_to_symbols_bc( [-1 + 0j, 0 + 1j, 1 + 0j, 0 - 1j]) blocks["rrc"] = filter.interp_fir_filter_ccf(sps, taps) r.sink = es.vector_sink([gr.sizeof_gr_complex]) r.set_pyb2(blocks) tb = gr.top_block() tb.connect(blocks["src"], blocks["scrambler"], blocks["mapper"], blocks["rrc"], r.sink) r.tb = tb.to_top_block() return r
def key_factory(index): print "FACTORY CALLED index = %d"%(index); r = es.es_pyhandler(); excess_bw = 0.5; sps = 4; amplitude = sig_amp; taps = gr.firdes.root_raised_cosine(sps*amplitude, # Gain sps, # Sampling rate 1.0, # Symbol rate excess_bw, # Roll-off factor 11*sps) # Number of taps blocks = {}; blocks["src"] = es.vector_source([1]) blocks["scrambler"] = digital.scrambler_bb(0x8A, 0x7F, 7); blocks["mapper"] = digital.chunks_to_symbols_bc( [-1+0j, 0+1j, 1+0j, 0-1j] ); blocks["rrc"] = filter.interp_fir_filter_ccf(sps, taps); r.sink = es.vector_sink([gr.sizeof_gr_complex]); r.set_pyb2(blocks); tb = gr.top_block(); tb.connect( blocks["src"], blocks["scrambler"], blocks["mapper"], blocks["rrc"], r.sink ); r.tb = tb.to_top_block(); return r;
def factory_cb(index): print "FACTORY CALLED index = %d"%(index); r = es.es_pyhandler(); src = gr.vector_source_b([10,20,30]); r.sink = es.vector_sink([1]); tb = gr.top_block(); tb.connect(src, r.sink); r.tb = tb.to_top_block(); r.blocks["src"] = src.to_basic_block(); return r;
def factory_cb(index): print "FACTORY CALLED index = %d" % (index) r = es.es_pyhandler() src = gr.vector_source_b([10, 20, 30]) r.sink = es.vector_sink([1]) tb = gr.top_block() tb.connect(src, r.sink) r.tb = tb.to_top_block() r.blocks["src"] = src.to_basic_block() return r
def key_factory(index): print "FACTORY CALLED index = %d"%(index); r = es.es_pyhandler(); src_L = gr.sig_source_f( 48e3, gr.GR_SIN_WAVE, 1440.0, 1.0, 0 ); src_R = gr.sig_source_f( 48e3, gr.GR_SIN_WAVE, 480.0, 1.0, 0 ); head_L = gr.head( gr.sizeof_float, evt_len ); head_R = gr.head( gr.sizeof_float, evt_len ); r.sink = es.vector_sink([gr.sizeof_float, gr.sizeof_float]); tb = gr.top_block(); tb.connect( (src_L,0), (head_L,0), (r.sink,0) ); tb.connect( (src_R,0), (head_R,0), (r.sink,1) ); # store blocks where we can get to them blocks = {}; blocks["src_L"] = src_L; blocks["src_R"] = src_R; blocks["head_L"] = head_L; blocks["head_R"] = head_R; r.set_pyb2(blocks); r.tb = tb.to_top_block(); return r;
# 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 gr-eventstream; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. from gnuradio import gr import es import numpy src = gr.vector_source_b([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) s2v = gr.stream_to_vector(1, 2) sink = es.vector_sink([1, 2]) tb = gr.top_block() tb.connect(src, (sink, 0)) tb.connect(src, s2v, (sink, 1)) tb.run() data = sink.strvec() types = [numpy.byte, numpy.int16] for i in range(0, len(data)): d = data[i] t = types[i] v = numpy.fromstring(d, dtype=t)
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with gr-eventstream; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. from gnuradio import gr; import es; import numpy; src = gr.vector_source_b([0,1,2,3,4,5,6,7,8,9]); s2v = gr.stream_to_vector(1,2); sink = es.vector_sink( [1, 2] ); tb = gr.top_block(); tb.connect(src, (sink,0)); tb.connect(src, s2v, (sink,1)); tb.run(); data = sink.strvec(); types = [ numpy.byte, numpy.int16 ]; for i in range(0, len(data)): d = data[i]; t = types[i];