summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2015-09-04 05:40:42 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2015-09-04 05:40:42 -0700
commit273e5068d6d418eebb77dc0b5e15da20018bb90f (patch)
treee24edf95f5b32a6e724c937d2338dcbdbea85888
parent15ae9d779efa12e7c8a495d87c42032b82942796 (diff)
parent80d52551db67b2e80955eaadbbc63a54d4d4abbc (diff)
Merge branch 'master' into next
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc1
-rw-r--r--gr-uhd/grc/gen_uhd_usrp_blocks.py108
-rw-r--r--grc/base/FlowGraph.py59
-rw-r--r--grc/gui/FlowGraph.py22
-rw-r--r--grc/python/Generator.py2
5 files changed, 151 insertions, 41 deletions
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index 4b7f34ad7c..e1da8440be 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -142,6 +142,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, QWidget* parent)
d_half_freq = false;
d_legend_enabled = true;
d_nrows = 200;
+ d_color_bar_title_font_size = 18;
setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0));
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index 72f1b50135..8531bc05c2 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -81,6 +81,12 @@ self.\$(id).set_antenna(\$ant$(n), $n)
\#if \$bw$(n)()
self.\$(id).set_bandwidth(\$bw$(n), $n)
\#end if
+ \#if \$dc_offs_enb$(n)()
+self.\$(id).set_rx_dc_offset(\$dc_offs_enb$(n), $n)
+ \#end if
+ \#if \$iq_imbal_enb$(n)()
+self.\$(id).set_rx_iq_balance(\$iq_imbal_enb$(n), $n)
+ \#end if
\#end if
#end for
</make>
@@ -137,6 +143,10 @@ self.\$(id).set_gain(\$gain$(n), $n)
<key>sc16</key>
</option>
<option>
+ <name>Complex int12</name>
+ <key>sc12</key>
+ </option>
+ <option>
<name>Complex int8</name>
<key>sc8</key>
</option>
@@ -226,6 +236,22 @@ self.\$(id).set_gain(\$gain$(n), $n)
<name>Default</name>
<key>0.0</key>
</option>
+ <option>
+ <name>200 MHz</name>
+ <key>200e6</key>
+ </option>
+ <option>
+ <name>184.32 MHz</name>
+ <key>184.32e6</key>
+ </option>
+ <option>
+ <name>120 MHz</name>
+ <key>120e6</key>
+ </option>
+ <option>
+ <name>30.72 MHz</name>
+ <key>30.72e6</key>
+ </option>
</param>
<param>
<name>Num Mboards</name>
@@ -327,7 +353,8 @@ self.\$(id).set_gain(\$gain$(n), $n)
<sink>
<name>command</name>
<type>message</type>
- <optional>1</optional>
+ <optional>1</optional>
+ <hide>\$hide_cmd_port</hide>
</sink>
<$sourk>
<name>$direction</name>
@@ -420,13 +447,15 @@ PARAMS_TMPL = """
<value>0</value>
<type>real</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
+ <tab>RF Options</tab>
</param>
<param>
- <name>Ch$(n): Gain Value</name>
+ <name>Ch$(n): Gain Value</name>
<key>gain$(n)</key>
<value>0</value>
<type>float</type>
<hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
+ <tab>RF Options</tab>
</param>
<param>
<name>Ch$(n): Gain Type</name>
@@ -448,6 +477,7 @@ PARAMS_TMPL = """
<name>Normalized</name>
<key>True</key>
</option>
+ <tab>RF Options</tab>
</param>
<param>
<name>Ch$(n): Antenna</name>
@@ -463,6 +493,17 @@ PARAMS_TMPL = """
part
\#end if
</hide>
+#if $sourk == 'sink'
+ <option>
+ <name>TX/RX</name>
+ <key>TX/RX</key>
+ </option>
+#end if
+ <option>
+ <name>RX2</name>
+ <key>RX2</key>
+ </option>
+ <tab>RF Options</tab>
</param>
<param>
<name>Ch$(n): Bandwidth (Hz)</name>
@@ -478,18 +519,68 @@ PARAMS_TMPL = """
part
\#end if
</hide>
+ <tab>RF Options</tab>
+ </param>
+#if $sourk == 'source'
+ <param>
+ <name>Ch$(n): Enable DC Offset Correction</name>
+ <key>dc_offs_enb$(n)</key>
+ <value>""</value>
+ <type>raw</type>
+ <hide>
+ \#if not \$nchan() > $n
+ all
+ \#else
+ part
+ \#end if
+ </hide>
+ <tab>FE Corrections</tab>
+ </param>
+ <param>
+ <name>Ch$(n): Enable IQ Imbalance Correction</name>
+ <key>iq_imbal_enb$(n)</key>
+ <value>""</value>
+ <type>raw</type>
+ <hide>
+ \#if not \$nchan() > $n
+ all
+ \#else
+ part
+ \#end if
+ </hide>
+ <tab>FE Corrections</tab>
+ </param>
+#end if
+"""
+
+SHOW_CMD_PORT_PARAM = """
+ <param>
+ <name>Show Command Port</name>
+ <key>hide_cmd_port</key>
+ <value>False</value>
+ <type>enum</type>
+ <hide>part</hide>
+ <option>
+ <name>Yes</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>No</name>
+ <key>True</key>
+ </option>
+ <tab>Advanced</tab>
</param>
"""
-LENTAG_PARAM = """ <param>
- <name>Length tag name</name>
+TSBTAG_PARAM = """ <param>
+ <name>TSB tag name</name>
<key>len_tag_name</key>
<value></value>
<type>string</type>
<hide>\#if len(str(\$len_tag_name())) then 'none' else 'part'#</hide>
</param>"""
-LENTAG_ARG = """
+TSBTAG_ARG = """
#if $len_tag_name()
$len_tag_name,
#end if"""
@@ -512,10 +603,11 @@ if __name__ == '__main__':
direction = 'in'
else: raise Exception, 'is %s a source or sink?'%file
- params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)])
+ params = ''.join([parse_tmpl(PARAMS_TMPL, n=n, sourk=sourk) for n in range(max_num_channels)])
+ params += SHOW_CMD_PORT_PARAM
if sourk == 'sink':
- params += LENTAG_PARAM
- lentag_arg = LENTAG_ARG
+ params += TSBTAG_PARAM
+ lentag_arg = TSBTAG_ARG
else: lentag_arg = ''
open(file, 'w').write(parse_tmpl(MAIN_TMPL,
lentag_arg=lentag_arg,
diff --git a/grc/base/FlowGraph.py b/grc/base/FlowGraph.py
index 697ae8c47a..217c4d7302 100644
--- a/grc/base/FlowGraph.py
+++ b/grc/base/FlowGraph.py
@@ -18,10 +18,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
import time
-from . import odict
-from Element import Element
+from operator import methodcaller
+from itertools import ifilter
+
from .. gui import Messages
-from . Constants import FLOW_GRAPH_FILE_FORMAT_VERSION
+
+from . import odict
+from .Element import Element
+from .Constants import FLOW_GRAPH_FILE_FORMAT_VERSION
class FlowGraph(Element):
@@ -118,18 +122,24 @@ class FlowGraph(Element):
##############################################
## Access Elements
##############################################
- def get_block(self, id): return filter(lambda b: b.get_id() == id, self.get_blocks())[0]
- def get_blocks_unordered(self): return filter(lambda e: e.is_block(), self.get_elements())
+ def get_block(self, id):
+ for block in self.iter_blocks():
+ if block.get_id() == id:
+ return block
+ raise KeyError('No block with ID {0!r}'.format(id))
+
+ def iter_blocks(self):
+ return ifilter(methodcaller('is_block'), self.get_elements())
+
def get_blocks(self):
- # refactored the slow, ugly version
- # don't know why we need this here, using it for sorted export_data()
- return sorted(self.get_blocks_unordered(), key=lambda b: (
- b.get_key() != 'options', # options to the front
- not b.get_key().startswith('variable'), # then vars
- str(b)
- ))
- def get_connections(self): return filter(lambda e: e.is_connection(), self.get_elements())
- def get_children(self): return self.get_elements()
+ return list(self.iter_blocks())
+
+ def iter_connections(self):
+ return ifilter(methodcaller('is_connection'), self.get_elements())
+
+ def get_connections(self):
+ return list(self.iter_connections())
+
def get_elements(self):
"""
Get a list of all the elements.
@@ -145,6 +155,8 @@ class FlowGraph(Element):
self._elements.remove(self._options_block)
return self._elements
+ get_children = get_elements
+
def get_enabled_blocks(self):
"""
Get a list of all blocks that are enabled and not bypassed.
@@ -152,7 +164,7 @@ class FlowGraph(Element):
Returns:
a list of blocks
"""
- return filter(lambda b: b.get_enabled(), self.get_blocks())
+ return filter(methodcaller('get_enabled'), self.iter_blocks())
def get_bypassed_blocks(self):
"""
@@ -161,7 +173,7 @@ class FlowGraph(Element):
Returns:
a list of blocks
"""
- return filter(lambda b: b.get_bypassed(), self.get_blocks())
+ return filter(methodcaller('get_bypassed'), self.iter_blocks())
def get_enabled_connections(self):
"""
@@ -170,7 +182,7 @@ class FlowGraph(Element):
Returns:
a list of connections
"""
- return filter(lambda c: c.get_enabled(), self.get_connections())
+ return filter(methodcaller('get_enabled'), self.get_connections())
def get_new_block(self, key):
"""
@@ -252,10 +264,17 @@ class FlowGraph(Element):
Returns:
a nested data odict
"""
+ # sort blocks and connections for nicer diffs
+ blocks = sorted(self.iter_blocks(), key=lambda b: (
+ b.get_key() != 'options', # options to the front
+ not b.get_key().startswith('variable'), # then vars
+ str(b)
+ ))
+ connections = sorted(self.get_connections(), key=str)
n = odict()
n['timestamp'] = self._timestamp
- n['block'] = [b.export_data() for b in self.get_blocks()] # already sorted
- n['connection'] = [c.export_data() for c in sorted(self.get_connections(), key=str)]
+ n['block'] = [b.export_data() for b in blocks]
+ n['connection'] = [c.export_data() for c in connections]
instructions = odict({
'created': self.get_parent().get_version_short(),
'format': FLOW_GRAPH_FILE_FORMAT_VERSION,
@@ -301,7 +320,7 @@ class FlowGraph(Element):
block.import_data(block_n)
#build the connections
- block_ids = map(lambda b: b.get_id(), self.get_blocks())
+ block_ids = map(methodcaller('get_id'), self.iter_blocks())
for connection_n in connections_n:
try: # to make the connection
#get the block ids
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index bf6e1eed78..b1e88aae8e 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -17,17 +17,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE
-import Actions
-import Colors
-import Utils
-from Element import Element
-import pygtk
-pygtk.require('2.0')
-import gtk
import random
-import Messages
-import Bars
+from itertools import chain
+from operator import methodcaller
+
+from . import Actions, Colors, Utils, Messages, Bars
+from .Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE
+from .Element import Element
+
class FlowGraph(Element):
"""
@@ -294,7 +291,7 @@ class FlowGraph(Element):
window.draw_rectangle(gc, True, 0, 0, W, H)
# draw comments first
if Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active():
- for block in self.get_blocks():
+ for block in self.iter_blocks():
if block.get_enabled():
block.draw_comment(gc, window)
#draw multi select rectangle
@@ -312,7 +309,8 @@ class FlowGraph(Element):
window.draw_rectangle(gc, False, x, y, w, h)
#draw blocks on top of connections
hide_disabled_blocks = Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active()
- for element in self.get_connections() + self.get_blocks():
+ blocks = sorted(self.iter_blocks(), key=methodcaller('get_enabled'))
+ for element in chain(self.iter_connections(), blocks):
if hide_disabled_blocks and not element.get_enabled():
continue # skip hidden disabled blocks and connections
element.draw(gc, window)
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index 98fbd0c360..3c687a2d64 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -173,7 +173,7 @@ class TopBlockGenerator(object):
return code
blocks = expr_utils.sort_objects(
- filter(lambda b: b.get_enabled() and not b.get_bypassed(), self._flow_graph.get_blocks()),
+ filter(lambda b: b.get_enabled() and not b.get_bypassed(), self._flow_graph.iter_blocks()),
lambda b: b.get_id(), _get_block_sort_text
)
# List of regular blocks (all blocks minus the special ones)