[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r9745 - in gnuradio/trunk/grc: . data/platforms/python
From: |
jblum |
Subject: |
[Commit-gnuradio] r9745 - in gnuradio/trunk/grc: . data/platforms/python data/platforms/python/blocks src/grc_gnuradio/blks2 src/platforms/python |
Date: |
Tue, 7 Oct 2008 23:18:20 -0600 (MDT) |
Author: jblum
Date: 2008-10-07 23:18:19 -0600 (Tue, 07 Oct 2008)
New Revision: 9745
Added:
gnuradio/trunk/grc/data/platforms/python/blocks/probe_function.xml
Modified:
gnuradio/trunk/grc/data/platforms/python/block_tree.xml
gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am
gnuradio/trunk/grc/data/platforms/python/blocks/gr_probe_mpsk_snr_c.xml
gnuradio/trunk/grc/src/grc_gnuradio/blks2/__init__.py
gnuradio/trunk/grc/src/grc_gnuradio/blks2/probe.py
gnuradio/trunk/grc/src/platforms/python/Generator.py
gnuradio/trunk/grc/todo.txt
Log:
probe function block
Modified: gnuradio/trunk/grc/data/platforms/python/block_tree.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/block_tree.xml 2008-10-08
04:23:47 UTC (rev 9744)
+++ gnuradio/trunk/grc/data/platforms/python/block_tree.xml 2008-10-08
05:18:19 UTC (rev 9745)
@@ -241,6 +241,7 @@
<block>gr_probe_avg_mag_sqrd_x</block>
<block>gr_probe_density_b</block>
<block>gr_probe_mpsk_snr_c</block>
+ <block>probe_function</block>
</cat>
<cat>
<name>USRP</name>
Modified: gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am 2008-10-08
04:23:47 UTC (rev 9744)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/Makefile.am 2008-10-08
05:18:19 UTC (rev 9745)
@@ -184,6 +184,7 @@
pad_source.xml \
parameter.xml \
preferences.xml \
+ probe_function.xml \
random_source_x.xml \
trellis_encoder_xx.xml \
trellis_metrics_x.xml \
Modified:
gnuradio/trunk/grc/data/platforms/python/blocks/gr_probe_mpsk_snr_c.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/gr_probe_mpsk_snr_c.xml
2008-10-08 04:23:47 UTC (rev 9744)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/gr_probe_mpsk_snr_c.xml
2008-10-08 05:18:19 UTC (rev 9745)
@@ -9,7 +9,7 @@
<key>gr_probe_mpsk_snr_c</key>
<import>from grc_gnuradio import blks2 as grc_blks2</import>
<make>grc_blks2.probe_mpsk_snr_c(
- type="$type",
+ type="$type",
alpha=$alpha,
probe_rate=$probe_rate,
)</make>
Added: gnuradio/trunk/grc/data/platforms/python/blocks/probe_function.xml
===================================================================
--- gnuradio/trunk/grc/data/platforms/python/blocks/probe_function.xml
(rev 0)
+++ gnuradio/trunk/grc/data/platforms/python/blocks/probe_function.xml
2008-10-08 05:18:19 UTC (rev 9745)
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Probe Function
+###################################################
+ -->
+<block>
+ <name>Probe Function</name>
+ <key>probe_function</key>
+ <import>from grc_gnuradio import blks2 as grc_blks2</import>
+ <make>grc_blks2.probe_function(
+ probe_callback=self.$(block_id.eval).$(function_name.eval),
+ probe_rate=$probe_rate,
+)</make>
+ <callback>set_probe_rate($probe_rate)</callback>
+ <param>
+ <name>Block ID</name>
+ <key>block_id</key>
+ <value>my_block_0</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Function Name</name>
+ <key>function_name</key>
+ <value>get_number</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Probe Rate</name>
+ <key>probe_rate</key>
+ <value>10</value>
+ <type>real</type>
+ </param>
+ <source>
+ <name>out</name>
+ <type>float</type>
+ </source>
+ <doc>
+Polls a function of an arbitrary block and writes the value to the output
port. \
+The block id is the id of another block in the flow graph. \
+The function name is the name of a function in the said block. \
+The function should take no arguments and return a floating point or integer
number.
+ </doc>
+</block>
Modified: gnuradio/trunk/grc/src/grc_gnuradio/blks2/__init__.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/blks2/__init__.py 2008-10-08
04:23:47 UTC (rev 9744)
+++ gnuradio/trunk/grc/src/grc_gnuradio/blks2/__init__.py 2008-10-08
05:18:19 UTC (rev 9745)
@@ -25,4 +25,4 @@
from selector import selector, valve
from packet import packet_encoder, packet_decoder
from error_rate import error_rate
-from probe import probe_avg_mag_sqrd_c, probe_avg_mag_sqrd_f, probe_density_b,
probe_mpsk_snr_c
+from probe import probe_function, probe_avg_mag_sqrd_c, probe_avg_mag_sqrd_f,
probe_density_b, probe_mpsk_snr_c
Modified: gnuradio/trunk/grc/src/grc_gnuradio/blks2/probe.py
===================================================================
--- gnuradio/trunk/grc/src/grc_gnuradio/blks2/probe.py 2008-10-08 04:23:47 UTC
(rev 9744)
+++ gnuradio/trunk/grc/src/grc_gnuradio/blks2/probe.py 2008-10-08 05:18:19 UTC
(rev 9745)
@@ -24,17 +24,19 @@
import numpy
import time
-class _probe_base(gr.hier_block2, threading.Thread):
+#######################################################################################
+## Probe: Function
+#######################################################################################
+class probe_function(gr.hier_block2, threading.Thread):
"""
- A hier2 block with float output and probe input.
- The thread polls the prope for values and writes to a message source.
+ The thread polls the function for values and writes to a message source.
"""
- def __init__(self, probe_block, probe_callback, probe_rate):
+ def __init__(self, probe_callback, probe_rate):
#init hier block
gr.hier_block2.__init__(
- self, 'probe',
- gr.io_signature(1, 1,
probe_block.input_signature().sizeof_stream_items()[0]),
+ self, 'probe_function',
+ gr.io_signature(0, 0, 0),
gr.io_signature(1, 1, gr.sizeof_float),
)
self._probe_callback = probe_callback
@@ -43,7 +45,6 @@
message_source = gr.message_source(gr.sizeof_float, 1)
self._msgq = message_source.msgq()
#connect
- self.connect(self, probe_block)
self.connect(message_source, self)
#setup thread
threading.Thread.__init__(self)
@@ -63,6 +64,21 @@
def set_probe_rate(self, probe_rate):
self._probe_rate = probe_rate
+class _probe_base(gr.hier_block2):
+ def __init__(self, probe_block, probe_callback, probe_rate):
+ #init hier block
+ gr.hier_block2.__init__(
+ self, 'probe',
+ gr.io_signature(1, 1,
probe_block.input_signature().sizeof_stream_items()[0]),
+ gr.io_signature(1, 1, gr.sizeof_float),
+ )
+ probe_function_block = probe_function(probe_callback,
probe_rate)
+ #forward callbacks
+ self.set_probe_rate = probe_function_block.set_probe_rate
+ #connect
+ self.connect(self, probe_block)
+ self.connect(probe_function_block, self)
+
#######################################################################################
## Probe: Average Magnitude Squared
#######################################################################################
Modified: gnuradio/trunk/grc/src/platforms/python/Generator.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/python/Generator.py 2008-10-08
04:23:47 UTC (rev 9744)
+++ gnuradio/trunk/grc/src/platforms/python/Generator.py 2008-10-08
05:18:19 UTC (rev 9745)
@@ -81,7 +81,8 @@
controls = filter(lambda v:
v.get_key().startswith('variable_'), variables)
#list of blocks not including variables and imports and
parameters and disabled
blocks = sorted(self._flow_graph.get_enabled_blocks(), lambda
x, y: cmp(x.get_id(), y.get_id()))
- blocks = filter(lambda b: b not in (imports + parameters +
variables), blocks)
+ probes = filter(lambda b: b.get_key().startswith('probe_'),
blocks) #ensure probes are last in the block list
+ blocks = filter(lambda b: b not in (imports + parameters +
variables + probes), blocks) + probes
#list of connections where each endpoint is enabled
connections = self._flow_graph.get_enabled_connections()
#list of variable names
Modified: gnuradio/trunk/grc/todo.txt
===================================================================
--- gnuradio/trunk/grc/todo.txt 2008-10-08 04:23:47 UTC (rev 9744)
+++ gnuradio/trunk/grc/todo.txt 2008-10-08 05:18:19 UTC (rev 9745)
@@ -6,6 +6,8 @@
-controlled step block
-throttle with sink only (source is nulled)
-simplify simple usrp
+-numbersink: update wrapper for newer api
+-probe: also non-float outputs
##################################################
# Features
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r9745 - in gnuradio/trunk/grc: . data/platforms/python data/platforms/python/blocks src/grc_gnuradio/blks2 src/platforms/python,
jblum <=