Example #1
0
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
Example #2
0
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;
#
# gr-eventstream 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 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 = es.vector_source([1, 2])

sink1 = gr.vector_sink_b()
sink2 = gr.vector_sink_s()

tb = gr.top_block()

tb.connect((src, 0), (sink1, 0))
tb.connect((src, 1), (sink2, 0))

tb.run()
print sink1.data()
print sink2.data()

d1 = numpy.arange(0, 30, 3, numpy.byte)
d2 = numpy.arange(0, 20, 2, numpy.int16)
# 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 = es.vector_source( [1,2] );

sink1 = gr.vector_sink_b();
sink2 = gr.vector_sink_s();

tb = gr.top_block();

tb.connect( (src,0), (sink1,0) );
tb.connect( (src,1), (sink2,0) );

tb.run();
print sink1.data();
print sink2.data();

d1 = numpy.arange(0,30,3,numpy.byte);
d2 = numpy.arange(0,20,2,numpy.int16);