diff options
Diffstat (limited to 'gr-digital/examples')
39 files changed, 0 insertions, 10618 deletions
diff --git a/gr-digital/examples/CMakeLists.txt b/gr-digital/examples/CMakeLists.txt deleted file mode 100644 index 63e1eba4e..000000000 --- a/gr-digital/examples/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. - -include(GrPython) - -# Base stuff -GR_PYTHON_INSTALL(PROGRAMS - example_costas.py - example_fll.py - example_timing.py - run_length.py - gen_whitener.py - snr_estimators.py - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR} - COMPONENT "digital_python" -) - -# Narrowband -GR_PYTHON_INSTALL(PROGRAMS - narrowband/transmit_path.py - narrowband/receive_path.py - narrowband/uhd_interface.py - narrowband/benchmark_tx.py - narrowband/benchmark_rx.py - narrowband/tx_voice.py - narrowband/rx_voice.py - narrowband/digital_bert_rx.py - narrowband/digital_bert_tx.py - narrowband/tunnel.py - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/narrowband - COMPONENT "digital_python" -) - -# OFDM -GR_PYTHON_INSTALL(PROGRAMS - ofdm/benchmark_add_channel.py - ofdm/benchmark_rx.py - ofdm/benchmark_tx.py - ofdm/gr_plot_ofdm.py - ofdm/ofdm_mod_demod_test.py - ofdm/receive_path.py - ofdm/transmit_path.py - ofdm/tunnel.py - ofdm/uhd_interface.py - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/ofdm - COMPONENT "digital_python" -) - -# DEMOD -install( - FILES - demod/digital_freq_lock.grc - demod/mpsk_demod.grc - demod/pam_sync.grc - demod/pam_timing.grc - demod/ber_simulation.grc - demod/dpsk_loopback.grc - demod/gfsk_loopback.grc - DESTINATION ${GR_PKG_DIGITAL_EXAMPLES_DIR}/demod - COMPONENT "digital_python" -) diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py deleted file mode 100755 index d58dfbaae..000000000 --- a/gr-digital/examples/berawgn.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env python -""" -BER simulation for QPSK signals, compare to theoretical values. -Change the N_BITS value to simulate more bits per Eb/N0 value, -thus allowing to check for lower BER values. - -Lower values will work faster, higher values will use a lot of RAM. -Also, this app isn't highly optimized--the flow graph is completely -reinstantiated for every Eb/N0 value. -Of course, expect the maximum value for BER to be one order of -magnitude below what you chose for N_BITS. -""" - - -import math -import numpy -from scipy.special import erfc -import pylab -from gnuradio import gr, digital - -# Best to choose powers of 10 -N_BITS = 1e7 -RAND_SEED = 42 - -def berawgn(EbN0): - """ Calculates theoretical bit error rate in AWGN (for BPSK and given Eb/N0) """ - return 0.5 * erfc(math.sqrt(10**(float(EbN0)/10))) - -class BitErrors(gr.hier_block2): - """ Two inputs: true and received bits. We compare them and - add up the number of incorrect bits. Because integrate_ff() - can only add up a certain number of values, the output is - not a scalar, but a sequence of values, the sum of which is - the BER. """ - def __init__(self, bits_per_byte): - gr.hier_block2.__init__(self, "BitErrors", - gr.io_signature(2, 2, gr.sizeof_char), - gr.io_signature(1, 1, gr.sizeof_int)) - - # Bit comparison - comp = gr.xor_bb() - intdump_decim = 100000 - if N_BITS < intdump_decim: - intdump_decim = int(N_BITS) - self.connect(self, - comp, - gr.unpack_k_bits_bb(bits_per_byte), - gr.uchar_to_float(), - gr.integrate_ff(intdump_decim), - gr.multiply_const_ff(1.0/N_BITS), - self) - self.connect((self, 1), (comp, 1)) - -class BERAWGNSimu(gr.top_block): - " This contains the simulation flow graph " - def __init__(self, EbN0): - gr.top_block.__init__(self) - self.const = digital.qpsk_constellation() - # Source is N_BITS bits, non-repeated - data = map(int, numpy.random.randint(0, self.const.arity(), N_BITS/self.const.bits_per_symbol())) - src = gr.vector_source_b(data, False) - mod = gr.chunks_to_symbols_bc((self.const.points()), 1) - add = gr.add_vcc() - noise = gr.noise_source_c(gr.GR_GAUSSIAN, - self.EbN0_to_noise_voltage(EbN0), - RAND_SEED) - demod = digital.constellation_decoder_cb(self.const.base()) - ber = BitErrors(self.const.bits_per_symbol()) - self.sink = gr.vector_sink_f() - self.connect(src, mod, add, demod, ber, self.sink) - self.connect(noise, (add, 1)) - self.connect(src, (ber, 1)) - - def EbN0_to_noise_voltage(self, EbN0): - """ Converts Eb/N0 to a single-sided noise voltage (assuming unit symbol power) """ - return 1.0 / math.sqrt(2.0 * self.const.bits_per_symbol() * 10**(float(EbN0)/10)) - - -def simulate_ber(EbN0): - """ All the work's done here: create flow graph, run, read out BER """ - print "Eb/N0 = %d dB" % EbN0 - fg = BERAWGNSimu(EbN0) - fg.run() - return numpy.sum(fg.sink.data()) - -if __name__ == "__main__": - EbN0_min = 0 - EbN0_max = 15 - EbN0_range = range(EbN0_min, EbN0_max+1) - ber_theory = [berawgn(x) for x in EbN0_range] - print "Simulating..." - ber_simu = [simulate_ber(x) for x in EbN0_range] - - f = pylab.figure() - s = f.add_subplot(1,1,1) - s.semilogy(EbN0_range, ber_theory, 'g-.', label="Theoretical") - s.semilogy(EbN0_range, ber_simu, 'b-o', label="Simulated") - s.set_title('BER Simulation') - s.set_xlabel('Eb/N0 (dB)') - s.set_ylabel('BER') - s.legend() - s.grid() - pylab.show() - diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc deleted file mode 100644 index 9d7b9c946..000000000 --- a/gr-digital/examples/demod/ber_simulation.grc +++ /dev/null @@ -1,698 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 11:20:53 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>ber_simulation</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>BER Simulation</value> - </param> - <param> - <key>author</key> - <value>Example</value> - </param> - <param> - <key>description</key> - <value>Adjust the noise and constellation... see what happens!</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(284, 24)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_add_xx</key> - <param> - <key>id</key> - <value>gr_add_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>num_inputs</key> - <value>2</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(486, 151)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_numbersink2</key> - <param> - <key>id</key> - <value>wxgui_numbersink2</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>BER</value> - </param> - <param> - <key>units</key> - <value>%</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>min_value</key> - <value>0.0</value> - </param> - <param> - <key>max_value</key> - <value>1.0</value> - </param> - <param> - <key>factor</key> - <value>100</value> - </param> - <param> - <key>decimal_places</key> - <value>4</value> - </param> - <param> - <key>ref_level</key> - <value>0</value> - </param> - <param> - <key>number_rate</key> - <value>15</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>show_gauge</key> - <value>False</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>1, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(791, 228)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math</value> - </param> - <param> - <key>_coordinate</key> - <value>(18, 373)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>EbN0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Eb/N0 (dB)</value> - </param> - <param> - <key>value</key> - <value>10</value> - </param> - <param> - <key>min</key> - <value>-10</value> - </param> - <param> - <key>max</key> - <value>200</value> - </param> - <param> - <key>num_steps</key> - <value>211</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(311, 309)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>(digital.constellation_bpsk(), digital.constellation_qpsk(), digital.constellation_8psk())</value> - </param> - <param> - <key>_coordinate</key> - <value>(116, 310)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>const[const_type].arity()</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(17, 125)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_noise_source_x</key> - <param> - <key>id</key> - <value>gr_noise_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>noise_type</key> - <value>gr.GR_GAUSSIAN</value> - </param> - <param> - <key>amp</key> - <value>1.0 / math.sqrt(2.0 * const[const_type].bits_per_symbol() * 10**(EbN0/10))</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 224)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const[const_type].points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(240, 140)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_error_rate</key> - <param> - <key>id</key> - <value>blks2_error_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>'BER'</value> - </param> - <param> - <key>win_size</key> - <value>int(1e7)</value> - </param> - <param> - <key>bits_per_symbol</key> - <value>const[const_type].bits_per_symbol()</value> - </param> - <param> - <key>_coordinate</key> - <value>(720, 25)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_constellation_decoder_cb</key> - <param> - <key>id</key> - <value>digital_constellation_decoder_cb_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>constellation</key> - <value>const[const_type].base()</value> - </param> - <param> - <key>_coordinate</key> - <value>(618, 164)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>"Constellation: "+str(const[const_type].arity()) + "-PSK"</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value>2, 0, 1, 1</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(623, 228)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>100e3</value> - </param> - <param> - <key>_coordinate</key> - <value>(16, 308)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const_type</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(18, 428)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_static_text</key> - <param> - <key>id</key> - <value>variable_static_text_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Constellation Type</value> - </param> - <param> - <key>value</key> - <value>{0: 'BPSK', 1: 'QPSK', 2: '8-PSK'}[const_type] + " - Change const_type for different constellation types!"</value> - </param> - <param> - <key>converver</key> - <value>str_converter</value> - </param> - <param> - <key>formatter</key> - <value>None</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(422, 311)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>blks2_error_rate</source_block_id> - <sink_block_id>wxgui_numbersink2</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle</source_block_id> - <sink_block_id>blks2_error_rate</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_noise_source_x</source_block_id> - <sink_block_id>gr_add_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_throttle</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_constellation_decoder_cb_0</source_block_id> - <sink_block_id>blks2_error_rate</sink_block_id> - <source_key>0</source_key> - <sink_key>1</sink_key> - </connection> - <connection> - <source_block_id>gr_add_xx</source_block_id> - <sink_block_id>digital_constellation_decoder_cb_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc deleted file mode 100644 index 589c651f4..000000000 --- a/gr-digital/examples/demod/digital_freq_lock.grc +++ /dev/null @@ -1,907 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 10:49:20 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>digital_freq_lock</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>256</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(-2, 111)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(456, 134)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(166, -2)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(231, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_fll_band_edge_cc</key> - <param> - <key>id</key> - <value>digital_fll_band_edge_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>cc</value> - </param> - <param> - <key>samps_per_sym</key> - <value>sps</value> - </param> - <param> - <key>rolloff</key> - <value>rolloff</value> - </param> - <param> - <key>filter_size</key> - <value>44</value> - </param> - <param> - <key>w</key> - <value>freq_bw</value> - </param> - <param> - <key>_coordinate</key> - <value>(81, 248)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>FLL Loop Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(80, 382)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(439, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel Noise</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(553, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-0.5</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(673, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise_amp</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_offset</value> - </param> - <param> - <key>epsilon</key> - <value>1.0</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(649, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Signal into Receiver</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(875, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Signal into Receiver</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(875, 108)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Frequency Corrected Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(439, 289)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Frequency Corrected Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(439, 423)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Freq', 'Time']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(114, 521)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_psk_mod</key> - <param> - <key>id</key> - <value>digital_psk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>constellation_points</key> - <value>2</value> - </param> - <param> - <key>mod_code</key> - <value>"gray"</value> - </param> - <param> - <key>differential</key> - <value>False</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>excess_bw</key> - <value>rolloff</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(194, 104)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>digital_psk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_psk_mod_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>digital_fll_band_edge_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/dpsk_loopback.grc b/gr-digital/examples/demod/dpsk_loopback.grc deleted file mode 100644 index c9867bea2..000000000 --- a/gr-digital/examples/demod/dpsk_loopback.grc +++ /dev/null @@ -1,506 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Jul 5 16:26:53 2012</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>dpsk_loopback</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>DPSK Loopback</value> - </param> - <param> - <key>author</key> - <value>GNU Radio</value> - </param> - <param> - <key>description</key> - <value>Encode a signal into a packet, modulate, demodulate, decode and show it's the same data.</value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10000</value> - </param> - <param> - <key>_coordinate</key> - <value>(11, 120)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency (Hz)</value> - </param> - <param> - <key>value</key> - <value>500</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>samp_rate/2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(13, 188)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>1</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(184, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_mod</key> - <param> - <key>id</key> - <value>digital_dxpsk_mod_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dbpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(745, 16)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(358, 39)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_packet_encoder</key> - <param> - <key>id</key> - <value>blks2_packet_encoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>bits_per_symbol</key> - <value>1</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>pad_for_usrp</key> - <value>True</value> - </param> - <param> - <key>payload_length</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(541, 9)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_demod</key> - <param> - <key>id</key> - <value>digital_dxpsk_demod_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dbpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>freq_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>phase_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>timing_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>0.005</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>sync_out</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(746, 135)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>blks2_packet_decoder</key> - <param> - <key>id</key> - <value>blks2_packet_decoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>threshold</key> - <value>-1</value> - </param> - <param> - <key>_coordinate</key> - <value>(545, 187)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>1./freq</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(184, 165)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <connection> - <source_block_id>blks2_packet_decoder_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_encoder_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_mod_1</source_block_id> - <sink_block_id>digital_dxpsk_demod_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_demod_1</source_block_id> - <sink_block_id>blks2_packet_decoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0_0</source_block_id> - <sink_block_id>blks2_packet_encoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/gfsk_loopback.grc b/gr-digital/examples/demod/gfsk_loopback.grc deleted file mode 100644 index f74a83526..000000000 --- a/gr-digital/examples/demod/gfsk_loopback.grc +++ /dev/null @@ -1,646 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Sun Jul 8 16:56:18 2012</timestamp> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency (Hz)</value> - </param> - <param> - <key>value</key> - <value>500</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>samp_rate/2</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(34, 241)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_sig_source_x</key> - <param> - <key>id</key> - <value>gr_sig_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>waveform</key> - <value>gr.GR_COS_WAVE</value> - </param> - <param> - <key>freq</key> - <value>freq</value> - </param> - <param> - <key>amp</key> - <value>1</value> - </param> - <param> - <key>offset</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(215, 26)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(272.5, 142.0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_packet_encoder</key> - <param> - <key>id</key> - <value>blks2_packet_encoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>2</value> - </param> - <param> - <key>bits_per_symbol</key> - <value>1</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>pad_for_usrp</key> - <value>True</value> - </param> - <param> - <key>payload_length</key> - <value>0</value> - </param> - <param> - <key>_coordinate</key> - <value>(261, 227)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>10000</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_gfsk_demod</key> - <param> - <key>id</key> - <value>digital_gfsk_demod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>sensitivity</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>gain_mu</key> - <value>0.175</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>omega_relative_limit</key> - <value>0.005</value> - </param> - <param> - <key>freq_error</key> - <value>0.0</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(669, 257)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>8</value> - </param> - <param> - <key>_coordinate</key> - <value>(47, 445)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_gfsk_mod</key> - <param> - <key>id</key> - <value>digital_gfsk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>sps</value> - </param> - <param> - <key>sensitivity</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>bt</key> - <value>0.35</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(456, 277)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>fm_sensitivity</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(40, 366)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_packet_decoder</key> - <param> - <key>id</key> - <value>blks2_packet_decoder_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>access_code</key> - <value></value> - </param> - <param> - <key>threshold</key> - <value>-1</value> - </param> - <param> - <key>_coordinate</key> - <value>(705, 130)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_quadrature_demod_cf</key> - <param> - <key>id</key> - <value>gr_quadrature_demod_cf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>gain</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(627, 417)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>options</key> - <param> - <key>id</key> - <value>gfsk_loopback</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>1./freq</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(907, 59)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(853, 400)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>digital_gfsk_mod_0</source_block_id> - <sink_block_id>digital_gfsk_demod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_sig_source_x_0</source_block_id> - <sink_block_id>gr_throttle_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0_0</source_block_id> - <sink_block_id>blks2_packet_encoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_encoder_0</source_block_id> - <sink_block_id>digital_gfsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_gfsk_demod_0</source_block_id> - <sink_block_id>blks2_packet_decoder_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_packet_decoder_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_gfsk_mod_0</source_block_id> - <sink_block_id>gr_quadrature_demod_cf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_quadrature_demod_cf_0</source_block_id> - <sink_block_id>wxgui_scopesink2_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/mpsk_demod.grc b/gr-digital/examples/demod/mpsk_demod.grc deleted file mode 100644 index b718fb68a..000000000 --- a/gr-digital/examples/demod/mpsk_demod.grc +++ /dev/null @@ -1,606 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Thu Jul 5 16:28:45 2012</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>mpsk_demod</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>MPSK Demod Demo</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 170)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samps_per_sym</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4</value> - </param> - <param> - <key>_coordinate</key> - <value>(7, 89)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Noise</value> - </param> - <param> - <key>value</key> - <value>.1</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>100</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(259, 353)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_off</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Freq Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-.5</value> - </param> - <param> - <key>max</key> - <value>.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(126, 345)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Constellation', 'Spectrum']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(520, 407)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_constellationsink2</key> - <param> - <key>id</key> - <value>wxgui_constellationsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>Constellation Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>frame_rate</key> - <value>5</value> - </param> - <param> - <key>const_size</key> - <value>2048</value> - </param> - <param> - <key>M</key> - <value>4</value> - </param> - <param> - <key>theta</key> - <value>0</value> - </param> - <param> - <key>loop_bw</key> - <value>6.28/100.0</value> - </param> - <param> - <key>fmax</key> - <value>0.06</value> - </param> - <param> - <key>mu</key> - <value>0.5</value> - </param> - <param> - <key>gain_mu</key> - <value>0.005</value> - </param> - <param> - <key>symbol_rate</key> - <value>samp_rate/4.</value> - </param> - <param> - <key>omega_limit</key> - <value>0.005</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook, 0</value> - </param> - <param> - <key>_coordinate</key> - <value>(824, 212)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>FFT Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>50</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook, 1</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(847, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_off</value> - </param> - <param> - <key>epsilon</key> - <value>1.0</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(487, 282)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(633, 82)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>2**8</value> - </param> - <param> - <key>num_samps</key> - <value>10000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(161, 119)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_dxpsk_mod</key> - <param> - <key>id</key> - <value>digital_dxpsk_mod_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>dqpsk</value> - </param> - <param> - <key>samples_per_symbol</key> - <value>samps_per_sym</value> - </param> - <param> - <key>excess_bw</key> - <value>0.35</value> - </param> - <param> - <key>gray_coded</key> - <value>True</value> - </param> - <param> - <key>verbose</key> - <value>False</value> - </param> - <param> - <key>log</key> - <value>False</value> - </param> - <param> - <key>_coordinate</key> - <value>(361, 119)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>wxgui_constellationsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_dxpsk_mod_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x_0</source_block_id> - <sink_block_id>digital_dxpsk_mod_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc deleted file mode 100644 index 7bc071d11..000000000 --- a/gr-digital/examples/demod/pam_sync.grc +++ /dev/null @@ -1,1431 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 10:47:40 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>pam_sync</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>digital.qpsk_constellation()</value> - </param> - <param> - <key>_coordinate</key> - <value>(336, -2)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_sink</key> - <param> - <key>id</key> - <value>virtual_sink_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>input_signal_probe</value> - </param> - <param> - <key>_coordinate</key> - <value>(330, 183)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_pfb_clock_sync_xxx</key> - <param> - <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccf</value> - </param> - <param> - <key>sps</key> - <value>spb</value> - </param> - <param> - <key>alpha</key> - <value>time_alpha</value> - </param> - <param> - <key>beta</key> - <value>time_beta</value> - </param> - <param> - <key>taps</key> - <value>rrctaps</value> - </param> - <param> - <key>filter_size</key> - <value>nfilts</value> - </param> - <param> - <key>init_phase</key> - <value>16</value> - </param> - <param> - <key>max_dev</key> - <value>1.5</value> - </param> - <param> - <key>osps</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 241)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_fll_band_edge_cc</key> - <param> - <key>id</key> - <value>digital_fll_band_edge_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>cc</value> - </param> - <param> - <key>samps_per_sym</key> - <value>spb</value> - </param> - <param> - <key>rolloff</key> - <value>rolloff</value> - </param> - <param> - <key>filter_size</key> - <value>44</value> - </param> - <param> - <key>w</key> - <value>freq_bw</value> - </param> - <param> - <key>_coordinate</key> - <value>(331, 239)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>128000</value> - </param> - <param> - <key>_coordinate</key> - <value>(193, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>const.arity()</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(0, 72)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise_amp</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_offset</value> - </param> - <param> - <key>epsilon</key> - <value>interpratio</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(46, 183)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(857, 95)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>virtual_source</key> - <param> - <key>id</key> - <value>virtual_source_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>stream_id</key> - <value>input_signal_probe</value> - </param> - <param> - <key>_coordinate</key> - <value>(835, 562)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Pre-sync Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>.5</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(1081, 439)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Received spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(1081, 563)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_fftsink2</key> - <param> - <key>id</key> - <value>wxgui_fftsink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Post-sync spectrum</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>baseband_freq</key> - <value>0</value> - </param> - <param> - <key>y_per_div</key> - <value>10</value> - </param> - <param> - <key>y_divs</key> - <value>10</value> - </param> - <param> - <key>ref_level</key> - <value>10</value> - </param> - <param> - <key>ref_scale</key> - <value>2.0</value> - </param> - <param> - <key>fft_size</key> - <value>1024</value> - </param> - <param> - <key>fft_rate</key> - <value>30</value> - </param> - <param> - <key>peak_hold</key> - <value>False</value> - </param> - <param> - <key>average</key> - <value>False</value> - </param> - <param> - <key>avg_alpha</key> - <value>0</value> - </param> - <param> - <key>win</key> - <value>None</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>freqvar</key> - <value>None</value> - </param> - <param> - <key>_coordinate</key> - <value>(347, 516)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Post-sync Signal</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>True</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(1085, 213)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>FLL Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.05</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(4,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(341, 373)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>time_alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Alpha</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(5,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(598, 388)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>time_beta</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Beta</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(6,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(708, 388)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>phase_bw</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Costas Loop (Phase) Bandwidth</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(7,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(866, 313)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['Synched Signal', 'Received Signal']</value> - </param> - <param> - <key>grid_pos</key> - <value>(1,1,8,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 601)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>interpratio</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Offset</value> - </param> - <param> - <key>value</key> - <value>1.00</value> - </param> - <param> - <key>min</key> - <value>0.99</value> - </param> - <param> - <key>max</key> - <value>1.01</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(3,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(60, 407)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>sig_amp</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(659, 95)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const.points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(178, 87)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(513, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>0.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(578, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rrctaps</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(nfilts*spb), rolloff, int(11*spb*nfilts))</value> - </param> - <param> - <key>_coordinate</key> - <value>(660, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sig_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1.0</value> - </param> - <param> - <key>_coordinate</key> - <value>(887, -1)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>nfilts</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(816, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>rate</key> - <value>spb</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(nfilts, 1.0, 1.0/nfilts, rolloff, int(11*spb*nfilts))</value> - </param> - <param> - <key>size</key> - <value>nfilts</value> - </param> - <param> - <key>_coordinate</key> - <value>(411, 80)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-0.5</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(2,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 285)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel Noise</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value>(1,2,1,1)</value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(129, 285)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>digital_costas_loop_cc</key> - <param> - <key>id</key> - <value>digital_costas_loop_cc_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>w</key> - <value>phase_bw</value> - </param> - <param> - <key>order</key> - <value>const.arity()</value> - </param> - <param> - <key>_coordinate</key> - <value>(866, 246)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>virtual_sink_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>digital_costas_loop_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_costas_loop_cc_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>digital_fll_band_edge_cc_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>digital_fll_band_edge_cc_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>wxgui_fftsink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>virtual_source_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc deleted file mode 100644 index af14191eb..000000000 --- a/gr-digital/examples/demod/pam_timing.grc +++ /dev/null @@ -1,1240 +0,0 @@ -<?xml version='1.0' encoding='ASCII'?> -<flow_graph> - <timestamp>Mon Jan 14 11:00:42 2013</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>pam_timing</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value></value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>1280, 1024</value> - </param> - <param> - <key>generate_options</key> - <value>wx_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run_options</key> - <value>prompt</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>max_nouts</key> - <value>0</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>beta</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Beta</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0.0</value> - </param> - <param> - <key>max</key> - <value>0.1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(668, 5)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>alpha</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Alpha</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(552, 4)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>random_source_x</key> - <param> - <key>id</key> - <value>random_source_x</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>byte</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>const.arity()</value> - </param> - <param> - <key>num_samps</key> - <value>10000000</value> - </param> - <param> - <key>repeat</key> - <value>True</value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 163)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_chunks_to_symbols_xx</key> - <param> - <key>id</key> - <value>gr_chunks_to_symbols_xx</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>in_type</key> - <value>byte</value> - </param> - <param> - <key>out_type</key> - <value>complex</value> - </param> - <param> - <key>symbol_table</key> - <value>const.points()</value> - </param> - <param> - <key>dimension</key> - <value>1</value> - </param> - <param> - <key>num_ports</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(203, 178)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_multiply_const_vxx</key> - <param> - <key>id</key> - <value>gr_multiply_const_vxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>const</key> - <value>sig_amp</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(651, 186)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_channel_model</key> - <param> - <key>id</key> - <value>gr_channel_model_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>noise_voltage</key> - <value>noise_amp</value> - </param> - <param> - <key>freq_offset</key> - <value>freq_offset</value> - </param> - <param> - <key>epsilon</key> - <value>interpratio</value> - </param> - <param> - <key>taps</key> - <value>1.0</value> - </param> - <param> - <key>seed</key> - <value>42</value> - </param> - <param> - <key>_coordinate</key> - <value>(73, 354)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_throttle</key> - <param> - <key>id</key> - <value>gr_throttle_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>samples_per_second</key> - <value>samp_rate</value> - </param> - <param> - <key>vlen</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(274, 384)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>sig_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(662, 128)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>interpratio</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Timing Offset</value> - </param> - <param> - <key>value</key> - <value>1.00</value> - </param> - <param> - <key>min</key> - <value>0.99</value> - </param> - <param> - <key>max</key> - <value>1.01</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 465)</value> - </param> - <param> - <key>_rotation</key> - <value>180</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>noise_amp</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Channel Noise</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>0</value> - </param> - <param> - <key>max</key> - <value>1.0</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(114, 465)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable_slider</key> - <param> - <key>id</key> - <value>freq_offset</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>label</key> - <value>Frequency Offset</value> - </param> - <param> - <key>value</key> - <value>0</value> - </param> - <param> - <key>min</key> - <value>-0.5</value> - </param> - <param> - <key>max</key> - <value>0.5</value> - </param> - <param> - <key>num_steps</key> - <value>1000</value> - </param> - <param> - <key>style</key> - <value>wx.SL_HORIZONTAL</value> - </param> - <param> - <key>converver</key> - <value>float_converter</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(236, 465)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>samp_rate</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32000</value> - </param> - <param> - <key>_coordinate</key> - <value>(282, 324)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>const</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>digital.qpsk_constellation()</value> - </param> - <param> - <key>_coordinate</key> - <value>(206, 116)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>from gnuradio import digital</value> - </param> - <param> - <key>_coordinate</key> - <value>(-1, 61)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>rolloff</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>.35</value> - </param> - <param> - <key>_coordinate</key> - <value>(459, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>nfilts</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>32</value> - </param> - <param> - <key>_coordinate</key> - <value>(539, 262)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>gr_pfb_clock_sync_xxx</key> - <param> - <key>id</key> - <value>gr_pfb_clock_sync_xxx_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>ccf</value> - </param> - <param> - <key>sps</key> - <value>spb</value> - </param> - <param> - <key>alpha</key> - <value>alpha</value> - </param> - <param> - <key>beta</key> - <value>beta</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(nfilts, nfilts*spb, 1.0, rolloff, 44*nfilts)</value> - </param> - <param> - <key>filter_size</key> - <value>nfilts</value> - </param> - <param> - <key>init_phase</key> - <value>16</value> - </param> - <param> - <key>max_dev</key> - <value>1.5</value> - </param> - <param> - <key>osps</key> - <value>1</value> - </param> - <param> - <key>_coordinate</key> - <value>(444, 331)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>blks2_pfb_arb_resampler_ccf</key> - <param> - <key>id</key> - <value>blks2_pfb_arb_resampler_ccf_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>rate</key> - <value>spb</value> - </param> - <param> - <key>taps</key> - <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value> - </param> - <param> - <key>size</key> - <value>nfilts</value> - </param> - <param> - <key>_coordinate</key> - <value>(438, 171)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_1</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Error</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>.5</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,3</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(826, 112)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>complex</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>0</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(829, 266)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>1.25</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,2</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(824, 485)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Error</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>3</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,0</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(829, 358)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>wxgui_scopesink2</key> - <param> - <key>id</key> - <value>wxgui_scopesink2_0_0_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>type</key> - <value>float</value> - </param> - <param> - <key>title</key> - <value>Scope Plot</value> - </param> - <param> - <key>samp_rate</key> - <value>samp_rate</value> - </param> - <param> - <key>v_scale</key> - <value>9</value> - </param> - <param> - <key>v_offset</key> - <value>0</value> - </param> - <param> - <key>t_scale</key> - <value>0</value> - </param> - <param> - <key>ac_couple</key> - <value>False</value> - </param> - <param> - <key>xy_mode</key> - <value>False</value> - </param> - <param> - <key>num_inputs</key> - <value>1</value> - </param> - <param> - <key>win_size</key> - <value></value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value>notebook_0,1</value> - </param> - <param> - <key>trig_mode</key> - <value>gr.gr_TRIG_MODE_AUTO</value> - </param> - <param> - <key>y_axis_label</key> - <value>Counts</value> - </param> - <param> - <key>_coordinate</key> - <value>(754, 607)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>notebook</key> - <param> - <key>id</key> - <value>notebook_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>style</key> - <value>wx.NB_TOP</value> - </param> - <param> - <key>labels</key> - <value>['error', 'phase', 'freq', 'Resampled Signal']</value> - </param> - <param> - <key>grid_pos</key> - <value></value> - </param> - <param> - <key>notebook</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(380, 511)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> - <key>variable</key> - <param> - <key>id</key> - <value>spb</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>value</key> - <value>4.2563</value> - </param> - <param> - <key>_coordinate</key> - <value>(300, 0)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <connection> - <source_block_id>gr_channel_model_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_throttle_0</source_block_id> - <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id> - <source_key>2</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> - <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_multiply_const_vxx_0</source_block_id> - <sink_block_id>gr_channel_model_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_chunks_to_symbols_xx</source_block_id> - <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>random_source_x</source_block_id> - <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id> - <source_key>3</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> - <source_key>1</source_key> - <sink_key>0</sink_key> - </connection> - <connection> - <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id> - <sink_block_id>wxgui_scopesink2_0</sink_block_id> - <source_key>0</source_key> - <sink_key>0</sink_key> - </connection> -</flow_graph> diff --git a/gr-digital/examples/example_costas.py b/gr-digital/examples/example_costas.py deleted file mode 100755 index aef0196cc..000000000 --- a/gr-digital/examples/example_costas.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import scipy -except ImportError: - print "Error: could not import scipy (http://www.scipy.org/)" - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: could not import pylab (http://matplotlib.sourceforge.net/)" - sys.exit(1) - -class example_costas(gr.top_block): - def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset): - gr.top_block.__init__(self) - - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - data = 2.0*scipy.random.randint(0, 2, N) - 1.0 - data = scipy.exp(1j*poffset) * data - - self.src = gr.vector_source_c(data.tolist(), False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - self.chn = gr.channel_model(noise, foffset, toffset) - self.cst = digital.costas_loop_cc(bw, 2) - - self.vsnk_src = gr.vector_sink_c() - self.vsnk_cst = gr.vector_sink_c() - self.vsnk_frq = gr.vector_sink_f() - - self.connect(self.src, self.rrc, self.chn, self.cst, self.vsnk_cst) - self.connect(self.rrc, self.vsnk_src) - self.connect((self.cst,1), self.vsnk_frq) - -def main(): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=2000, - help="Set the number of samples to process [default=%default]") - parser.add_option("-S", "--sps", type="int", default=4, - help="Set the samples per symbol [default=%default]") - parser.add_option("-r", "--rolloff", type="eng_float", default=0.35, - help="Set the rolloff factor [default=%default]") - parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0, - help="Set the loop bandwidth [default=%default]") - parser.add_option("-n", "--ntaps", type="int", default=45, - help="Set the number of taps in the filters [default=%default]") - parser.add_option("", "--noise", type="eng_float", default=0.0, - help="Set the simulation noise voltage [default=%default]") - parser.add_option("-f", "--foffset", type="eng_float", default=0.0, - help="Set the simulation's normalized frequency offset (in Hz) [default=%default]") - parser.add_option("-t", "--toffset", type="eng_float", default=1.0, - help="Set the simulation's timing offset [default=%default]") - parser.add_option("-p", "--poffset", type="eng_float", default=0.707, - help="Set the simulation's phase offset [default=%default]") - (options, args) = parser.parse_args () - - # Adjust N for the interpolation by sps - options.nsamples = options.nsamples // options.sps - - # Set up the program-under-test - put = example_costas(options.nsamples, options.sps, options.rolloff, - options.ntaps, options.bandwidth, options.noise, - options.foffset, options.toffset, options.poffset) - put.run() - - data_src = scipy.array(put.vsnk_src.data()) - - # Convert the FLL's LO frequency from rads/sec to Hz - data_frq = scipy.array(put.vsnk_frq.data()) / (2.0*scipy.pi) - - # adjust this to align with the data. - data_cst = scipy.array(3*[0,]+list(put.vsnk_cst.data())) - - # Plot the Costas loop's LO frequency - f1 = pylab.figure(1, figsize=(12,10), facecolor='w') - s1 = f1.add_subplot(2,2,1) - s1.plot(data_frq) - s1.set_title("Costas LO") - s1.set_xlabel("Samples") - s1.set_ylabel("Frequency (normalized Hz)") - - # Plot the IQ symbols - s3 = f1.add_subplot(2,2,2) - s3.plot(data_src.real, data_src.imag, "o") - s3.plot(data_cst.real, data_cst.imag, "rx") - s3.set_title("IQ") - s3.set_xlabel("Real part") - s3.set_ylabel("Imag part") - s3.set_xlim([-2, 2]) - s3.set_ylim([-2, 2]) - - # Plot the symbols in time - s4 = f1.add_subplot(2,2,3) - s4.set_position([0.125, 0.05, 0.775, 0.4]) - s4.plot(data_src.real, "o-") - s4.plot(data_cst.real, "rx-") - s4.set_title("Symbols") - s4.set_xlabel("Samples") - s4.set_ylabel("Real Part of Signals") - - pylab.show() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/example_fll.py b/gr-digital/examples/example_fll.py deleted file mode 100755 index 3b75b5a75..000000000 --- a/gr-digital/examples/example_fll.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import scipy -except ImportError: - print "Error: could not import scipy (http://www.scipy.org/)" - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: could not import pylab (http://matplotlib.sourceforge.net/)" - sys.exit(1) - -class example_fll(gr.top_block): - def __init__(self, N, sps, rolloff, ntaps, bw, noise, foffset, toffset, poffset): - gr.top_block.__init__(self) - - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - data = 2.0*scipy.random.randint(0, 2, N) - 1.0 - data = scipy.exp(1j*poffset) * data - - self.src = gr.vector_source_c(data.tolist(), False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - self.chn = gr.channel_model(noise, foffset, toffset) - self.fll = digital.fll_band_edge_cc(sps, rolloff, ntaps, bw) - - self.vsnk_src = gr.vector_sink_c() - self.vsnk_fll = gr.vector_sink_c() - self.vsnk_frq = gr.vector_sink_f() - self.vsnk_phs = gr.vector_sink_f() - self.vsnk_err = gr.vector_sink_f() - - self.connect(self.src, self.rrc, self.chn, self.fll, self.vsnk_fll) - self.connect(self.rrc, self.vsnk_src) - self.connect((self.fll,1), self.vsnk_frq) - self.connect((self.fll,2), self.vsnk_phs) - self.connect((self.fll,3), self.vsnk_err) - -def main(): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=2000, - help="Set the number of samples to process [default=%default]") - parser.add_option("-S", "--sps", type="int", default=4, - help="Set the samples per symbol [default=%default]") - parser.add_option("-r", "--rolloff", type="eng_float", default=0.35, - help="Set the rolloff factor [default=%default]") - parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0, - help="Set the loop bandwidth [default=%default]") - parser.add_option("-n", "--ntaps", type="int", default=45, - help="Set the number of taps in the filters [default=%default]") - parser.add_option("", "--noise", type="eng_float", default=0.0, - help="Set the simulation noise voltage [default=%default]") - parser.add_option("-f", "--foffset", type="eng_float", default=0.2, - help="Set the simulation's normalized frequency offset (in Hz) [default=%default]") - parser.add_option("-t", "--toffset", type="eng_float", default=1.0, - help="Set the simulation's timing offset [default=%default]") - parser.add_option("-p", "--poffset", type="eng_float", default=0.0, - help="Set the simulation's phase offset [default=%default]") - (options, args) = parser.parse_args () - - # Adjust N for the interpolation by sps - options.nsamples = options.nsamples // options.sps - - # Set up the program-under-test - put = example_fll(options.nsamples, options.sps, options.rolloff, - options.ntaps, options.bandwidth, options.noise, - options.foffset, options.toffset, options.poffset) - put.run() - - data_src = scipy.array(put.vsnk_src.data()) - data_err = scipy.array(put.vsnk_err.data()) - - # Convert the FLL's LO frequency from rads/sec to Hz - data_frq = scipy.array(put.vsnk_frq.data()) / (2.0*scipy.pi) - - # adjust this to align with the data. There are 2 filters of - # ntaps long and the channel introduces another 4 sample delay. - data_fll = scipy.array(put.vsnk_fll.data()[2*options.ntaps-4:]) - - # Plot the FLL's LO frequency - f1 = pylab.figure(1, figsize=(12,10)) - s1 = f1.add_subplot(2,2,1) - s1.plot(data_frq) - s1.set_title("FLL LO") - s1.set_xlabel("Samples") - s1.set_ylabel("Frequency (normalized Hz)") - - # Plot the FLL's error - s2 = f1.add_subplot(2,2,2) - s2.plot(data_err) - s2.set_title("FLL Error") - s2.set_xlabel("Samples") - s2.set_ylabel("FLL Loop error") - - # Plot the IQ symbols - s3 = f1.add_subplot(2,2,3) - s3.plot(data_src.real, data_src.imag, "o") - s3.plot(data_fll.real, data_fll.imag, "rx") - s3.set_title("IQ") - s3.set_xlabel("Real part") - s3.set_ylabel("Imag part") - - # Plot the symbols in time - s4 = f1.add_subplot(2,2,4) - s4.plot(data_src.real, "o-") - s4.plot(data_fll.real, "rx-") - s4.set_title("Symbols") - s4.set_xlabel("Samples") - s4.set_ylabel("Real Part of Signals") - - pylab.show() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py deleted file mode 100755 index fd86acfb1..000000000 --- a/gr-digital/examples/example_timing.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -try: - import scipy -except ImportError: - print "Error: could not import scipy (http://www.scipy.org/)" - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: could not import pylab (http://matplotlib.sourceforge.net/)" - sys.exit(1) - -from scipy import fftpack - -class example_timing(gr.top_block): - def __init__(self, N, sps, rolloff, ntaps, bw, noise, - foffset, toffset, poffset, mode=0): - gr.top_block.__init__(self) - - rrc_taps = gr.firdes.root_raised_cosine( - sps, sps, 1.0, rolloff, ntaps) - - gain = 2*scipy.pi/100.0 - nfilts = 32 - rrc_taps_rx = gr.firdes.root_raised_cosine( - nfilts, sps*nfilts, 1.0, rolloff, ntaps*nfilts) - - data = 2.0*scipy.random.randint(0, 2, N) - 1.0 - data = scipy.exp(1j*poffset) * data - - self.src = gr.vector_source_c(data.tolist(), False) - self.rrc = gr.interp_fir_filter_ccf(sps, rrc_taps) - self.chn = gr.channel_model(noise, foffset, toffset) - self.off = gr.fractional_interpolator_cc(0.20, 1.0) - - if mode == 0: - self.clk = gr.pfb_clock_sync_ccf(sps, gain, rrc_taps_rx, - nfilts, nfilts//2, 3.5) - self.taps = self.clk.get_taps() - self.dtaps = self.clk.get_diff_taps() - - self.vsnk_err = gr.vector_sink_f() - self.vsnk_rat = gr.vector_sink_f() - self.vsnk_phs = gr.vector_sink_f() - - self.connect((self.clk,1), self.vsnk_err) - self.connect((self.clk,2), self.vsnk_rat) - self.connect((self.clk,3), self.vsnk_phs) - - else: # mode == 1 - mu = 0.5 - gain_mu = 0.1 - gain_omega = 0.25*gain_mu*gain_mu - omega_rel_lim = 0.02 - self.clk = digital.clock_recovery_mm_cc(sps, gain_omega, - mu, gain_mu, - omega_rel_lim) - - self.vsnk_err = gr.vector_sink_f() - - self.connect((self.clk,1), self.vsnk_err) - - self.vsnk_src = gr.vector_sink_c() - self.vsnk_clk = gr.vector_sink_c() - - self.connect(self.src, self.rrc, self.chn, self.off, self.clk, self.vsnk_clk) - self.connect(self.off, self.vsnk_src) - - -def main(): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=2000, - help="Set the number of samples to process [default=%default]") - parser.add_option("-S", "--sps", type="int", default=4, - help="Set the samples per symbol [default=%default]") - parser.add_option("-r", "--rolloff", type="eng_float", default=0.35, - help="Set the rolloff factor [default=%default]") - parser.add_option("-W", "--bandwidth", type="eng_float", default=2*scipy.pi/100.0, - help="Set the loop bandwidth [default=%default]") - parser.add_option("-n", "--ntaps", type="int", default=45, - help="Set the number of taps in the filters [default=%default]") - parser.add_option("", "--noise", type="eng_float", default=0.0, - help="Set the simulation noise voltage [default=%default]") - parser.add_option("-f", "--foffset", type="eng_float", default=0.0, - help="Set the simulation's normalized frequency offset (in Hz) [default=%default]") - parser.add_option("-t", "--toffset", type="eng_float", default=1.0, - help="Set the simulation's timing offset [default=%default]") - parser.add_option("-p", "--poffset", type="eng_float", default=0.0, - help="Set the simulation's phase offset [default=%default]") - parser.add_option("-M", "--mode", type="int", default=0, - help="Set the recovery mode (0: polyphase, 1: M&M) [default=%default]") - (options, args) = parser.parse_args () - - # Adjust N for the interpolation by sps - options.nsamples = options.nsamples // options.sps - - # Set up the program-under-test - put = example_timing(options.nsamples, options.sps, options.rolloff, - options.ntaps, options.bandwidth, options.noise, - options.foffset, options.toffset, options.poffset, - options.mode) - put.run() - - if options.mode == 0: - data_src = scipy.array(put.vsnk_src.data()[20:]) - data_clk = scipy.array(put.vsnk_clk.data()[20:]) - - data_err = scipy.array(put.vsnk_err.data()[20:]) - data_rat = scipy.array(put.vsnk_rat.data()[20:]) - data_phs = scipy.array(put.vsnk_phs.data()[20:]) - - f1 = pylab.figure(1, figsize=(12,10), facecolor='w') - - # Plot the IQ symbols - s1 = f1.add_subplot(2,2,1) - s1.plot(data_src.real, data_src.imag, "bo") - s1.plot(data_clk.real, data_clk.imag, "ro") - s1.set_title("IQ") - s1.set_xlabel("Real part") - s1.set_ylabel("Imag part") - s1.set_xlim([-2, 2]) - s1.set_ylim([-2, 2]) - - # Plot the symbols in time - s2 = f1.add_subplot(2,2,2) - s2.plot(data_src.real, "bo-") - s2.plot(data_clk.real, "ro") - s2.set_title("Symbols") - s2.set_xlabel("Samples") - s2.set_ylabel("Real Part of Signals") - - # Plot the clock recovery loop's error - s3 = f1.add_subplot(2,2,3) - s3.plot(data_err) - s3.set_title("Clock Recovery Loop Error") - s3.set_xlabel("Samples") - s3.set_ylabel("Error") - - # Plot the clock recovery loop's error - s4 = f1.add_subplot(2,2,4) - s4.plot(data_phs) - s4.set_title("Clock Recovery Loop Filter Phase") - s4.set_xlabel("Samples") - s4.set_ylabel("Filter Phase") - - - diff_taps = put.dtaps - ntaps = len(diff_taps[0]) - nfilts = len(diff_taps) - t = scipy.arange(0, ntaps*nfilts) - - f3 = pylab.figure(3, figsize=(12,10), facecolor='w') - s31 = f3.add_subplot(2,1,1) - s32 = f3.add_subplot(2,1,2) - s31.set_title("Differential Filters") - s32.set_title("FFT of Differential Filters") - - for i,d in enumerate(diff_taps): - D = 20.0*scipy.log10(abs(fftpack.fftshift(fftpack.fft(d, 10000)))) - s31.plot(t[i::nfilts].real, d, "-o") - s32.plot(D) - - # If testing the M&M clock recovery loop - else: - data_src = scipy.array(put.vsnk_src.data()[20:]) - data_clk = scipy.array(put.vsnk_clk.data()[20:]) - - data_err = scipy.array(put.vsnk_err.data()[20:]) - - f1 = pylab.figure(1, figsize=(12,10), facecolor='w') - - # Plot the IQ symbols - s1 = f1.add_subplot(2,2,1) - s1.plot(data_src.real, data_src.imag, "o") - s1.plot(data_clk.real, data_clk.imag, "ro") - s1.set_title("IQ") - s1.set_xlabel("Real part") - s1.set_ylabel("Imag part") - s1.set_xlim([-2, 2]) - s1.set_ylim([-2, 2]) - - # Plot the symbols in time - s2 = f1.add_subplot(2,2,2) - s2.plot(data_src.real, "o-") - s2.plot(data_clk.real, "ro") - s2.set_title("Symbols") - s2.set_xlabel("Samples") - s2.set_ylabel("Real Part of Signals") - - # Plot the clock recovery loop's error - s3 = f1.add_subplot(2,2,3) - s3.plot(data_err) - s3.set_title("Clock Recovery Loop Error") - s3.set_xlabel("Samples") - s3.set_ylabel("Error") - - pylab.show() - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/gen_whitener.py b/gr-digital/examples/gen_whitener.py deleted file mode 100755 index 9a81e4eaa..000000000 --- a/gr-digital/examples/gen_whitener.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python - -from gnuradio import gr, gru -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -class my_graph(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - src = gr.lfsr_32k_source_s() - head = gr.head(gr.sizeof_short, 2048) - self.dst = gr.vector_sink_s() - self.connect(src, head, self.dst) - -if __name__ == '__main__': - try: - tb = my_graph() - tb.run() - f = sys.stdout - i = 0 - for s in tb.dst.data(): - f.write("%3d, " % (s & 0xff,)) - f.write("%3d, " % ((s >> 8) & 0xff,)) - i = i+2 - if i % 16 == 0: - f.write('\n') - - except KeyboardInterrupt: - pass - - diff --git a/gr-digital/examples/narrowband/README b/gr-digital/examples/narrowband/README deleted file mode 100644 index 1c50ad69b..000000000 --- a/gr-digital/examples/narrowband/README +++ /dev/null @@ -1,153 +0,0 @@ -Quick overview of what's here: - -* benchmark_tx.py: generates packets of the size you -specify and sends them across the air using the USRP. Known to work -well using the USRP with the RFX transceiver daughterboards. -You can specify the bitrate to use with the -r <bitrate> command line -parameter. The default is 500k. Some machines will do 1M or more. -You can select the modulation to use with the -m <modulation> command -line argument. The legal values for <modulation> are gmsk, dbpsk and dqpsk. - -* benchmark_rx.py: the receiver half of benchmark_tx.py. -Command line arguments are pretty much the same as rx. Works well -with a USRP and RFX transceiver daughterboards. Will also work -with TVRX daugherboard, but you'll need to fiddle with the gain. See -below. Prints a summary of each packet received and keeps a running -total of packets received, and how many of them were error free. -There are two levels of error reporting going on. If the access code -(PN code) and header of a packet were properly detected, then you'll -get an output line. If the CRC32 of the payload was correct you get -"ok = True", else "ok = False". The "pktno" is extracted from the -received packet. If there are skipped numbers, you're missing some -packets. Be sure you've got a suitable antenna connected to the TX/RX -port on each board. For the RFX-400, "70 cm" / 420 MHz antennas for ham -handi-talkies work great. These are available at ham radio supplies, -etc. The boards need to be at least 3m apart. You can also try -experimenting with the rx gain (-g <gain> command line option). - -Generally speaking, I start the rx first on one machine, and then fire -up the tx on the other machine. The tx also supports a discontinous -transmission mode where it sends bursts of 5 packets and then waits 1 -second. This is useful for ensuring that all the receiver control -loops lock up fast enough. - -* tunnel.py: This program provides a framework for building your own -MACs. It creates a "TAP" interface in the kernel, typically gr0, -and sends and receives ethernet frames through it. See -/usr/src/linux/Documentation/networking/tuntap.txt and/or Google for -"universal tun tap". The Linux 2.6 kernel includes the tun module, you -don't have to build it. You may have to "modprobe tun" if it's not -loaded by default. If /dev/net/tun doesn't exist, try "modprobe tun". - -To run this program you'll need to be root or running with the -appropriate capability to open the tun interface. You'll need to fire -up two copies on different machines. Once each is running you'll need -to ifconfig the gr0 interface to set the IP address. - -This will allow two machines to talk, but anything beyond the two -machines depends on your networking setup. Left as an exercise... - -On machine A: - - $ su - # ./tunnel.py --freq 423.0M --bitrate 500k - # # in another window on A, also as root... - # ifconfig gr0 192.168.200.1 - - -On machine B: - - $ su - # ./tunnel.py --freq 423.0M --bitrate 500k - # # in another window on B, also as root... - # ifconfig gr0 192.168.200.2 - -Now, on machine A you shold be able to ping machine B: - - $ ping 192.168.200.2 - -and you should see some output for each packet in the -tunnel.py window if you used the -v option. - -Likewise, on machine B: - - $ ping 192.168.200.1 - -This now uses a carrier sense MAC, so you should be able to ssh -between the machines, web browse, etc. - -* run_length.py: This program takes a single argument '-f FILE' and -outputs the number of runs of similar bits within the file. It is -useful as a diagnostic tool when experimenting with line coding or -whitening algorithms. - - - -********************************************************************** -********************************************************************** - - -BERT testing example scripts - -benchmark_tx.py - -This sets up a BPSK transmitter that is modulated with a pseudorandom -sequence of bits. The PN code is generated by sending an all 1s -sequence through a 7-bit scrambler. The transmitter performs the BPSK -modulation, then passes the complex baseband waveform through a -root-raised-cosine filter and onto the USRP. - -The --sps parameter controls how many baseband samples per symbol -are created and passed through the RRC filter, prior to going to the -USRP over the USB for interpolation to the final DAC rate. - -The baseband bit rate is controlled by -r or --rate. This value, when -multiplied by the --sps parameter, must result in valid interpolation -rate for the USRP. For example, if the baseband rate is 250k bits/sec, -and the samples per symbol is 4, then the final rate is 1M samples/sec, -which results in an interpolation rate of 128. The valid interpolation -rates for the USRP are multiples of 4 between 16 and 512. - -Finally, the RRC excess bandwidth may be specified by --excess-bw. -(See ./benchmark_tx.py -h for additional parameters.) - - -benchmark_rx.py - -This sets up a BPSK receiver to demodulate the received waveform. It -accepts a similar set of parameters as the transmitter, except that one -specifies the USRP decimation rate desired. The resulting sample stream -rate must be an integral number of baseband symbols. For example, the -parameters corresponding to the above transmitter would be to use a -decimation rate of 8 (32 sps), 16 (16 sps), 32 (8 sps), 64, (4 sps), or -128 (2 sps). The lower the USRP decimation, the more CPU is required to -demodulate the signal, so not all valid decimation rates will work. - -The baseband signal from the USRP is first passed through an AGC to -establish an average power of 1.0. It is then passed through a matched -filter (another RRC), a Costas phase-locked loop, and a Mueller and -Muller bit timing recovery loop. The resulting constellation has an SNR -estimation probe attached, and is then sliced into a bit stream. - -The recovered bits are then passed through a 7-bit descrambler. If -there are no channel errors, the all 1s sequence is recovered. In the -event of a channel error, there will be a 0 in the bit stream for each -feedback tap in the descrambler. In this case, the CCSDS descrambler is -using 3 feedback taps. - -Finally, the signal is passed into a bit density measurement probe. The -channel BER is measured by dividing the 0s density by three. This -measurement is inaccurate at high BER rates (>10%) as the error 0s -begin to overlap. - -The benchmark script will, once per second, output the Costas loop -frequency offset, the recovered timing error, the estimated SNR, and the -average BER. - -NOTE: The particular SNR estimator used is inaccurate below about 7dB, -and will report erroneously high values even for random noise. - -There are a variety of Costas and M&M loop parameters one can adjust. -See ./benchmark_rx.py -h for the full set. - - diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py deleted file mode 100755 index c69ee60b0..000000000 --- a/gr-digital/examples/narrowband/benchmark_add_channel.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, math, sys - -class my_top_block(gr.top_block): - def __init__(self, ifile, ofile, options): - gr.top_block.__init__(self) - - SNR = 10.0**(options.snr/10.0) - frequency_offset = options.frequency_offset - time_offset = options.time_offset - phase_offset = options.phase_offset*(math.pi/180.0) - - # calculate noise voltage from SNR - power_in_signal = abs(options.tx_amplitude)**2 - noise_power = power_in_signal/SNR - noise_voltage = math.sqrt(noise_power) - - self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) - self.channel = gr.channel_model(noise_voltage, frequency_offset, - time_offset, noise_seed=-random.randint(0,100000)) - self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset), - math.sin(phase_offset))) - self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) - - self.connect(self.src, self.channel, self.phase, self.snk) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - # Create Options Parser: - usage = "benchmack_add_channel.py [options] <input file> <output file>" - parser = OptionParser (usage=usage, option_class=eng_option, conflict_handler="resolve") - parser.add_option("-n", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - parser.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - parser.add_option("-f", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - parser.add_option("-t", "--time-offset", type="eng_float", default=1.0, - help="set timing offset between Tx and Rx [default=%default]") - parser.add_option("-p", "--phase-offset", type="eng_float", default=0, - help="set phase offset (in degrees) between Tx and Rx [default=%default]") - parser.add_option("-m", "--use-multipath", action="store_true", default=False, - help="Use a multipath channel [default=%default]") - parser.add_option("", "--tx-amplitude", type="eng_float", - default=1.0, - help="tell the simulator the signal amplitude [default=%default]") - - (options, args) = parser.parse_args () - - if len(args) != 2: - parser.print_help(sys.stderr) - sys.exit(1) - - ifile = args[0] - ofile = args[1] - - # build the graph - tb = my_top_block(ifile, ofile, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py deleted file mode 100755 index 1962fdc4b..000000000 --- a/gr-digital/examples/narrowband/benchmark_rx.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, gru -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# From gr-digital -from gnuradio import digital - -# from current dir -from receive_path import receive_path -from uhd_interface import uhd_receiver - -import struct -import sys - -#import os -#print os.getpid() -#raw_input('Attach and press enter: ') - -class my_top_block(gr.top_block): - def __init__(self, demodulator, rx_callback, options): - gr.top_block.__init__(self) - - if(options.rx_freq is not None): - # Work-around to get the modulation's bits_per_symbol - args = demodulator.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / demodulator(**args).bits_per_symbol() - - self.source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - options.samples_per_symbol = self.source._sps - - elif(options.from_file is not None): - sys.stderr.write(("Reading samples from '%s'.\n\n" % (options.from_file))) - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - else: - sys.stderr.write("No source defined, pulling samples from null source.\n\n") - self.source = gr.null_source(gr.sizeof_gr_complex) - - # Set up receive path - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.rxpath = receive_path(demodulator, rx_callback, options) - - self.connect(self.source, self.rxpath) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - (pktno,) = struct.unpack('!H', payload[0:2]) - n_rcvd += 1 - if ok: - n_right += 1 - - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) - - demods = digital.modulation_utils.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - - for mod in demods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.from_file is None: - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py deleted file mode 100755 index 9afacb495..000000000 --- a/gr-digital/examples/narrowband/benchmark_tx.py +++ /dev/null @@ -1,154 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# From gr-digital -from gnuradio import digital - -# from current dir -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter - -import time, struct, sys - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - -class my_top_block(gr.top_block): - def __init__(self, modulator, options): - gr.top_block.__init__(self) - - if(options.tx_freq is not None): - # Work-around to get the modulation's bits_per_symbol - args = modulator.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / modulator(**args).bits_per_symbol() - - self.sink = uhd_transmitter(options.args, symbol_rate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - options.samples_per_symbol = self.sink._sps - - elif(options.to_file is not None): - sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file))) - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - else: - sys.stderr.write("No sink defined, dumping samples to null sink.\n\n") - self.sink = gr.null_sink(gr.sizeof_gr_complex) - - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.txpath = transmit_path(modulator, options) - - self.connect(self.txpath, self.sink) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - mods = digital.modulation_utils.type_1_mods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinous transmission (bursts of 5 packets)") - parser.add_option("","--from-file", default=None, - help="use intput file for packet contents") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - - transmit_path.add_options(parser, expert_grp) - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(expert_grp) - - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.from_file is not None: - source_file = open(options.from_file, 'r') - - # build the graph - tb = my_top_block(mods[options.modulation], options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - if options.from_file is None: - data = (pkt_size - 2) * chr(pktno & 0xff) - else: - data = source_file.read(pkt_size - 2) - if data == '': - break; - - payload = struct.pack('!H', pktno & 0xffff) + data - send_pkt(payload) - n += len(payload) - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py deleted file mode 100755 index 4055aa244..000000000 --- a/gr-digital/examples/narrowband/digital_bert_rx.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, eng_notation -from optparse import OptionParser -from gnuradio.eng_option import eng_option -import gnuradio.gr.gr_threading as _threading -import sys, time, math - -from gnuradio import digital - -# from current dir -from uhd_interface import uhd_receiver - -n2s = eng_notation.num_to_str - -class status_thread(_threading.Thread): - def __init__(self, tb): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.tb = tb - self.done = False - self.start() - - def run(self): - while not self.done: - print "Freq. Offset: {0:5.0f} Hz Timing Offset: {1:10.1f} ppm Estimated SNR: {2:4.1f} dB BER: {3:g}".format( - tb.frequency_offset(), tb.timing_offset()*1e6, tb.snr(), tb.ber()) - try: - time.sleep(1.0) - except KeyboardInterrupt: - self.done = True - - - -class bert_receiver(gr.hier_block2): - def __init__(self, bitrate, - constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - freq_bw, timing_bw, phase_bw, - verbose, log): - - gr.hier_block2.__init__(self, "bert_receive", - gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self._bitrate = bitrate - - self._demod = digital.generic_demod(constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - freq_bw, timing_bw, phase_bw, - verbose, log) - - self._symbol_rate = self._bitrate / self._demod.bits_per_symbol() - self._sample_rate = self._symbol_rate * samples_per_symbol - - # Add an SNR probe on the demodulated constellation - self._snr_probe = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, alpha=10.0/self._symbol_rate) - self.connect(self._demod.time_recov, self._snr_probe) - - # Descramble BERT sequence. A channel error will create 3 incorrect bits - self._descrambler = gr.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler - - # Measure BER by the density of 0s in the stream - self._ber = gr.probe_density_b(1.0/self._symbol_rate) - - self.connect(self, self._demod, self._descrambler, self._ber) - - def frequency_offset(self): - return self._demod.freq_recov.get_frequency()*self._sample_rate/(2*math.pi) - - def timing_offset(self): - return self._demod.time_recov.get_clock_rate() - - def snr(self): - return self._snr_probe.snr() - - def ber(self): - return (1.0-self._ber.density())/3.0 - - - -class rx_psk_block(gr.top_block): - def __init__(self, demod, options): - - gr.top_block.__init__(self, "rx_mpsk") - - self._demodulator_class = demod - - # Get demod_kwargs - demod_kwargs = self._demodulator_class.extract_kwargs_from_options(options) - - # demodulator - self._demodulator = self._demodulator_class(**demod_kwargs) - - if(options.rx_freq is not None): - symbol_rate = options.bitrate / self._demodulator.bits_per_symbol() - self._source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.spec, - options.antenna, options.verbose) - options.samples_per_symbol = self._source._sps - - elif(options.from_file is not None): - self._source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - else: - self._source = gr.null_source(gr.sizeof_gr_complex) - - # Create the BERT receiver - self._receiver = bert_receiver(options.bitrate, - self._demodulator._constellation, - options.samples_per_symbol, - options.differential, - options.excess_bw, - gray_coded=True, - freq_bw=options.freq_bw, - timing_bw=options.timing_bw, - phase_bw=options.phase_bw, - verbose=options.verbose, - log=options.log) - - self.connect(self._source, self._receiver) - - def snr(self): - return self._receiver.snr() - - def mag(self): - return self._receiver.signal_mean() - - def var(self): - return self._receiver.noise_variance() - - def ber(self): - return self._receiver.ber() - - def frequency_offset(self): - return self._receiver.frequency_offset() - - def timing_offset(self): - return self._receiver.timing_offset() - - -def get_options(demods): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - parser.add_option("-r", "--bitrate", type="eng_float", default=250e3, - help="Select modulation bit rate (default=%default)") - parser.add_option("-S", "--samples-per-symbol", type="float", default=2, - help="set samples/symbol [default=%default]") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - if not parser.has_option("--log"): - parser.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - - uhd_receiver.add_options(parser) - - demods = digital.modulation_utils.type_1_demods() - for mod in demods.values(): - mod.add_options(parser) - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - return (options, args) - - -if __name__ == "__main__": - demods = digital.modulation_utils.type_1_demods() - - (options, args) = get_options(demods) - - demod = demods[options.modulation] - tb = rx_psk_block(demod, options) - - print "\n*** SNR estimator is inaccurate below about 7dB" - print "*** BER estimator is inaccurate above about 10%\n" - updater = status_thread(tb) - - try: - tb.run() - except KeyboardInterrupt: - updater.done = True - updater = None diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py deleted file mode 100755 index f29e997af..000000000 --- a/gr-digital/examples/narrowband/digital_bert_tx.py +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -from gnuradio import digital - -# from current dir -from uhd_interface import uhd_transmitter - -n2s = eng_notation.num_to_str - -class bert_transmit(gr.hier_block2): - def __init__(self, constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - verbose, log): - - gr.hier_block2.__init__(self, "bert_transmit", - gr.io_signature(0, 0, 0), # Output signature - gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Input signature - - # Create BERT data bit stream - self._bits = gr.vector_source_b([1,], True) # Infinite stream of ones - self._scrambler = gr.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler - - self._mod = digital.generic_mod(constellation, samples_per_symbol, - differential, excess_bw, gray_coded, - verbose, log) - - self._pack = gr.unpacked_to_packed_bb(self._mod.bits_per_symbol(), gr.GR_MSB_FIRST) - - self.connect(self._bits, self._scrambler, self._pack, self._mod, self) - - -class tx_psk_block(gr.top_block): - def __init__(self, mod, options): - gr.top_block.__init__(self, "tx_mpsk") - - self._modulator_class = mod - - # Get mod_kwargs - mod_kwargs = self._modulator_class.extract_kwargs_from_options(options) - - # transmitter - self._modulator = self._modulator_class(**mod_kwargs) - - if(options.tx_freq is not None): - symbol_rate = options.bitrate / self._modulator.bits_per_symbol() - self._sink = uhd_transmitter(options.args, symbol_rate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.spec, - options.antenna, options.verbose) - options.samples_per_symbol = self._sink._sps - - elif(options.to_file is not None): - self._sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - else: - self._sink = gr.null_sink(gr.sizeof_gr_complex) - - - self._transmitter = bert_transmit(self._modulator._constellation, - options.samples_per_symbol, - options.differential, - options.excess_bw, - gray_coded=True, - verbose=options.verbose, - log=options.log) - - self.amp = gr.multiply_const_cc(options.amplitude) - self.connect(self._transmitter, self.amp, self._sink) - - -def get_options(mods): - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='psk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - parser.add_option("", "--amplitude", type="eng_float", default=0.2, - help="set Tx amplitude (0-1) (default=%default)") - parser.add_option("-r", "--bitrate", type="eng_float", default=250e3, - help="Select modulation bit rate (default=%default)") - parser.add_option("-S", "--samples-per-symbol", type="float", default=2, - help="set samples/symbol [default=%default]") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - if not parser.has_option("--log"): - parser.add_option("", "--log", action="store_true", default=False) - - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(parser) - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - return (options, args) - -if __name__ == "__main__": - mods = digital.modulation_utils.type_1_mods() - - (options, args) = get_options(mods) - - mod = mods[options.modulation] - tb = tx_psk_block(mod, options) - - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py deleted file mode 100644 index 1f9310506..000000000 --- a/gr-digital/examples/narrowband/receive_path.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, gru -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# receive path -# ///////////////////////////////////////////////////////////////////////////// - -class receive_path(gr.hier_block2): - def __init__(self, demod_class, rx_callback, options): - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(1, 1, gr.sizeof_gr_complex), - gr.io_signature(0, 0, 0)) - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._bitrate = options.bitrate # desired bit rate - - self._rx_callback = rx_callback # this callback is fired when a packet arrives - self._demod_class = demod_class # the demodulator_class we're using - - self._chbw_factor = options.chbw_factor # channel filter bandwidth factor - - # Get demod_kwargs - demod_kwargs = self._demod_class.extract_kwargs_from_options(options) - - # Build the demodulator - self.demodulator = self._demod_class(**demod_kwargs) - - # Make sure the channel BW factor is between 1 and sps/2 - # or the filter won't work. - if(self._chbw_factor < 1.0 or self._chbw_factor > self.samples_per_symbol()/2): - sys.stderr.write("Channel bandwidth factor ({0}) must be within the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol()/2)) - sys.exit(1) - - # Design filter to get actual channel we want - sw_decim = 1 - chan_coeffs = gr.firdes.low_pass (1.0, # gain - sw_decim * self.samples_per_symbol(), # sampling rate - self._chbw_factor, # midpoint of trans. band - 0.5, # width of trans. band - gr.firdes.WIN_HANN) # filter type - self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs) - - # receiver - self.packet_receiver = \ - digital.demod_pkts(self.demodulator, - access_code=None, - callback=self._rx_callback, - threshold=-1) - - # Carrier Sensing Blocks - alpha = 0.001 - thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # connect block input to channel filter - self.connect(self, self.channel_filter) - - # connect the channel input filter to the carrier power detector - self.connect(self.channel_filter, self.probe) - - # connect channel filter to the packet receiver - self.connect(self.channel_filter, self.packet_receiver) - - def bitrate(self): - return self._bitrate - - def samples_per_symbol(self): - return self.demodulator._samples_per_symbol - - def differential(self): - return self.demodulator._differential - - def carrier_sensed(self): - """ - Return True if we think carrier is present. - """ - #return self.probe.level() > X - return self.probe.unmuted() - - def carrier_threshold(self): - """ - Return current setting in dB. - """ - return self.probe.threshold() - - def set_carrier_threshold(self, threshold_in_db): - """ - Set carrier threshold. - - @param threshold_in_db: set detection threshold - @type threshold_in_db: float (dB) - """ - self.probe.set_threshold(threshold_in_db) - - - def add_options(normal, expert): - """ - Adds receiver-specific options to the Options Parser - """ - if not normal.has_option("--bitrate"): - normal.add_option("-r", "--bitrate", type="eng_float", default=100e3, - help="specify bitrate [default=%default].") - normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("-S", "--samples-per-symbol", type="float", default=2, - help="set samples/symbol [default=%default]") - expert.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - expert.add_option("", "--chbw-factor", type="float", default=1.0, - help="Channel bandwidth = chbw_factor x signal bandwidth [defaut=%default]") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - - def _print_verbage(self): - """ - Prints information about the receive path - """ - print "\nReceive Path:" - print "modulation: %s" % (self._demod_class.__name__) - print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)) - print "samples/symbol: %.4f" % (self.samples_per_symbol()) - print "Differential: %s" % (self.differential()) diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py deleted file mode 100755 index 100caff8e..000000000 --- a/gr-digital/examples/narrowband/rx_voice.py +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2009,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, blks2, audio, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import digital -from gnuradio import vocoder - -import random -import struct -import sys - -# from current dir -from receive_path import receive_path -from uhd_interface import uhd_receiver - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class audio_tx(gr.hier_block2): - def __init__(self, audio_output_dev): - gr.hier_block2.__init__(self, "audio_tx", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - - self.sample_rate = sample_rate = 8000 - self.packet_src = gr.message_source(33) - voice_decoder = vocoder.gsm_fr_decode_ps() - s2f = gr.short_to_float () - sink_scale = gr.multiply_const_ff(1.0/32767.) - audio_sink = audio.sink(sample_rate, audio_output_dev) - self.connect(self.packet_src, voice_decoder, s2f, sink_scale, audio_sink) - - def msgq(self): - return self.packet_src.msgq() - - -class my_top_block(gr.top_block): - def __init__(self, demod_class, rx_callback, options): - gr.top_block.__init__(self) - self.rxpath = receive_path(demod_class, rx_callback, options) - self.audio_tx = audio_tx(options.audio_output) - - if(options.rx_freq is not None): - self.source = uhd_receiver(options.args, options.bitrate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.antenna, options.verbose) - options.samples_per_symbol = self.source._sps - - audio_rate = self.audio_tx.sample_rate - usrp_rate = self.source.get_sample_rate() - rrate = audio_rate / usrp_rate - self.resampler = blks2.pfb_arb_resampler_ccf(rrate) - - self.connect(self.source, self.resampler, self.rxpath) - - elif(options.from_file is not None): - self.thr = gr.throttle(gr.sizeof_gr_complex, options.bitrate) - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - self.connect(self.source, self.thr, self.rxpath) - - else: - self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6) - self.source = gr.null_source(gr.sizeof_gr_complex) - self.connect(self.source, self.thr, self.rxpath) - - self.connect(self.audio_tx) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -global n_rcvd, n_right - -def main(): - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - n_rcvd += 1 - if ok: - n_right += 1 - - tb.audio_tx.msgq().insert_tail(gr.message_from_string(payload)) - - print "ok = %r n_rcvd = %4d n_right = %4d" % ( - ok, n_rcvd, n_right) - - demods = digital.modulation_utils.type_1_demods() - - # Create Options Parser: - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) - parser.add_option("-O", "--audio-output", type="string", default="", - help="pcm output device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - - for mod in demods.values(): - mod.add_options(expert_grp) - - parser.set_defaults(bitrate=50e3) # override default bitrate default - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.from_file is None: - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - - # build the graph - tb = my_top_block(demods[options.modulation], rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.run() - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/transmit_path.py b/gr-digital/examples/narrowband/transmit_path.py deleted file mode 100644 index 4d6162ed6..000000000 --- a/gr-digital/examples/narrowband/transmit_path.py +++ /dev/null @@ -1,126 +0,0 @@ -# -# Copyright 2005-2007,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# transmit path -# ///////////////////////////////////////////////////////////////////////////// - -class transmit_path(gr.hier_block2): - def __init__(self, modulator_class, options): - ''' - See below for what options should hold - ''' - gr.hier_block2.__init__(self, "transmit_path", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._tx_amplitude = options.tx_amplitude # digital amplitude sent to USRP - self._bitrate = options.bitrate # desired bit rate - self._modulator_class = modulator_class # the modulator_class we are using - - # Get mod_kwargs - mod_kwargs = self._modulator_class.extract_kwargs_from_options(options) - - # transmitter - self.modulator = self._modulator_class(**mod_kwargs) - - self.packet_transmitter = \ - digital.mod_pkts(self.modulator, - access_code=None, - msgq_limit=4, - pad_for_usrp=True) - - self.amp = gr.multiply_const_cc(1) - self.set_tx_amplitude(self._tx_amplitude) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # Connect components in the flowgraph - self.connect(self.packet_transmitter, self.amp, self) - - def set_tx_amplitude(self, ampl): - """ - Sets the transmit amplitude sent to the USRP in volts - @param: ampl 0 <= ampl < 1. - """ - self._tx_amplitude = max(0.0, min(ampl, 1)) - self.amp.set_k(self._tx_amplitude) - - def send_pkt(self, payload='', eof=False): - """ - Calls the transmitter method to send a packet - """ - return self.packet_transmitter.send_pkt(payload, eof) - - def bitrate(self): - return self._bitrate - - def samples_per_symbol(self): - return self.modulator._samples_per_symbol - - def differential(self): - return self.modulator._differential - - def add_options(normal, expert): - """ - Adds transmitter-specific options to the Options Parser - """ - if not normal.has_option('--bitrate'): - normal.add_option("-r", "--bitrate", type="eng_float", - default=100e3, - help="specify bitrate [default=%default].") - normal.add_option("", "--tx-amplitude", type="eng_float", - default=0.250, metavar="AMPL", - help="set transmitter digital amplitude: 0 <= AMPL < 1 [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", - default=False) - - expert.add_option("-S", "--samples-per-symbol", type="float", - default=2, - help="set samples/symbol [default=%default]") - expert.add_option("", "--log", action="store_true", - default=False, - help="Log all parts of flow graph to file (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the transmit path - """ - print "Tx amplitude %s" % (self._tx_amplitude) - print "modulation: %s" % (self._modulator_class.__name__) - print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)) - print "samples/symbol: %.4f" % (self.samples_per_symbol()) - print "Differential: %s" % (self.differential()) diff --git a/gr-digital/examples/narrowband/tunnel.py b/gr-digital/examples/narrowband/tunnel.py deleted file mode 100755 index 65205b9f6..000000000 --- a/gr-digital/examples/narrowband/tunnel.py +++ /dev/null @@ -1,297 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2009,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# //////////////////////////////////////////////////////////////////// -# -# This code sets up up a virtual ethernet interface (typically -# gr0), and relays packets between the interface and the GNU Radio -# PHY+MAC -# -# What this means in plain language, is that if you've got a couple -# of USRPs on different machines, and if you run this code on those -# machines, you can talk between them using normal TCP/IP -# networking. -# -# //////////////////////////////////////////////////////////////////// - - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# from current dir -from receive_path import receive_path -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter -from uhd_interface import uhd_receiver - -import os, sys -import random, time, struct - -#print os.getpid() -#raw_input('Attach and press enter') - -# //////////////////////////////////////////////////////////////////// -# -# Use the Universal TUN/TAP device driver to move packets to/from -# kernel -# -# See /usr/src/linux/Documentation/networking/tuntap.txt -# -# //////////////////////////////////////////////////////////////////// - -# Linux specific... -# TUNSETIFF ifr flags from <linux/tun_if.h> - -IFF_TUN = 0x0001 # tunnel IP packets -IFF_TAP = 0x0002 # tunnel ethernet frames -IFF_NO_PI = 0x1000 # don't pass extra packet info -IFF_ONE_QUEUE = 0x2000 # beats me ;) - -def open_tun_interface(tun_device_filename): - from fcntl import ioctl - - mode = IFF_TAP | IFF_NO_PI - TUNSETIFF = 0x400454ca - - tun = os.open(tun_device_filename, os.O_RDWR) - ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode)) - ifname = ifs[:16].strip("\x00") - return (tun, ifname) - - -# //////////////////////////////////////////////////////////////////// -# the flow graph -# //////////////////////////////////////////////////////////////////// - -class my_top_block(gr.top_block): - - def __init__(self, mod_class, demod_class, - rx_callback, options): - - gr.top_block.__init__(self) - - # Get the modulation's bits_per_symbol - args = mod_class.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / mod_class(**args).bits_per_symbol() - - self.source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - - self.sink = uhd_transmitter(options.args, symbol_rate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - - options.samples_per_symbol = self.source._sps - - self.txpath = transmit_path(mod_class, options) - self.rxpath = receive_path(demod_class, rx_callback, options) - self.connect(self.txpath, self.sink) - self.connect(self.source, self.rxpath) - - def send_pkt(self, payload='', eof=False): - return self.txpath.send_pkt(payload, eof) - - def carrier_sensed(self): - """ - Return True if the receive path thinks there's carrier - """ - return self.rxpath.carrier_sensed() - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - """ - - self.sink.set_freq(target_freq) - self.source.set_freq(target_freq) - - -# //////////////////////////////////////////////////////////////////// -# Carrier Sense MAC -# //////////////////////////////////////////////////////////////////// - -class cs_mac(object): - """ - Prototype carrier sense MAC - - Reads packets from the TUN/TAP interface, and sends them to the - PHY. Receives packets from the PHY via phy_rx_callback, and sends - them into the TUN/TAP interface. - - Of course, we're not restricted to getting packets via TUN/TAP, - this is just an example. - """ - - def __init__(self, tun_fd, verbose=False): - self.tun_fd = tun_fd # file descriptor for TUN/TAP interface - self.verbose = verbose - self.tb = None # top block (access to PHY) - - def set_top_block(self, tb): - self.tb = tb - - def phy_rx_callback(self, ok, payload): - """ - Invoked by thread associated with PHY to pass received packet up. - - @param ok: bool indicating whether payload CRC was OK - @param payload: contents of the packet (string) - """ - if self.verbose: - print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload)) - if ok: - os.write(self.tun_fd, payload) - - def main_loop(self): - """ - Main loop for MAC. - Only returns if we get an error reading from TUN. - - FIXME: may want to check for EINTR and EAGAIN and reissue read - """ - min_delay = 0.001 # seconds - - while 1: - payload = os.read(self.tun_fd, 10*1024) - if not payload: - self.tb.send_pkt(eof=True) - break - - if self.verbose: - print "Tx: len(payload) = %4d" % (len(payload),) - - delay = min_delay - while self.tb.carrier_sensed(): - sys.stderr.write('B') - time.sleep(delay) - if delay < 0.050: - delay = delay * 2 # exponential back-off - - self.tb.send_pkt(payload) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - mods = digital.modulation_utils.type_1_mods() - demods = digital.modulation_utils.type_1_demods() - - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - - parser.add_option("-s", "--size", type="eng_float", default=1500, - help="set packet size [default=%default]") - parser.add_option("-v","--verbose", action="store_true", default=False) - expert_grp.add_option("-c", "--carrier-threshold", type="eng_float", default=30, - help="set carrier detect threshold (dB) [default=%default]") - expert_grp.add_option("","--tun-device-filename", default="/dev/net/tun", - help="path to tun device file [default=%default]") - - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(expert_grp) - - for demod in demods.values(): - demod.add_options(expert_grp) - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - # open the TUN/TAP interface - (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename) - - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - # instantiate the MAC - mac = cs_mac(tun_fd, verbose=True) - - # build the graph (PHY) - tb = my_top_block(mods[options.modulation], - demods[options.modulation], - mac.phy_rx_callback, - options) - - mac.set_top_block(tb) # give the MAC a handle for the PHY - - if tb.txpath.bitrate() != tb.rxpath.bitrate(): - print "WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" % ( - eng_notation.num_to_str(tb.txpath.bitrate()), - eng_notation.num_to_str(tb.rxpath.bitrate())) - - print "modulation: %s" % (options.modulation,) - print "freq: %s" % (eng_notation.num_to_str(options.tx_freq)) - print "bitrate: %sb/sec" % (eng_notation.num_to_str(tb.txpath.bitrate()),) - print "samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),) - - tb.rxpath.set_carrier_threshold(options.carrier_threshold) - print "Carrier sense threshold:", options.carrier_threshold, "dB" - - print - print "Allocated virtual ethernet interface: %s" % (tun_ifname,) - print "You must now use ifconfig to set its IP address. E.g.," - print - print " $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,) - print - print "Be sure to use a different address in the same subnet for each machine." - print - - - tb.start() # Start executing the flow graph (runs in separate threads) - - mac.main_loop() # don't expect this to return... - - tb.stop() # but if it does, tell flow graph to stop. - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py deleted file mode 100755 index 3d767a077..000000000 --- a/gr-digital/examples/narrowband/tx_voice.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005-2007,2009,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, blks2, audio, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import digital -from gnuradio import vocoder - -import random -import time -import struct -import sys - -# from current dir -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter - -#import os -#print os.getpid() -#raw_input('Attach and press enter') - - -class audio_rx(gr.hier_block2): - def __init__(self, audio_input_dev): - gr.hier_block2.__init__(self, "audio_rx", - gr.io_signature(0, 0, 0), # Input signature - gr.io_signature(0, 0, 0)) # Output signature - self.sample_rate = sample_rate = 8000 - src = audio.source(sample_rate, audio_input_dev) - src_scale = gr.multiply_const_ff(32767) - f2s = gr.float_to_short() - voice_coder = vocoder.gsm_fr_encode_sp() - self.packets_from_encoder = gr.msg_queue() - packet_sink = gr.message_sink(33, self.packets_from_encoder, False) - self.connect(src, src_scale, f2s, voice_coder, packet_sink) - - def get_encoded_voice_packet(self): - return self.packets_from_encoder.delete_head() - - -class my_top_block(gr.top_block): - - def __init__(self, modulator_class, options): - gr.top_block.__init__(self) - self.txpath = transmit_path(modulator_class, options) - self.audio_rx = audio_rx(options.audio_input) - - if(options.tx_freq is not None): - self.sink = uhd_transmitter(options.address, options.bitrate, - options.samples_per_symbol, - options.tx_freq, options.tx_gain, - options.antenna, options.verbose) - options.samples_per_symbol = self.sink._sps - audio_rate = self.audio_rx.sample_rate - usrp_rate = self.sink.get_sample_rate() - rrate = usrp_rate / audio_rate - - elif(options.to_file is not None): - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - rrate = 1 - else: - self.sink = gr.null_sink(gr.sizeof_gr_complex) - rrate = 1 - - self.resampler = blks2.pfb_arb_resampler_ccf(rrate) - - self.connect(self.audio_rx) - self.connect(self.txpath, self.resampler, self.sink) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - def rx_callback(ok, payload): - print "ok = %r, payload = '%s'" % (ok, payload) - - mods = digital.modulation_utils.type_1_mods() - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), - default='gmsk', - help="Select modulation from: %s [default=%%default]" - % (', '.join(mods.keys()),)) - parser.add_option("-M", "--megabytes", type="eng_float", default=0, - help="set megabytes to transmit [default=inf]") - parser.add_option("-I", "--audio-input", type="string", default="", - help="pcm input device name. E.g., hw:0,0 or /dev/dsp") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - - transmit_path.add_options(parser, expert_grp) - uhd_transmitter.add_options(parser) - - for mod in mods.values(): - mod.add_options(expert_grp) - - parser.set_defaults(bitrate=50e3) # override default bitrate default - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - if options.to_file is None: - if options.tx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - # build the graph - tb = my_top_block(mods[options.modulation], options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - - while nbytes == 0 or n < nbytes: - packet = tb.audio_rx.get_encoded_voice_packet() - s = packet.to_string() - send_pkt(s) - n += len(s) - sys.stderr.write('.') - pktno += 1 - - send_pkt(eof=True) - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/narrowband/uhd_interface.py b/gr-digital/examples/narrowband/uhd_interface.py deleted file mode 100644 index fe022c731..000000000 --- a/gr-digital/examples/narrowband/uhd_interface.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import sys - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -class uhd_interface: - def __init__(self, istx, args, sym_rate, sps, freq=None, - gain=None, spec=None, antenna=None): - - if(istx): - self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32')) - else: - self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - self._args = args - self._ant = antenna - self._spec = spec - self._gain = self.set_gain(gain) - self._freq = self.set_freq(freq) - - self._rate, self._sps = self.set_sample_rate(sym_rate, sps) - - def set_sample_rate(self, sym_rate, req_sps): - start_sps = req_sps - while(True): - asked_samp_rate = sym_rate * req_sps - self.u.set_samp_rate(asked_samp_rate) - actual_samp_rate = self.u.get_samp_rate() - - sps = actual_samp_rate/sym_rate - if(sps < 2): - req_sps +=1 - else: - actual_sps = sps - break - - if(sps != req_sps): - print "\nSymbol Rate: %f" % (sym_rate) - print "Requested sps: %f" % (start_sps) - print "Given sample rate: %f" % (actual_samp_rate) - print "Actual sps for rate: %f" % (actual_sps) - - if(actual_samp_rate != asked_samp_rate): - print "\nRequested sample rate: %f" % (asked_samp_rate) - print "Actual sample rate: %f" % (actual_samp_rate) - - return (actual_samp_rate, actual_sps) - - def get_sample_rate(self): - return self.u.get_samp_rate() - - def set_gain(self, gain=None): - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start()+g.stop())/2 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (gain, g.start(), g.stop()) - - self.u.set_gain(gain, 0) - return gain - - def set_freq(self, freq=None): - if(freq is None): - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - sys.exit(1) - - r = self.u.set_center_freq(freq, 0) - if r: - return freq - else: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - -#-------------------------------------------------------------------# -# TRANSMITTER -#-------------------------------------------------------------------# - -class uhd_transmitter(uhd_interface, gr.hier_block2): - def __init__(self, args, sym_rate, sps, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_transmitter", - gr.io_signature(1,1,gr.sizeof_gr_complex), - gr.io_signature(0,0,0)) - - # Set up the UHD interface as a transmitter - uhd_interface.__init__(self, True, args, sym_rate, sps, - freq, gain, spec, antenna) - - self.connect(self, self.u) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--tx-gain", type="eng_float", default=None, - help="set transmit gain in dB (default is midpoint)") - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Transmitter:" - print "Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Subdev Sec: %s" % (self._spec) - - -#-------------------------------------------------------------------# -# RECEIVER -#-------------------------------------------------------------------# - - -class uhd_receiver(uhd_interface, gr.hier_block2): - def __init__(self, args, sym_rate, sps, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_receiver", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - # Set up the UHD interface as a receiver - uhd_interface.__init__(self, False, args, sym_rate, sps, - freq, gain, spec, antenna) - - self.connect(self.u, self) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-freq", type="eng_float", default=None, - help="set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Receiver:" - print "UHD Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Spec: %s" % (self._spec) diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py deleted file mode 100755 index cbdd990f4..000000000 --- a/gr-digital/examples/ofdm/benchmark_add_channel.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, math, sys - -class my_top_block(gr.top_block): - def __init__(self, ifile, ofile, options): - gr.top_block.__init__(self) - - SNR = 10.0**(options.snr/10.0) - time_offset = options.time_offset - phase_offset = options.phase_offset*(math.pi/180.0) - - # calculate noise voltage from SNR - power_in_signal = abs(options.tx_amplitude)**2 - noise_power = power_in_signal/SNR - noise_voltage = math.sqrt(noise_power) - print "Noise voltage: ", noise_voltage - - frequency_offset = options.frequency_offset / options.fft_length - - self.src = gr.file_source(gr.sizeof_gr_complex, ifile) - #self.throttle = gr.throttle(gr.sizeof_gr_complex, options.sample_rate) - self.channel = gr.channel_model(noise_voltage, frequency_offset, - time_offset, noise_seed=-random.randint(0,100000)) - self.phase = gr.multiply_const_cc(complex(math.cos(phase_offset), - math.sin(phase_offset))) - self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) - - self.connect(self.src, self.channel, self.phase, self.snk) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - # Create Options Parser: - usage = "benchmack_add_channel.py [options] <input file> <output file>" - parser = OptionParser (usage=usage, option_class=eng_option, conflict_handler="resolve") - parser.add_option("-n", "--snr", type="eng_float", default=30, - help="set the SNR of the channel in dB [default=%default]") - parser.add_option("", "--seed", action="store_true", default=False, - help="use a random seed for AWGN noise [default=%default]") - parser.add_option("-f", "--frequency-offset", type="eng_float", default=0, - help="set frequency offset introduced by channel [default=%default]") - parser.add_option("-t", "--time-offset", type="eng_float", default=1.0, - help="set timing offset between Tx and Rx [default=%default]") - parser.add_option("-p", "--phase-offset", type="eng_float", default=0, - help="set phase offset (in degrees) between Tx and Rx [default=%default]") - parser.add_option("-m", "--use-multipath", action="store_true", default=False, - help="Use a multipath channel [default=%default]") - parser.add_option("", "--fft-length", type="intx", default=None, - help="set the number of FFT bins [default=%default]") - parser.add_option("", "--tx-amplitude", type="eng_float", - default=1.0, - help="tell the simulator the signal amplitude [default=%default]") - - (options, args) = parser.parse_args () - - if len(args) != 2: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.fft_length is None: - sys.stderr.write("Please enter the FFT length of the OFDM signal.\n") - sys.exit(1) - - ifile = args[0] - ofile = args[1] - - # build the graph - tb = my_top_block(ifile, ofile, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/benchmark_rx.py b/gr-digital/examples/ofdm/benchmark_rx.py deleted file mode 100755 index 57817c501..000000000 --- a/gr-digital/examples/ofdm/benchmark_rx.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, blks2 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -from gnuradio import digital - -# from current dir -from receive_path import receive_path -from uhd_interface import uhd_receiver - -import struct, sys - -class my_top_block(gr.top_block): - def __init__(self, callback, options): - gr.top_block.__init__(self) - - if(options.rx_freq is not None): - self.source = uhd_receiver(options.args, - options.bandwidth, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - elif(options.from_file is not None): - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) - else: - self.source = gr.null_source(gr.sizeof_gr_complex) - - # Set up receive path - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.rxpath = receive_path(callback, options) - - self.connect(self.source, self.rxpath) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def rx_callback(ok, payload): - global n_rcvd, n_right - n_rcvd += 1 - (pktno,) = struct.unpack('!H', payload[0:2]) - if ok: - n_right += 1 - print "ok: %r \t pktno: %d \t n_rcvd: %d \t n_right: %d" % (ok, pktno, n_rcvd, n_right) - - if 0: - printlst = list() - for x in payload[2:]: - t = hex(ord(x)).replace('0x', '') - if(len(t) == 1): - t = '0' + t - printlst.append(t) - printable = ''.join(printlst) - - print printable - print "\n" - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinuous") - parser.add_option("","--from-file", default=None, - help="input file of samples to demod") - - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - digital.ofdm_demod.add_options(parser, expert_grp) - - (options, args) = parser.parse_args () - - if options.from_file is None: - if options.rx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - # build the graph - tb = my_top_block(rx_callback, options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/benchmark_tx.py b/gr-digital/examples/ofdm/benchmark_tx.py deleted file mode 100755 index 5962fe7ec..000000000 --- a/gr-digital/examples/ofdm/benchmark_tx.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import time, struct, sys - -from gnuradio import digital - -# from current dir -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter - -class my_top_block(gr.top_block): - def __init__(self, options): - gr.top_block.__init__(self) - - if(options.tx_freq is not None): - self.sink = uhd_transmitter(options.args, - options.bandwidth, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - elif(options.to_file is not None): - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) - else: - self.sink = gr.null_sink(gr.sizeof_gr_complex) - - # do this after for any adjustments to the options that may - # occur in the sinks (specifically the UHD sink) - self.txpath = transmit_path(options) - - self.connect(self.txpath, self.sink) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - def send_pkt(payload='', eof=False): - return tb.txpath.send_pkt(payload, eof) - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - parser.add_option("-s", "--size", type="eng_float", default=400, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - parser.add_option("","--discontinuous", action="store_true", default=False, - help="enable discontinuous mode") - parser.add_option("","--from-file", default=None, - help="use intput file for packet contents") - parser.add_option("","--to-file", default=None, - help="Output file for modulated samples") - - transmit_path.add_options(parser, expert_grp) - digital.ofdm_mod.add_options(parser, expert_grp) - uhd_transmitter.add_options(parser) - - (options, args) = parser.parse_args () - - # build the graph - tb = my_top_block(options) - - r = gr.enable_realtime_scheduling() - if r != gr.RT_OK: - print "Warning: failed to enable realtime scheduling" - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - if options.from_file is None: - data = (pkt_size - 2) * chr(pktno & 0xff) - else: - data = source_file.read(pkt_size - 2) - if data == '': - break; - - payload = struct.pack('!H', pktno & 0xffff) + data - send_pkt(payload) - n += len(payload) - sys.stderr.write('.') - if options.discontinuous and pktno % 5 == 4: - time.sleep(1) - pktno += 1 - - send_pkt(eof=True) - tb.wait() # wait for it to finish - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/gr_plot_ofdm.py b/gr-digital/examples/ofdm/gr_plot_ofdm.py deleted file mode 100755 index b24855148..000000000 --- a/gr-digital/examples/ofdm/gr_plot_ofdm.py +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -import math, struct, sys -from optparse import OptionParser -from math import log10 - -try: - import scipy - from scipy import fftpack -except ImportError: - print "Error: Program requires scipy (see: www.scipy.org)." - sys.exit(1) - -try: - from pylab import * - from matplotlib.font_manager import fontManager, FontProperties -except ImportError: - print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)." - sys.exit(1) - -matplotlib.interactive(True) -matplotlib.use('TkAgg') - -class draw_constellation: - def __init__(self, options): - derot_file = "ofdm_frame_sink_c.dat" - acq_file = "ofdm_frame_acq_c.dat" - fft_file = "ofdm_receiver-fft_out_c.dat" - - self.h_derot_file = open(derot_file, "r") - self.h_acq_file = open(acq_file, "r") - self.h_fft_file = open(fft_file, "r") - - self.occ_tones = options.occ_tones - self.fft_size = options.fft_size - self.symbol = options.start - self.sample_rate = options.sample_rate - - self.axis_font_size = 16 - self.label_font_size = 18 - self.title_font_size = 20 - self.text_size = 22 - - # Setup PLOT - self.fig = figure(1, figsize=(14, 9), facecolor='w') - rcParams['xtick.labelsize'] = self.axis_font_size - rcParams['ytick.labelsize'] = self.axis_font_size - - self.text_sym = figtext(0.05, 0.95, ("Symbol: %s" % self.symbol), weight="heavy", size=self.text_size) - - self.make_plots() - - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) - self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) - - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) - self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) - - self.xlim = self.sp_eq.get_xlim() - - self.manager = get_current_fig_manager() - #connect('draw_event', self.zoom) - connect('key_press_event', self.click) - show() - - def get_data(self): - self.text_sym.set_text("Symbol: %d" % (self.symbol)) - - derot_data = scipy.fromfile(self.h_derot_file, dtype=scipy.complex64, count=self.occ_tones) - acq_data = scipy.fromfile(self.h_acq_file, dtype=scipy.complex64, count=self.occ_tones) - fft_data = scipy.fromfile(self.h_fft_file, dtype=scipy.complex64, count=self.fft_size) - if(len(acq_data) == 0): - print "End of File" - else: - self.acq_data_reals = [r.real for r in acq_data] - self.acq_data_imags = [i.imag for i in acq_data] - self.derot_data_reals = [r.real for r in derot_data] - self.derot_data_imags = [i.imag for i in derot_data] - - self.unequalized_angle = [math.atan2(x.imag, x.real) for x in fft_data] - self.equalized_angle = [math.atan2(x.imag, x.real) for x in acq_data] - self.derot_equalized_angle = [math.atan2(x.imag, x.real) for x in derot_data] - - self.time = [i*(1/self.sample_rate) for i in range(len(acq_data))] - ffttime = [i*(1/self.sample_rate) for i in range(len(fft_data))] - - self.freq = self.get_freq(ffttime, self.sample_rate) - - for i in range(len(fft_data)): - if(abs(fft_data[i]) == 0.0): - fft_data[i] = complex(1e-6,1e-6) - self.fft_data = [20*log10(abs(f)) for f in fft_data] - - def get_freq(self, time, sample_rate, T=1): - N = len(time) - Fs = 1.0 / (max(time) - min(time)) - Fn = 0.5 * sample_rate - freq = [-Fn + i*Fs for i in range(N)] - return freq - - def make_plots(self): - self.h_acq_file.seek(8*self.symbol*self.occ_tones, 0) - self.h_fft_file.seek(8*self.symbol*self.fft_size, 0) - self.h_derot_file.seek(8*self.symbol*self.occ_tones, 0) - - self.get_data() - - # Subplot: constellation of rotated symbols - self.sp_const = self.fig.add_subplot(4,1,1, position=[0.15, 0.55, 0.3, 0.35]) - self.sp_const.set_title(("Constellation"), fontsize=self.title_font_size, fontweight="bold") - self.sp_const.set_xlabel("Inphase", fontsize=self.label_font_size, fontweight="bold") - self.sp_const.set_ylabel("Qaudrature", fontsize=self.label_font_size, fontweight="bold") - self.plot_const = plot(self.acq_data_reals, self.acq_data_imags, 'bo') - self.plot_const += plot(self.derot_data_reals, self.derot_data_imags, 'ro') - self.sp_const.axis([-2, 2, -2, 2]) - - # Subplot: unequalized angle - self.sp_uneq = self.fig.add_subplot(4,2,1, position=[0.575, 0.55, 0.3, 0.35]) - self.sp_uneq.set_title(("Unequalized Angle"), fontsize=self.title_font_size, fontweight="bold") - self.sp_uneq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_uneq.set_ylabel("Angle", fontsize=self.label_font_size, fontweight="bold") - uneqscale = range(len(self.unequalized_angle)) - self.plot_uneq = plot(uneqscale, self.unequalized_angle, 'bo') - - # Subplot: equalized angle - self.sp_eq = self.fig.add_subplot(4,1,2, position=[0.15, 0.1, 0.3, 0.35]) - self.sp_eq.set_title(("Equalized Angle"), fontsize=self.title_font_size, fontweight="bold") - self.sp_eq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_eq.set_ylabel("Angle", fontsize=self.label_font_size, fontweight="bold") - eqscale = range(len(self.equalized_angle)) - self.plot_eq = plot(eqscale, self.equalized_angle, 'bo') - self.plot_eq += plot(eqscale, self.derot_equalized_angle, 'ro', markersize=4) - - # Subplot: FFT - self.sp_fft = self.fig.add_subplot(4,2,2, position=[0.575, 0.1, 0.3, 0.35]) - self.sp_fft.set_title(("FFT"), fontsize=self.title_font_size, fontweight="bold") - self.sp_fft.set_xlabel("Frequency (MHz)", fontsize=self.label_font_size, fontweight="bold") - self.sp_fft.set_ylabel("Power (dBm)", fontsize=self.label_font_size, fontweight="bold") - self.plot_fft = plot(self.freq, self.fft_data, '-bo') - - draw() - - def update_plots(self): - eqscale = range(len(self.equalized_angle)) - uneqscale = range(len(self.unequalized_angle)) - self.plot_eq[0].set_data([eqscale, self.equalized_angle]) - self.plot_eq[1].set_data([eqscale, self.derot_equalized_angle]) - self.plot_uneq[0].set_data([uneqscale, self.unequalized_angle]) - self.sp_eq.set_ylim([-4, 4]) - self.sp_uneq.set_ylim([-4, 4]) - - #self.sp_iq.axis([min(self.time), max(self.time), - # 1.5*min([min(self.acq_data_reals), min(self.acq_data_imags)]), - # 1.5*max([max(self.acq_data_reals), max(self.acq_data_imags)])]) - - self.plot_const[0].set_data([self.acq_data_reals, self.acq_data_imags]) - self.plot_const[1].set_data([self.derot_data_reals, self.derot_data_imags]) - self.sp_const.axis([-2, 2, -2, 2]) - - self.plot_fft[0].set_data([self.freq, self.fft_data]) - - draw() - - def zoom(self, event): - newxlim = self.sp_eq.get_xlim() - if(newxlim != self.xlim): - self.xlim = newxlim - r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] - i = self.imags[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] - - self.plot_const[0].set_data(r, i) - self.sp_const.axis([-2, 2, -2, 2]) - self.manager.canvas.draw() - draw() - - def click(self, event): - forward_valid_keys = [" ", "down", "right"] - backward_valid_keys = ["up", "left"] - - if(find(event.key, forward_valid_keys)): - self.step_forward() - - elif(find(event.key, backward_valid_keys)): - self.step_backward() - - def button_left_click(self, event): - self.step_backward() - - def button_right_click(self, event): - self.step_forward() - - def step_forward(self): - self.symbol += 1 - self.get_data() - self.update_plots() - - def step_backward(self): - # Step back in file position - self.symbol -= 1 - if(self.h_acq_file.tell() >= 16*self.occ_tones): - self.h_acq_file.seek(-16*self.occ_tones, 1) - else: - self.symbol = 0 - self.h_acq_file.seek(-self.h_acq_file.tell(),1) - - - if(self.h_derot_file.tell() >= 16*self.occ_tones): - self.h_derot_file.seek(-16*self.occ_tones, 1) - else: - self.symbol = 0 - self.h_derot_file.seek(-self.h_derot_file.tell(),1) - - - if(self.h_fft_file.tell() >= 16*self.fft_size): - self.h_fft_file.seek(-16*self.fft_size, 1) - else: - self.symbol = 0 - self.h_fft_file.seek(-self.h_fft_file.tell(),1) - - self.get_data() - self.update_plots() - - - -#FIXME: there must be a way to do this with a Python builtin -def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False - -def main(): - usage="%prog: [options]" - - parser = OptionParser(conflict_handler="resolve", usage=usage) - parser.add_option("", "--fft-size", type="int", default=512, - help="Specify the size of the FFT [default=%default]") - parser.add_option("", "--occ-tones", type="int", default=200, - help="Specify the number of occupied tones [default=%default]") - parser.add_option("-s", "--start", type="int", default=0, - help="Specify the starting symbol to plot [default=%default]") - parser.add_option("-R", "--sample-rate", type="float", default=1.0, - help="Set the sampler rate of the data [default=%default]") - - (options, args) = parser.parse_args () - - dc = draw_constellation(options) - -if __name__ == "__main__": - try: - main() - except KeyboardInterrupt: - pass - - - diff --git a/gr-digital/examples/ofdm/ofdm_mod_demod_test.py b/gr-digital/examples/ofdm/ofdm_mod_demod_test.py deleted file mode 100755 index b1521da6d..000000000 --- a/gr-digital/examples/ofdm/ofdm_mod_demod_test.py +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, ofdm_packet_utils -import gnuradio.gr.gr_threading as _threading -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import random, time, struct, sys, math, os - -class my_top_block(gr.top_block): - def __init__(self, callback, options): - gr.top_block.__init__(self) - - # hard-coded known symbol - ks1 = known_symbols_4512_1[0:options.occupied_tones] - ks2 = known_symbols_4512_2[0:options.occupied_tones] - - self._rcvd_pktq = gr.msg_queue() - - # accepts messages from the outside world - self.ofdm_mapper = gr.ofdm_bpsk_mapper(4, options.occupied_tones, options.fft_length, ks1, ks2) - self.ofdm_corr = gr.ofdm_correlator(options.occupied_tones, options.fft_length, 0, ks1, ks2) - self.ofdm_framer = gr.ofdm_frame_sink(self._rcvd_pktq, options.occupied_tones) - - if 0: # set to 1 to put the correlator in the path to take over the signalling - self.connect((self.ofdm_mapper, 0), (self.ofdm_corr, 0)) - self.connect((self.ofdm_corr, 0), (self.ofdm_framer, 0)) - self.connect((self.ofdm_corr, 1), (self.ofdm_framer, 1)) - - self.connect((self.ofdm_mapper,0), gr.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper.dat")) - self.connect((self.ofdm_corr,0), gr.file_sink(gr.sizeof_gr_complex*options.occupied_tones, "ofdm_corr.dat")) - self.connect((self.ofdm_corr,1), gr.file_sink(gr.sizeof_char, "ofdm_sig.dat")) - - else: - self.connect((self.ofdm_mapper, 0), (self.ofdm_framer, 0)) - self.connect((self.ofdm_mapper, 1), (self.ofdm_framer, 1)) - - self.connect((self.ofdm_mapper,0), gr.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper.dat")) - self.connect((self.ofdm_mapper,1), gr.file_sink(gr.sizeof_char, "ofdm_sig.dat")) - - self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback) - - def send_pkt(self, payload='', eof=False): - if eof: - msg = gr.message(1) - else: - pkt = ofdm_packet_utils.make_packet(payload, 1, 1, False, whiten=False) - msg = gr.message_from_string(pkt) - self.ofdm_mapper.msgq().insert_tail(msg) - -class _queue_watcher_thread(_threading.Thread): - def __init__(self, rcvd_pktq, callback): - _threading.Thread.__init__(self) - self.setDaemon(1) - self.rcvd_pktq = rcvd_pktq - self.callback = callback - self.keep_running = True - self.start() - - def run(self): - while self.keep_running: - msg = self.rcvd_pktq.delete_head() - ok, payload = ofdm_packet_utils.unmake_packet(msg.to_string(), whiten=False) - if self.callback: - self.callback(ok, payload) - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - ''' Use this program to tie the OFDM modulators straight into the frame sink, with or without - the correlator in between. This is for testing of the modulators and demodulators only without - receiver and sync functionality.''' - - global n_rcvd, n_right - - n_rcvd = 0 - n_right = 0 - - def send_pkt(payload='', eof=False): - return fg.send_pkt(payload, eof) - - def rx_callback(ok, payload): - global n_rcvd, n_right - n_rcvd += 1 - (pktno,) = struct.unpack('!H', payload[0:2]) - if ok: - n_right += 1 - print "ok: %r \t pktno: %d \t n_rcvd: %d \t n_right: %d" % (ok, pktno, n_rcvd, n_right) - - printlst = list() - for x in payload[2:]: - t = hex(ord(x)).replace('0x', '') - if(len(t) == 1): - t = '0' + t - printlst.append(t) - printable = ''.join(printlst) - - print printable - print "\n" - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - expert = parser.add_option_group("Expert") - parser.add_option("-s", "--size", type="eng_float", default=1450, - help="set packet size [default=%default]") - parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, - help="set megabytes to transmit [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") - expert.add_option("", "--fft-length", type="intx", default=512, - help="set the number of FFT bins [default=%default]") - expert.add_option("", "--occupied-tones", type="intx", default=200, - help="set the number of occupied FFT bins [default=%default]") - expert.add_option("", "--cp-length", type="intx", default=128, - help="set the number of bits in the cyclic prefix [default=%default]") - - (options, args) = parser.parse_args () - - # build the graph - tb = my_top_block(rx_callback, options) - - tb.start() # start flow graph - - # generate and send packets - nbytes = int(1e6 * options.megabytes) - n = 0 - pktno = 0 - pkt_size = int(options.size) - - while n < nbytes: - #r = ''.join([chr(random.randint(0,255)) for i in range(pkt_size-2)]) - #pkt_contents = struct.pack('!H', pktno) + r - - pkt_contents = struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff) - - send_pkt(pkt_contents) - n += pkt_size - pktno += 1 - - send_pkt(eof=True) - tb.wait() # wait for it to finish - -known_symbols_4512_1 = [-1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1] - -known_symbols_4512_2 = [1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, 1, 1, -1, -1] - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass - diff --git a/gr-digital/examples/ofdm/ofdm_sync.m b/gr-digital/examples/ofdm/ofdm_sync.m deleted file mode 100644 index d5df42137..000000000 --- a/gr-digital/examples/ofdm/ofdm_sync.m +++ /dev/null @@ -1,28 +0,0 @@ -% - -function [theta, g, g1, k, h] = ofdm_sync(signal,SNR,FFTSIZE,CPLEN) - - rho = SNR/(SNR+1); - - d = abs(signal).^2; - g = [ zeros(1,FFTSIZE) signal(1:max(size(signal))-FFTSIZE) ]; - g1 = conj(g); - f = abs(g).^2; - c = d + f; - moving_sum_taps = rho/2 * ones(1,CPLEN); - b = conv(c,moving_sum_taps); - b = b(1:max(size(signal))); - %b = b(CPLEN:max(size(b))); - - k = g1 .* signal; - - moving_sum_taps2 = ones(1, CPLEN); - h = conv(k,moving_sum_taps2); - h = h(1:max(size(signal))); - %h = h(CPLEN:max(size(h))); - - a = abs(h); - - theta = a-b; - -endfunction diff --git a/gr-digital/examples/ofdm/ofdm_sync_pn.m b/gr-digital/examples/ofdm/ofdm_sync_pn.m deleted file mode 100644 index d93c0ca92..000000000 --- a/gr-digital/examples/ofdm/ofdm_sync_pn.m +++ /dev/null @@ -1,21 +0,0 @@ -mf = read_float_binary('ofdm_sync_pn-mf_f.dat'); -theta_pn = read_float_binary('ofdm_sync_pn-theta_f.dat'); -peaks_pn = read_char_binary('ofdm_sync_pn-peaks_b.dat'); -regen_pn = read_char_binary('ofdm_sync_pn-regen_b.dat'); -angle_pn = read_float_binary('ofdm_sync_pn-epsilon_f.dat'); - -plot(mf, 'k') -hold -plot(theta_pn, 'g'); -plot(peaks_pn, 'r'); -plot(regen_pn, 'b'); -xlim([100, 50000]); -ylim([0, 1]) -i = find(peaks_pn); -i(100:200) -hold off - -ipeaks = find(peaks_pn); -dpeaks = diff(ipeaks); -hist(dpeaks, 30) -set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); diff --git a/gr-digital/examples/ofdm/plot_ofdm.m b/gr-digital/examples/ofdm/plot_ofdm.m deleted file mode 100755 index 2a649b5f5..000000000 --- a/gr-digital/examples/ofdm/plot_ofdm.m +++ /dev/null @@ -1,74 +0,0 @@ -function plot_ofdm(fft_size, occ_tones) - -ofdm = read_complex_binary('ofdm_frame_acq_c.dat'); -ofdm_split = split_vect(ofdm, occ_tones); - -ofdm_derot = read_complex_binary('ofdm_frame_sink_c.dat'); -ofdm_derot_split = split_vect(ofdm_derot, occ_tones); - -fftc = read_complex_binary('fft_out_c.dat'); -fftc_split = split_vect(fftc, fft_size); - -size(ofdm_split) -size(ofdm_derot_split) -disp "DEROTATED SPLIT" -ofdm_derot(1:100) - - -figure(1) -#set(gcf, 'Position', [50 50 1000 600]); - -a = size(ofdm_split); -if nargin == 3 - maxcount = count; - if maxcount > a(1) - error('plot_ofdm:tolong', 'Requested count size exceeds size of vectors'); - end -else - maxcount = a(1); -end - -for i = 1:size(ofdm_split)[0] - x = ofdm_split(i,:); - y = fftc_split(i+1,:); - - subplot(2,2,1); - plot(real(x), imag(x), 'bo'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([-1.5, 1.5, -1.5, 1.5]) - #title('I&Q Constellation', 'FontSize', 36); - #xlabel('Inphase', 'FontSize', 32); - #ylabel('Quadrature', 'FontSize', 32); - - subplot(2,2,3); - plot(angle(x*j), 'bo'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([0, occ_tones, -3.5, 3.5]) - #title('Equalized Symbol Angle', 'FontSize', 36); - #xlabel('Bin Number (Occ. Tones)', 'FontSize', 32); - #ylabel('Symbol Angle', 'FontSize', 32); - - subplot(2,2,2); - plot(angle(y*j), 'bo'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([0, fft_size, -3.5, 3.5]) - #title('Unequalized Symbol Angle', 'FontSize', 36); - #xlabel('Bin Number (FFT Size)', 'FontSize', 32); - #ylabel('Symbol Angle', 'FontSize', 32); - - Y = 20*log10(abs(y) ./ max(abs(y))); - subplot(2,2,4); - plot(Y, 'b-'); - #set(gca, 'FontSize', 30, 'FontWeight', 'Bold'); - axis([0, fft_size, -50, 1]); - #title('Frequency Domain of Unequalized Rx', 'FontSize', 36); - #xlabel('Bin Number (FFT Size)', 'FontSize', 32); - #ylabel('Power (dB)', 'FontSize', 32); - - #N = 20*log10(var(abs(x)-1)); - - disp(sprintf('Symbol Number: %d\n', i)) - #disp(sprintf('\tFreq Error: %f\n', anglesh_pn(1+(i-1)*fft_size))) - pause - -end diff --git a/gr-digital/examples/ofdm/receive_path.py b/gr-digital/examples/ofdm/receive_path.py deleted file mode 100644 index e1c7868a0..000000000 --- a/gr-digital/examples/ofdm/receive_path.py +++ /dev/null @@ -1,105 +0,0 @@ -# -# Copyright 2005,2006,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# receive path -# ///////////////////////////////////////////////////////////////////////////// - -class receive_path(gr.hier_block2): - def __init__(self, rx_callback, options): - - gr.hier_block2.__init__(self, "receive_path", - gr.io_signature(1, 1, gr.sizeof_gr_complex), - gr.io_signature(0, 0, 0)) - - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose - self._log = options.log - self._rx_callback = rx_callback # this callback is fired when there's a packet available - - # receiver - self.ofdm_rx = digital.ofdm_demod(options, - callback=self._rx_callback) - - # Carrier Sensing Blocks - alpha = 0.001 - thresh = 30 # in dB, will have to adjust - self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha) - - self.connect(self, self.ofdm_rx) - self.connect(self.ofdm_rx, self.probe) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - def carrier_sensed(self): - """ - Return True if we think carrier is present. - """ - #return self.probe.level() > X - return self.probe.unmuted() - - def carrier_threshold(self): - """ - Return current setting in dB. - """ - return self.probe.threshold() - - def set_carrier_threshold(self, threshold_in_db): - """ - Set carrier threshold. - - @param threshold_in_db: set detection threshold - @type threshold_in_db: float (dB) - """ - self.probe.set_threshold(threshold_in_db) - - - def add_options(normal, expert): - """ - Adds receiver-specific options to the Options Parser - """ - normal.add_option("-W", "--bandwidth", type="eng_float", - default=500e3, - help="set symbol bandwidth [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", default=False) - expert.add_option("", "--log", action="store_true", default=False, - help="Log all parts of flow graph to files (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - - def _print_verbage(self): - """ - Prints information about the receive path - """ - pass diff --git a/gr-digital/examples/ofdm/transmit_path.py b/gr-digital/examples/ofdm/transmit_path.py deleted file mode 100644 index ec357d617..000000000 --- a/gr-digital/examples/ofdm/transmit_path.py +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright 2005,2006,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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 -from gnuradio import eng_notation -from gnuradio import digital - -import copy -import sys - -# ///////////////////////////////////////////////////////////////////////////// -# transmit path -# ///////////////////////////////////////////////////////////////////////////// - -class transmit_path(gr.hier_block2): - def __init__(self, options): - ''' - See below for what options should hold - ''' - - gr.hier_block2.__init__(self, "transmit_path", - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, gr.sizeof_gr_complex)) - - options = copy.copy(options) # make a copy so we can destructively modify - - self._verbose = options.verbose # turn verbose mode on/off - self._tx_amplitude = options.tx_amplitude # digital amp sent to radio - - self.ofdm_tx = digital.ofdm_mod(options, - msgq_limit=4, - pad_for_usrp=False) - - self.amp = gr.multiply_const_cc(1) - self.set_tx_amplitude(self._tx_amplitude) - - # Display some information about the setup - if self._verbose: - self._print_verbage() - - # Create and setup transmit path flow graph - self.connect(self.ofdm_tx, self.amp, self) - - def set_tx_amplitude(self, ampl): - """ - Sets the transmit amplitude sent to the USRP - @param: ampl 0 <= ampl < 1.0. Try 0.10 - """ - self._tx_amplitude = max(0.0, min(ampl, 1)) - self.amp.set_k(self._tx_amplitude) - - def send_pkt(self, payload='', eof=False): - """ - Calls the transmitter method to send a packet - """ - return self.ofdm_tx.send_pkt(payload, eof) - - def add_options(normal, expert): - """ - Adds transmitter-specific options to the Options Parser - """ - normal.add_option("", "--tx-amplitude", type="eng_float", - default=0.1, metavar="AMPL", - help="set transmitter digital amplitude: 0 <= AMPL < 1.0 [default=%default]") - normal.add_option("-W", "--bandwidth", type="eng_float", - default=500e3, - help="set symbol bandwidth [default=%default]") - normal.add_option("-v", "--verbose", action="store_true", - default=False) - expert.add_option("", "--log", action="store_true", - default=False, - help="Log all parts of flow graph to file (CAUTION: lots of data)") - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the transmit path - """ - print "Tx amplitude %s" % (self._tx_amplitude) - diff --git a/gr-digital/examples/ofdm/tunnel.py b/gr-digital/examples/ofdm/tunnel.py deleted file mode 100755 index e253cf516..000000000 --- a/gr-digital/examples/ofdm/tunnel.py +++ /dev/null @@ -1,269 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2006,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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 2, or (at your option) -# any later version. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - - -# ///////////////////////////////////////////////////////////////////////////// -# -# This code sets up up a virtual ethernet interface (typically gr0), -# and relays packets between the interface and the GNU Radio PHY+MAC -# -# What this means in plain language, is that if you've got a couple -# of USRPs on different machines, and if you run this code on those -# machines, you can talk between them using normal TCP/IP networking. -# -# ///////////////////////////////////////////////////////////////////////////// - - -from gnuradio import gr, digital -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -# from current dir -from receive_path import receive_path -from transmit_path import transmit_path -from uhd_interface import uhd_transmitter -from uhd_interface import uhd_receiver - -import os, sys -import random, time, struct - -#print os.getpid() -#raw_input('Attach and press enter') - - -# ///////////////////////////////////////////////////////////////////////////// -# -# Use the Universal TUN/TAP device driver to move packets to/from kernel -# -# See /usr/src/linux/Documentation/networking/tuntap.txt -# -# ///////////////////////////////////////////////////////////////////////////// - -# Linux specific... -# TUNSETIFF ifr flags from <linux/tun_if.h> - -IFF_TUN = 0x0001 # tunnel IP packets -IFF_TAP = 0x0002 # tunnel ethernet frames -IFF_NO_PI = 0x1000 # don't pass extra packet info -IFF_ONE_QUEUE = 0x2000 # beats me ;) - -def open_tun_interface(tun_device_filename): - from fcntl import ioctl - - mode = IFF_TAP | IFF_NO_PI - TUNSETIFF = 0x400454ca - - tun = os.open(tun_device_filename, os.O_RDWR) - ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode)) - ifname = ifs[:16].strip("\x00") - return (tun, ifname) - - -# ///////////////////////////////////////////////////////////////////////////// -# the flow graph -# ///////////////////////////////////////////////////////////////////////////// - -class my_top_block(gr.top_block): - def __init__(self, callback, options): - gr.top_block.__init__(self) - - self.source = uhd_receiver(options.args, - options.bandwidth, - options.rx_freq, options.rx_gain, - options.spec, options.antenna, - options.verbose) - - self.sink = uhd_transmitter(options.args, - options.bandwidth, - options.tx_freq, options.tx_gain, - options.spec, options.antenna, - options.verbose) - - self.txpath = transmit_path(options) - self.rxpath = receive_path(callback, options) - - self.connect(self.txpath, self.sink) - self.connect(self.source, self.rxpath) - - def carrier_sensed(self): - """ - Return True if the receive path thinks there's carrier - """ - return self.rxpath.carrier_sensed() - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - """ - self.u_snk.set_freq(target_freq) - self.u_src.set_freq(target_freq) - - -# ///////////////////////////////////////////////////////////////////////////// -# Carrier Sense MAC -# ///////////////////////////////////////////////////////////////////////////// - -class cs_mac(object): - """ - Prototype carrier sense MAC - - Reads packets from the TUN/TAP interface, and sends them to the PHY. - Receives packets from the PHY via phy_rx_callback, and sends them - into the TUN/TAP interface. - - Of course, we're not restricted to getting packets via TUN/TAP, this - is just an example. - """ - def __init__(self, tun_fd, verbose=False): - self.tun_fd = tun_fd # file descriptor for TUN/TAP interface - self.verbose = verbose - self.tb = None # top block (access to PHY) - - def set_flow_graph(self, tb): - self.tb = tb - - def phy_rx_callback(self, ok, payload): - """ - Invoked by thread associated with PHY to pass received packet up. - - @param ok: bool indicating whether payload CRC was OK - @param payload: contents of the packet (string) - """ - if self.verbose: - print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload)) - if ok: - os.write(self.tun_fd, payload) - - def main_loop(self): - """ - Main loop for MAC. - Only returns if we get an error reading from TUN. - - FIXME: may want to check for EINTR and EAGAIN and reissue read - """ - min_delay = 0.001 # seconds - - while 1: - payload = os.read(self.tun_fd, 10*1024) - if not payload: - self.tb.txpath.send_pkt(eof=True) - break - - if self.verbose: - print "Tx: len(payload) = %4d" % (len(payload),) - - delay = min_delay - while self.tb.carrier_sensed(): - sys.stderr.write('B') - time.sleep(delay) - if delay < 0.050: - delay = delay * 2 # exponential back-off - - self.tb.txpath.send_pkt(payload) - - -# ///////////////////////////////////////////////////////////////////////////// -# main -# ///////////////////////////////////////////////////////////////////////////// - -def main(): - - parser = OptionParser (option_class=eng_option, conflict_handler="resolve") - expert_grp = parser.add_option_group("Expert") - - parser.add_option("-m", "--modulation", type="choice", choices=['bpsk', 'qpsk'], - default='bpsk', - help="Select modulation from: bpsk, qpsk [default=%%default]") - - parser.add_option("-v","--verbose", action="store_true", default=False) - expert_grp.add_option("-c", "--carrier-threshold", type="eng_float", default=30, - help="set carrier detect threshold (dB) [default=%default]") - expert_grp.add_option("","--tun-device-filename", default="/dev/net/tun", - help="path to tun device file [default=%default]") - - digital.ofdm_mod.add_options(parser, expert_grp) - digital.ofdm_demod.add_options(parser, expert_grp) - transmit_path.add_options(parser, expert_grp) - receive_path.add_options(parser, expert_grp) - uhd_receiver.add_options(parser) - uhd_transmitter.add_options(parser) - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help(sys.stderr) - sys.exit(1) - - if options.rx_freq is None or options.tx_freq is None: - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - parser.print_help(sys.stderr) - sys.exit(1) - - # open the TUN/TAP interface - (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename) - - # Attempt to enable realtime scheduling - r = gr.enable_realtime_scheduling() - if r == gr.RT_OK: - realtime = True - else: - realtime = False - print "Note: failed to enable realtime scheduling" - - # instantiate the MAC - mac = cs_mac(tun_fd, verbose=True) - - - # build the graph (PHY) - tb = my_top_block(mac.phy_rx_callback, options) - - mac.set_flow_graph(tb) # give the MAC a handle for the PHY - - print "modulation: %s" % (options.modulation,) - print "freq: %s" % (eng_notation.num_to_str(options.tx_freq)) - - tb.rxpath.set_carrier_threshold(options.carrier_threshold) - print "Carrier sense threshold:", options.carrier_threshold, "dB" - - print - print "Allocated virtual ethernet interface: %s" % (tun_ifname,) - print "You must now use ifconfig to set its IP address. E.g.," - print - print " $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,) - print - print "Be sure to use a different address in the same subnet for each machine." - print - - - tb.start() # Start executing the flow graph (runs in separate threads) - - mac.main_loop() # don't expect this to return... - - tb.stop() # but if it does, tell flow graph to stop. - tb.wait() # wait for it to finish - - -if __name__ == '__main__': - try: - main() - except KeyboardInterrupt: - pass diff --git a/gr-digital/examples/ofdm/uhd_interface.py b/gr-digital/examples/ofdm/uhd_interface.py deleted file mode 100644 index e4b13955d..000000000 --- a/gr-digital/examples/ofdm/uhd_interface.py +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2010,2011 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; 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, uhd -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -import sys - -def add_freq_option(parser): - """ - Hackery that has the -f / --freq option set both tx_freq and rx_freq - """ - def freq_callback(option, opt_str, value, parser): - parser.values.rx_freq = value - parser.values.tx_freq = value - - if not parser.has_option('--freq'): - parser.add_option('-f', '--freq', type="eng_float", - action="callback", callback=freq_callback, - help="set Tx and/or Rx frequency to FREQ [default=%default]", - metavar="FREQ") - -class uhd_interface: - def __init__(self, istx, args, bandwidth, freq=None, - gain=None, spec=None, antenna=None): - - if(istx): - self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32')) - else: - self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32')) - - # Set the subdevice spec - if(spec): - self.u.set_subdev_spec(spec, 0) - - # Set the antenna - if(antenna): - self.u.set_antenna(antenna, 0) - - self._args = args - self._ant = antenna - self._spec = spec - self._gain = self.set_gain(gain) - self._freq = self.set_freq(freq) - - self._rate = self.set_sample_rate(bandwidth) - - def set_sample_rate(self, bandwidth): - self.u.set_samp_rate(bandwidth) - actual_bw = self.u.get_samp_rate() - - return actual_bw - - def get_sample_rate(self): - return self.u.get_samp_rate() - - def set_gain(self, gain=None): - if gain is None: - # if no gain was specified, use the mid-point in dB - g = self.u.get_gain_range() - gain = float(g.start()+g.stop())/2 - print "\nNo gain specified." - print "Setting gain to %f (from [%f, %f])" % \ - (gain, g.start(), g.stop()) - - self.u.set_gain(gain, 0) - return gain - - def set_freq(self, freq=None): - if(freq is None): - sys.stderr.write("You must specify -f FREQ or --freq FREQ\n") - sys.exit(1) - - r = self.u.set_center_freq(freq, 0) - if r: - return freq - else: - frange = self.u.get_freq_range() - sys.stderr.write(("\nRequested frequency (%f) out or range [%f, %f]\n") % \ - (freq, frange.start(), frange.stop())) - sys.exit(1) - -#-------------------------------------------------------------------# -# TRANSMITTER -#-------------------------------------------------------------------# - -class uhd_transmitter(uhd_interface, gr.hier_block2): - def __init__(self, args, bandwidth, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_transmitter", - gr.io_signature(1,1,gr.sizeof_gr_complex), - gr.io_signature(0,0,0)) - - # Set up the UHD interface as a transmitter - uhd_interface.__init__(self, True, args, bandwidth, - freq, gain, spec, antenna) - - self.connect(self, self.u) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--tx-freq", type="eng_float", default=None, - help="set transmit frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--tx-gain", type="eng_float", default=None, - help="set transmit gain in dB (default is midpoint)") - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Transmitter:" - print "UHD Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Subdev Sec: %s" % (self._spec) - - - -#-------------------------------------------------------------------# -# RECEIVER -#-------------------------------------------------------------------# - - -class uhd_receiver(uhd_interface, gr.hier_block2): - def __init__(self, args, bandwidth, freq=None, gain=None, - spec=None, antenna=None, verbose=False): - gr.hier_block2.__init__(self, "uhd_receiver", - gr.io_signature(0,0,0), - gr.io_signature(1,1,gr.sizeof_gr_complex)) - - # Set up the UHD interface as a receiver - uhd_interface.__init__(self, False, args, bandwidth, - freq, gain, spec, antenna) - - self.connect(self.u, self) - - if(verbose): - self._print_verbage() - - def add_options(parser): - add_freq_option(parser) - parser.add_option("-a", "--args", type="string", default="", - help="UHD device address args [default=%default]") - parser.add_option("", "--spec", type="string", default=None, - help="Subdevice of UHD device where appropriate") - parser.add_option("-A", "--antenna", type="string", default=None, - help="select Rx Antenna where appropriate") - parser.add_option("", "--rx-freq", type="eng_float", default=None, - help="set receive frequency to FREQ [default=%default]", - metavar="FREQ") - parser.add_option("", "--rx-gain", type="eng_float", default=None, - help="set receive gain in dB (default is midpoint)") - if not parser.has_option("--verbose"): - parser.add_option("-v", "--verbose", action="store_true", default=False) - - # Make a static method to call before instantiation - add_options = staticmethod(add_options) - - def _print_verbage(self): - """ - Prints information about the UHD transmitter - """ - print "\nUHD Receiver:" - print "UHD Args: %s" % (self._args) - print "Freq: %sHz" % (eng_notation.num_to_str(self._freq)) - print "Gain: %f dB" % (self._gain) - print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)) - print "Antenna: %s" % (self._ant) - print "Subdev Sec: %s" % (self._spec) - diff --git a/gr-digital/examples/run_length.py b/gr-digital/examples/run_length.py deleted file mode 100755 index 5020655db..000000000 --- a/gr-digital/examples/run_length.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio 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. -# -# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from optparse import OptionParser -import sys - -def main(): - parser = OptionParser() - parser.add_option("-f", "--file", default=None, - help="Choose file to read data from.") - (options, args) = parser.parse_args() - - if options.file == None: - print "Must specify file to read from using '-f'." - sys.exit(1) - print "Using", options.file, "for data." - - f = open(options.file, 'r') - runs = [] - count = 0 - current = 0 - bytes = 0 - bits = 0 - - for ch in f.read(): - x = ord(ch) - bytes = bytes + 1 - for i in range(7,-1,-1): - bits = bits + 1 - t = (x >> i) & 0x1 - if t == current: - count = count + 1 - else: - if count > 0: - if len(runs) < count: - for j in range(count - len(runs)): - runs.append(0); - runs[count-1] = runs[count-1] + 1 - - current = 1-current; - count = 1 - - # Deal with last run at EOF - if len(runs) < count and count > 0: - for j in range(count - len(runs)): - runs.append(0); - runs[count-1] = runs[count-1] + 1 - - chk = 0 - print "Bytes read: ", bytes - print "Bits read: ", bits - print - for i in range(len(runs)): - chk = chk + runs[i]*(i+1) - print "Runs of length", i+1, ":", runs[i] - print - print "Sum of runs:", chk, "bits" - print - print "Maximum run length is", len(runs), "bits" - -if __name__ == "__main__": - main() - - diff --git a/gr-digital/examples/snr_estimators.py b/gr-digital/examples/snr_estimators.py deleted file mode 100755 index 432abd455..000000000 --- a/gr-digital/examples/snr_estimators.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python - -import sys - -try: - import scipy - from scipy import stats -except ImportError: - print "Error: Program requires scipy (www.scipy.org)." - sys.exit(1) - -try: - import pylab -except ImportError: - print "Error: Program requires Matplotlib (matplotlib.sourceforge.net)." - sys.exit(1) - -from gnuradio import gr, digital -from optparse import OptionParser -from gnuradio.eng_option import eng_option - -''' -This example program uses Python and GNU Radio to calculate SNR of a -noise BPSK signal to compare them. - -For an explination of the online algorithms, see: -http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Higher-order_statistics -''' - -def online_skewness(data, alpha): - n = 0 - mean = 0 - M2 = 0 - M3 = 0 - d_M3 = 0 - - for n in xrange(len(data)): - delta = data[n] - mean - delta_n = delta / (n+1) - term1 = delta * delta_n * (n) - mean = mean + delta_n - M3 = term1 * delta_n * (n - 1) - 3 * delta_n * M2 - M2 = M2 + term1 - d_M3 = (0.001)*M3 + (1-0.001)*d_M3; - - return d_M3 - -def snr_est_simple(signal): - y1 = scipy.mean(abs(signal)) - y2 = scipy.real(scipy.mean(signal**2)) - y3 = (y1*y1 - y2) - snr_rat = y1*y1/y3 - return 10.0*scipy.log10(snr_rat), snr_rat - -def snr_est_skew(signal): - y1 = scipy.mean(abs(signal)) - y2 = scipy.mean(scipy.real(signal**2)) - y3 = (y1*y1 - y2) - y4 = online_skewness(abs(signal.real), 0.001) - - skw = y4*y4 / (y2*y2*y2); - snr_rat = y1*y1 / (y3 + skw*y1*y1) - return 10.0*scipy.log10(snr_rat), snr_rat - -def snr_est_m2m4(signal): - M2 = scipy.mean(abs(signal)**2) - M4 = scipy.mean(abs(signal)**4) - snr_rat = 2*scipy.sqrt(2*M2*M2 - M4) / (M2 - scipy.sqrt(2*M2*M2 - M4)) - return 10.0*scipy.log10(snr_rat), snr_rat - -def snr_est_svr(signal): - N = len(signal) - ssum = 0 - msum = 0 - for i in xrange(1, N): - ssum += (abs(signal[i])**2)*(abs(signal[i-1])**2) - msum += (abs(signal[i])**4) - savg = (1.0/(float(N)-1.0))*ssum - mavg = (1.0/(float(N)-1.0))*msum - beta = savg / (mavg - savg) - - snr_rat = 2*((beta - 1) + scipy.sqrt(beta*(beta-1))) - return 10.0*scipy.log10(snr_rat), snr_rat - - -def main(): - gr_estimators = {"simple": digital.SNR_EST_SIMPLE, - "skew": digital.SNR_EST_SKEW, - "m2m4": digital.SNR_EST_M2M4, - "svr": digital.SNR_EST_SVR} - py_estimators = {"simple": snr_est_simple, - "skew": snr_est_skew, - "m2m4": snr_est_m2m4, - "svr": snr_est_svr} - - - parser = OptionParser(option_class=eng_option, conflict_handler="resolve") - parser.add_option("-N", "--nsamples", type="int", default=10000, - help="Set the number of samples to process [default=%default]") - parser.add_option("", "--snr-min", type="float", default=-5, - help="Minimum SNR [default=%default]") - parser.add_option("", "--snr-max", type="float", default=20, - help="Maximum SNR [default=%default]") - parser.add_option("", "--snr-step", type="float", default=0.5, - help="SNR step amount [default=%default]") - parser.add_option("-t", "--type", type="choice", - choices=gr_estimators.keys(), default="simple", - help="Estimator type {0} [default=%default]".format( - gr_estimators.keys())) - (options, args) = parser.parse_args () - - N = options.nsamples - xx = scipy.random.randn(N) - xy = scipy.random.randn(N) - bits = 2*scipy.complex64(scipy.random.randint(0, 2, N)) - 1 - - snr_known = list() - snr_python = list() - snr_gr = list() - - # when to issue an SNR tag; can be ignored in this example. - ntag = 10000 - - n_cpx = xx + 1j*xy - - py_est = py_estimators[options.type] - gr_est = gr_estimators[options.type] - - SNR_min = options.snr_min - SNR_max = options.snr_max - SNR_step = options.snr_step - SNR_dB = scipy.arange(SNR_min, SNR_max+SNR_step, SNR_step) - for snr in SNR_dB: - SNR = 10.0**(snr/10.0) - scale = scipy.sqrt(SNR) - yy = bits + n_cpx/scale - print "SNR: ", snr - - Sknown = scipy.mean(yy**2) - Nknown = scipy.var(n_cpx/scale)/2 - snr0 = Sknown/Nknown - snr0dB = 10.0*scipy.log10(snr0) - snr_known.append(snr0dB) - - snrdB, snr = py_est(yy) - snr_python.append(snrdB) - - gr_src = gr.vector_source_c(bits.tolist(), False) - gr_snr = digital.mpsk_snr_est_cc(gr_est, ntag, 0.001) - gr_chn = gr.channel_model(1.0/scale) - gr_snk = gr.null_sink(gr.sizeof_gr_complex) - tb = gr.top_block() - tb.connect(gr_src, gr_chn, gr_snr, gr_snk) - tb.run() - - snr_gr.append(gr_snr.snr()) - - f1 = pylab.figure(1) - s1 = f1.add_subplot(1,1,1) - s1.plot(SNR_dB, snr_known, "k-o", linewidth=2, label="Known") - s1.plot(SNR_dB, snr_python, "b-o", linewidth=2, label="Python") - s1.plot(SNR_dB, snr_gr, "g-o", linewidth=2, label="GNU Radio") - s1.grid(True) - s1.set_title('SNR Estimators') - s1.set_xlabel('SNR (dB)') - s1.set_ylabel('Estimated SNR') - s1.legend() - - pylab.show() - - -if __name__ == "__main__": - main() - |