/usr/bin/polar_channel_construction is in gnuradio 3.7.9.1-2ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #!/usr/bin/python
#
# Copyright 2015 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.
#
""" A tool for POLAR code channel construction."""
from optparse import OptionParser
import gnuradio.fec.polar as cc
def setup_parser():
""" Init the option parser. If derived classes need to add options,
override this and call the parent function. """
parser = OptionParser(add_help_option=False)
parser.usage = '%prog [blocksize] [designsnr] [mu]'
parser.add_option("-h", "--help", action="help", help="Displays this help message.")
parser.add_option("-c", "--channel", action="store", type="string", dest="channel",
help="specify channel, currently BEC or AWGN (default='BEC')", default='BEC')
parser.add_option("-b", "--blocksize", action="store", type="int", dest="block_size",
help="specify block size of polar code (default=16)", default=16)
parser.add_option("-s", "--desgin-snr", action="store", type="float", dest="design_snr",
help="specify design SNR of polar code (default=0.0)", default=0.0)
parser.add_option("-k", "--mu", action="store", type="int", dest="mu",
help="specify block size of polar code (default=2)", default=2)
return parser
def main():
""" Here we go. Parse command, choose class and run. """
print('POLAR code channel constructor commandline tool')
parser = setup_parser()
(options, args) = parser.parse_args()
channel = str(options.channel)
block_size = int(options.block_size)
design_snr = float(options.design_snr)
mu = int(options.mu)
if len(args) > 0:
channel = str(args[0])
if len(args) > 1:
block_size = int(args[1])
if len(args) > 2:
design_snr = float(args[2])
if len(args) == 4:
mu = int(args[3])
z_params = cc.get_z_params(False, channel, block_size, design_snr, mu)
print(z_params)
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass
|