[MERGED] osmo-tetra[master]: Add simdemod2.py, a simple demodulator without GUI

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Dec 18 16:11:53 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: Add simdemod2.py, a simple demodulator without GUI
......................................................................


Add simdemod2.py, a simple demodulator without GUI

Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de
---
A src/demod/python/simdemod2.py
A src/receiver1
A src/receiver2
3 files changed, 101 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/src/demod/python/simdemod2.py b/src/demod/python/simdemod2.py
new file mode 100755
index 0000000..6b6fe2b
--- /dev/null
+++ b/src/demod/python/simdemod2.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+# osmosdr-tetra_demod_fft.py Copyright 2012 Dimitri Stolnikov <horiz0n at gmx.net>
+
+# simdemod.py (c) 2014 Jacek Lipkowski <sq5bpf at lipkowski.org>
+# this is a modified osmosdr-tetra_demod_fft.py with all of the gui stuff
+# removed. is is intended to be fed from a receiver program via a pipe
+# 
+# mkfifo /tmp/fifo1
+# demod/python/simdemod.py -o /dev/stdout -i /tmp/fifo1 | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin 
+#
+
+import sys
+import math
+from gnuradio import gr, gru, eng_notation, blks2, optfir
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+import osmosdr
+
+try:
+    import cqpsk
+except:
+    from tetra_demod import cqpsk
+
+# applies frequency translation, resampling and demodulation
+
+class top_block(gr.top_block):
+  def __init__(self):
+    gr.top_block.__init__(self, "Top Block")
+
+    options = get_options()
+    self.input_file=options.input_file
+    self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1, self.input_file, True)
+
+    symbol_rate = 18000
+    sps = 2 # output rate will be 36,000
+    out_sample_rate = symbol_rate * sps
+
+    options.low_pass = options.low_pass / 2.0
+
+    self.demod = cqpsk.cqpsk_demod(
+        samples_per_symbol = sps,
+        excess_bw=0.35,
+        costas_alpha=0.03,
+        gain_mu=0.05,
+        mu=0.05,
+        omega_relative_limit=0.05,
+        log=options.log,
+        verbose=options.verbose)
+
+    self.output = gr.file_sink(gr.sizeof_float, options.output_file)
+
+    self.connect(self.gr_file_source_0, self.demod, self.output)
+
+
+
+
+
+
+def get_options():
+    parser = OptionParser(option_class=eng_option)
+
+    # demodulator related settings
+    parser.add_option("-l", "--log", action="store_true", default=False, help="dump debug .dat files")
+    parser.add_option("-i", "--input-file", type="string", default="in.float", help="specify the bit input file")
+    parser.add_option("-o", "--output-file", type="string", default="out.float", help="specify the bit output file")
+    parser.add_option("-v", "--verbose", action="store_true", default=False, help="dump demodulation data")
+    parser.add_option("-L", "--low-pass", type="eng_float", default=25e3, help="low pass cut-off", metavar="Hz")
+
+    (options, args) = parser.parse_args()
+    if len(args) != 0:
+        parser.print_help()
+        raise SystemExit, 1
+
+    return (options)
+
+if __name__ == '__main__':
+        tb = top_block()
+        tb.run()
+        #tb.run(True)
diff --git a/src/receiver1 b/src/receiver1
new file mode 100755
index 0000000..9b585ca
--- /dev/null
+++ b/src/receiver1
@@ -0,0 +1,10 @@
+#!/bin/sh
+# This is an example how to use simdemod.py --sq5bpf
+export TETRA_HACK_PORT=7379
+export TETRA_HACK_RXID=$1
+FIFO=/tmp/fifo$1
+mkfifo $FIFO
+ulimit -c unlimited
+demod/python/simdemod2.py -o /dev/stdout -i $FIFO | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin 
+
+
diff --git a/src/receiver2 b/src/receiver2
new file mode 100755
index 0000000..5a153a5
--- /dev/null
+++ b/src/receiver2
@@ -0,0 +1,11 @@
+#!/bin/sh
+# This is an example how to use simdemod.py --sq5bpf
+# this is receiver 1, only with the port changed, it will be used in the example documentation
+export TETRA_HACK_PORT=7380 #i might as well have made this a command line parameter, oh well :)
+export TETRA_HACK_RXID=$1
+FIFO=/tmp/fifo$1
+mkfifo $FIFO
+ulimit -c unlimited
+demod/python/simdemod2.py -o /dev/stdout -i $FIFO | ./float_to_bits /dev/stdin /dev/stdout | ./tetra-rx /dev/stdin 
+
+

-- 
To view, visit https://gerrit.osmocom.org/1447
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibad17350db1b00f87955684e4cc17e0a5e8ea6de
Gerrit-PatchSet: 1
Gerrit-Project: osmo-tetra
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list