From d68d780daf0be139af986f66a08867b4d29c701f Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 5 Jun 2018 11:45:34 +0300 Subject: Final changes, showtime --- fm.grc | 14 ++++++------- talk.ipynb | 17 +++++++++------- talk.slides.html | 19 ++++++++++------- top_block.py | 62 ++++++++------------------------------------------------ 4 files changed, 37 insertions(+), 75 deletions(-) diff --git a/fm.grc b/fm.grc index 3637357..a9b9959 100644 --- a/fm.grc +++ b/fm.grc @@ -30,7 +30,7 @@ _coordinate - (8, 8) + (24, 20) _rotation @@ -38,7 +38,7 @@ generate_options - qt_gui + no_gui hier_block_src_path @@ -186,7 +186,7 @@ _coordinate - (640, 168) + (656, 196) _rotation @@ -233,7 +233,7 @@ _coordinate - (1080, 176) + (1112, 204) _rotation @@ -292,7 +292,7 @@ _coordinate - (400, 124) + (432, 156) _rotation @@ -359,7 +359,7 @@ _coordinate - (872, 152) + (896, 180) _rotation @@ -1694,7 +1694,7 @@ _coordinate - (152, 108) + (168, 140) _rotation diff --git a/talk.ipynb b/talk.ipynb index 629fc73..207cf32 100644 --- a/talk.ipynb +++ b/talk.ipynb @@ -10,7 +10,7 @@ "source": [ "# Pulling radio data out of thin air\n", "\n", - "## Pycon Israel 2018" + "## Yuval Adam" ] }, { @@ -24,8 +24,9 @@ "## Yuval Adam\n", "\n", " - Full stack developer and systems architecture consultant\n", + " - Using Python for **everything** for 10+ years\n", " - https://yuv.al\n", - " - @yuvadm\n", + " - [@yuvadm](https://twitter.com/yuvadm)\n", "\n" ] }, @@ -242,7 +243,7 @@ "\n", "sdr = RtlSdr()\n", "sdr.sample_rate = 1.2e6 # 1,200,000 samples per second\n", - "sdr.center_freq = 91.8e6 # 91,800,00 Hz frequency for the radio station\n", + "sdr.center_freq = 91.8e6 # 91,800,000 Hz frequency for the radio station\n", "sdr.gain = 'auto' # tune the gain (AKA \"volume\") automatically\n", "\n", "samples = sdr.read_samples(1.2e6 * 10)\n", @@ -318,7 +319,7 @@ "outputs": [], "source": [ "# De-emphasis filter\n", - "# Even I'm not sure how/why this works\n", + "# Even I'm not sure exactly how/why this works\n", "\n", "# MAKE THINGS SOUND BETTER\n", "\n", @@ -353,7 +354,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": { "slideshow": { "slide_type": "subslide" @@ -387,8 +388,8 @@ "## Review\n", "\n", " - Took a fixed set of samples, did some math on them\n", - " - Python, NumPy and SciPy are **very** good at doing fast processing of static data\n", - " - When handling real-time data, buffering becomes a serious issue\n", + " - Python, NumPy and SciPy are very good at doing fast processing of **static** data\n", + " - When handling **real-time** data, buffering becomes a serious issue\n", " - How do you synchronize different input/ouput sample rates on the same flow?" ] }, @@ -424,6 +425,8 @@ " - https://osmocom.org/projects/sdr/wiki/rtl-sdr\n", " - https://www.reddit.com/r/RTLSDR/wiki/index\n", " - Michael Ossmann's video course - https://greatscottgadgets.com/sdr/\n", + " - But you don't really need do know math\n", + " - Lots of code is already written\n", " - Explore the radio waves!" ] }, diff --git a/talk.slides.html b/talk.slides.html index c0f8d97..4dd7b00 100644 --- a/talk.slides.html +++ b/talk.slides.html @@ -11905,7 +11905,7 @@ a.anchor-link {
-

Pulling radio data out of thin air

Pycon Israel 2018

+

Pulling radio data out of thin air

Yuval Adam

@@ -11915,8 +11915,9 @@ a.anchor-link {

Yuval Adam

  • Full stack developer and systems architecture consultant
  • +
  • Using Python for everything for 10+ years
  • https://yuv.al
  • -
  • @yuvadm
  • +
  • @yuvadm
@@ -12074,7 +12075,7 @@ a.anchor-link { sdr = RtlSdr() sdr.sample_rate = 1.2e6 # 1,200,000 samples per second -sdr.center_freq = 91.8e6 # 91,800,00 Hz frequency for the radio station +sdr.center_freq = 91.8e6 # 91,800,000 Hz frequency for the radio station sdr.gain = 'auto' # tune the gain (AKA "volume") automatically samples = sdr.read_samples(1.2e6 * 10) @@ -12150,7 +12151,7 @@ a.anchor-link {
# De-emphasis filter
-# Even I'm not sure how/why this works
+# Even I'm not sure exactly how/why this works
 
 # MAKE THINGS SOUND BETTER
 
@@ -12190,7 +12191,7 @@ a.anchor-link {
 
-
In [7]:
+
In [6]:
# HIT IT
@@ -12219,8 +12220,8 @@ a.anchor-link {
 

Review

  • Took a fixed set of samples, did some math on them
  • -
  • Python, NumPy and SciPy are very good at doing fast processing of static data
  • -
  • When handling real-time data, buffering becomes a serious issue
      +
    • Python, NumPy and SciPy are very good at doing fast processing of static data
    • +
    • When handling real-time data, buffering becomes a serious issue
      • How do you synchronize different input/ouput sample rates on the same flow?
    • @@ -12258,6 +12259,10 @@ a.anchor-link {
    • Michael Ossmann's video course - https://greatscottgadgets.com/sdr/
  • +
  • But you don't really need do know math
      +
    • Lots of code is already written
    • +
    +
  • Explore the radio waves!
diff --git a/top_block.py b/top_block.py index 8e104f7..344ef7d 100755 --- a/top_block.py +++ b/top_block.py @@ -3,20 +3,9 @@ ################################################## # GNU Radio Python Flow Graph # Title: Top Block -# Generated: Mon May 28 19:47:27 2018 +# Generated: Tue Jun 5 07:29:57 2018 ################################################## -if __name__ == '__main__': - import ctypes - import sys - if sys.platform.startswith('linux'): - try: - x11 = ctypes.cdll.LoadLibrary('libX11.so') - x11.XInitThreads() - except: - print "Warning: failed to XInitThreads()" - -from PyQt4 import Qt from gnuradio import analog from gnuradio import audio from gnuradio import eng_notation @@ -26,36 +15,13 @@ from gnuradio.eng_option import eng_option from gnuradio.filter import firdes from optparse import OptionParser import osmosdr -import sys import time -from gnuradio import qtgui -class top_block(gr.top_block, Qt.QWidget): +class top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self, "Top Block") - Qt.QWidget.__init__(self) - self.setWindowTitle("Top Block") - qtgui.util.check_set_qss() - try: - self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) - except: - pass - self.top_scroll_layout = Qt.QVBoxLayout() - self.setLayout(self.top_scroll_layout) - self.top_scroll = Qt.QScrollArea() - self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) - self.top_scroll_layout.addWidget(self.top_scroll) - self.top_scroll.setWidgetResizable(True) - self.top_widget = Qt.QWidget() - self.top_scroll.setWidget(self.top_widget) - self.top_layout = Qt.QVBoxLayout(self.top_widget) - self.top_grid_layout = Qt.QGridLayout() - self.top_layout.addLayout(self.top_grid_layout) - - self.settings = Qt.QSettings("GNU Radio", "top_block") - self.restoreGeometry(self.settings.value("geometry").toByteArray()) ################################################## # Variables @@ -102,11 +68,6 @@ class top_block(gr.top_block, Qt.QWidget): self.connect((self.rational_resampler_xxx_0, 0), (self.audio_sink_0, 0)) self.connect((self.rtlsdr_source_0, 0), (self.low_pass_filter_0, 0)) - def closeEvent(self, event): - self.settings = Qt.QSettings("GNU Radio", "top_block") - self.settings.setValue("geometry", self.saveGeometry()) - event.accept() - def get_samp_rate(self): return self.samp_rate @@ -131,21 +92,14 @@ class top_block(gr.top_block, Qt.QWidget): def main(top_block_cls=top_block, options=None): - from distutils.version import StrictVersion - if StrictVersion(Qt.qVersion()) >= StrictVersion("4.5.0"): - style = gr.prefs().get_string('qtgui', 'style', 'raster') - Qt.QApplication.setGraphicsSystem(style) - qapp = Qt.QApplication(sys.argv) - tb = top_block_cls() tb.start() - tb.show() - - def quitting(): - tb.stop() - tb.wait() - qapp.connect(qapp, Qt.SIGNAL("aboutToQuit()"), quitting) - qapp.exec_() + try: + raw_input('Press Enter to quit: ') + except EOFError: + pass + tb.stop() + tb.wait() if __name__ == '__main__': -- cgit v1.3.1