[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnuradio-commit
Subject:    [Commit-gnuradio] r8281 - in grc/trunk: scripts src/grc src/grc/elements src/grc/gui/elements src/gr
From:       jblum () gnuradio ! org
Date:       2008-04-26 16:23:07
Message-ID: 20080426162307.BE2E7380095 () nyquist ! gnuradio ! org
[Download RAW message or body]

Author: jblum
Date: 2008-04-26 10:23:04 -0600 (Sat, 26 Apr 2008)
New Revision: 8281

Added:
   grc/trunk/src/grc_gnuradio/blocks/misc/gr_repeat.xml
   grc/trunk/src/grc_gnuradio/blocks/modulators/gr_decode_ccsds_27_fb.xml
   grc/trunk/src/grc_gnuradio/blocks/modulators/gr_encode_ccsds_27_bb.xml
   grc/trunk/src/grc_gnuradio/blocks/operators/gr_integrate_xx.xml
Modified:
   grc/trunk/scripts/usrp_diagnostics
   grc/trunk/src/grc/Constants.py
   grc/trunk/src/grc/Preferences.py
   grc/trunk/src/grc/elements/Platform.py
   grc/trunk/src/grc/gui/elements/Block.py
   grc/trunk/src/grc_gnuradio/Platform.py
   grc/trunk/src/grc_gnuradio/blks2/error_rate.py
   grc/trunk/src/grc_gnuradio/blocks/misc/blks2_error_rate.xml
   grc/trunk/src/grc_gnuradio/data/block_tree.xml
Log:
more blocks, size of fg text, platform load one

Modified: grc/trunk/scripts/usrp_diagnostics
===================================================================
--- grc/trunk/scripts/usrp_diagnostics	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/scripts/usrp_diagnostics	2008-04-26 16:23:04 UTC (rev 8281)
@@ -30,7 +30,7 @@
 from grc.gui.Dialogs import TextDisplay
 
 from grc_gnuradio.Platform import Platform
-platform = Platform()
+platform = Platform('/usrp/usrp_diagnostics.xml')
 
 from grc.gui.elements.Platform import Platform
 platform = Platform(platform)

Modified: grc/trunk/src/grc/Constants.py
===================================================================
--- grc/trunk/src/grc/Constants.py	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc/Constants.py	2008-04-26 16:23:04 UTC (rev 8281)
@@ -100,15 +100,15 @@
 LABEL_PADDING_WIDTH=20
 LABEL_PADDING_HEIGHT=10
 
-PORT_SEPARATION = 20
-PORT_HEIGHT = 17
-PORT_WIDTH = 27
-PORT_BORDER_SEPARATION = 10
+PORT_SEPARATION = 17
+PORT_HEIGHT = 15
+PORT_WIDTH = 25
+PORT_BORDER_SEPARATION = 9
 MAX_NUM_PORTS = 7
 
-PARAM_FONT = 'Sans 8'
-BLOCK_FONT = 'Sans 9 Bold'
-PORT_FONT = 'Sans 8'
+PARAM_FONT = 'Sans 7.5'
+BLOCK_FONT = 'Sans 8'
+PORT_FONT = 'Sans 7.5'
 ##@}
 
 ######################################################################################################


Modified: grc/trunk/src/grc/Preferences.py
===================================================================
--- grc/trunk/src/grc/Preferences.py	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc/Preferences.py	2008-04-26 16:23:04 UTC (rev 8281)
@@ -25,7 +25,7 @@
 import Messages
 
 from grc_gnuradio.Platform import Platform
-platform = Platform()
+platform = Platform('/preferences.xml')
 
 from grc.gui.elements.Platform import Platform
 platform = Platform(platform)

Modified: grc/trunk/src/grc/elements/Platform.py
===================================================================
--- grc/trunk/src/grc/elements/Platform.py	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc/elements/Platform.py	2008-04-26 16:23:04 UTC (rev 8281)
@@ -32,7 +32,7 @@
 
 class Platform(_Element):
 	
-	def __init__(self, name, key, path, block_tree, default_flow_graph, generator):
+	def __init__(self, name, key, path, block_tree, default_flow_graph, generator, \
load_one=None):  """!
 		Make a platform from the arguments.
 		@param name the platform name
@@ -40,6 +40,7 @@
 		@param path the file path to this platform
 		@param block_tree the nested tree of block keys and categories
 		@param default_flow_graph the default flow graph file path
+		@param load_one a single file to load into this platform or None
 		@return a platform object
 		"""
 		_Element.__init__(self)
@@ -50,26 +51,31 @@
 		self._default_flow_graph = default_flow_graph
 		self._generator = generator
 		#create a dummy flow graph for the blocks
-		flow_graph = _Element(self)
+		self.flow_graph = _Element(self)
 		#load the blocks
 		self._blocks = dict()
 		self._blocks_n = dict()
-		for dirpath,dirnames,filenames in os.walk(self._path + '/blocks/'):
-			for filename in filter(lambda f: f.endswith('.xml'), filenames):
-				f = dirpath + '/' + filename
-				try: ParseXML.validate_dtd(f)
-				except ParseXML.ValidationError, e: self._exit_with_error('Block definition "%s" \
                failed: \n\t%s'%(f, e))
-				x = ParseXML.from_file(f)
-				n = ParseXML.from_xml(x)['block']
-				block = self.Block(flow_graph, n)
-				key = block.get_key()
-				#test against repeated keys
-				try: assert(key not in self.get_block_keys())
-				except AssertionError: self._exit_with_error('Key "%s" already exists in \
                blocks'%key)
-				#store the block
-				self._blocks[key] = block
-				self._blocks_n[key] = n
+		if load_one:
+			self._load_block(self._path + '/blocks/' + load_one)	
+		else:
+			for dirpath,dirnames,filenames in os.walk(self._path + '/blocks/'):
+				for filename in filter(lambda f: f.endswith('.xml'), filenames):
+					self._load_block(dirpath + '/' + filename)				
 	
+	def _load_block(self, f):
+		try: ParseXML.validate_dtd(f)
+		except ParseXML.ValidationError, e: self._exit_with_error('Block definition "%s" \
failed: \n\t%s'%(f, e)) +		x = ParseXML.from_file(f)
+		n = ParseXML.from_xml(x)['block']
+		block = self.Block(self.flow_graph, n)
+		key = block.get_key()
+		#test against repeated keys
+		try: assert(key not in self.get_block_keys())
+		except AssertionError: self._exit_with_error('Key "%s" already exists in \
blocks'%key) +		#store the block
+		self._blocks[key] = block
+		self._blocks_n[key] = n
+	
 	def __str__(self): return 'Platform - %s(%s)'%(self.get_name(), self.get_key())
 	
 	def is_platform(self): return True

Modified: grc/trunk/src/grc/gui/elements/Block.py
===================================================================
--- grc/trunk/src/grc/gui/elements/Block.py	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc/gui/elements/Block.py	2008-04-26 16:23:04 UTC (rev 8281)
@@ -119,11 +119,12 @@
 		"""Create the labels for the signal block."""
 		layouts = list()
 		#create the main layout
-		layout = gtk.DrawingArea().create_pango_layout(Utils.xml_encode(self.get_name()))
+		layout = gtk.DrawingArea().create_pango_layout('')
+		layouts.append(layout)
+		if self.is_valid():	layout.set_markup('<b>'+Utils.xml_encode(self.get_name())+'</b>')
 +		else: layout.set_markup('<span \
foreground="red"><b>'+Utils.xml_encode(self.get_name())+'</b></span>')  desc = \
                pango.FontDescription(BLOCK_FONT)
-		layout.set_font_description(desc) 
-		layouts.append(layout)
-		if not self.is_valid():	layout.set_markup('<span \
foreground="red"><b>'+self.get_name()+'</b></span>')			 \
+		layout.set_font_description(desc) 	  self.label_width,self.label_height = \
layout.get_pixel_size()	  #display the params (except for the special params id and \
position)  from grc import Preferences

Modified: grc/trunk/src/grc_gnuradio/Platform.py
===================================================================
--- grc/trunk/src/grc_gnuradio/Platform.py	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc_gnuradio/Platform.py	2008-04-26 16:23:04 UTC (rev 8281)
@@ -37,12 +37,13 @@
 
 class Platform(_Platform):
 	
-	def __init__(self):
+	def __init__(self, load_one=None):
 		"""!
 		Make a platform from the arguments.
 		@param name the platform name
 		@param key the unique platform key
 		@param path the file path to this platform
+		@param load_one a single file to load into this platform or None
 		@return a platform object
 		"""
 		_Platform.__init__(

Modified: grc/trunk/src/grc_gnuradio/blks2/error_rate.py
===================================================================
--- grc/trunk/src/grc_gnuradio/blks2/error_rate.py	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc_gnuradio/blks2/error_rate.py	2008-04-26 16:23:04 UTC (rev 8281)
@@ -20,7 +20,7 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-default_num_samples = 1000
+default_win_size = 1000
 
 from gnuradio import gr
 import gnuradio.gr.gr_threading as _threading
@@ -58,11 +58,11 @@
 	Write the running rate to the output data stream (float).
 	"""
 	
-	def __init__(self, type='BER', num_samples=default_num_samples, \
bits_per_symbol=2):	 +	def __init__(self, type='BER', win_size=default_win_size, \
bits_per_symbol=2):	  """!
 		Error rate constructor.
 		@param type a string 'BER' or 'SER'
-		@param num_samples the number of samples to calculate over
+		@param win_size the number of samples to calculate over
 		@param bits_per_symbol the number of information bits per symbol (BER only)
 		"""	
 		#init
@@ -72,7 +72,7 @@
 			gr.io_signature(1, 1, gr.sizeof_float),
 		)
 		assert type in ('BER', 'SER')
-		self._max_samples = num_samples
+		self._max_samples = win_size
 		self._bits_per_symbol = bits_per_symbol
 		#setup message queue
 		msg_source = gr.message_source(gr.sizeof_float, 1)

Modified: grc/trunk/src/grc_gnuradio/blocks/misc/blks2_error_rate.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/misc/blks2_error_rate.xml	2008-04-26 04:26:15 \
                UTC (rev 8280)
+++ grc/trunk/src/grc_gnuradio/blocks/misc/blks2_error_rate.xml	2008-04-26 16:23:04 \
UTC (rev 8281) @@ -12,7 +12,7 @@
 	<import>from grc_gnuradio import blks2 as grc_blks2</import>
 	<make>grc_blks2.error_rate(
 	type=$type, 
-	num_samples=$num_samples, 
+	win_size=$win_size, 
 	bits_per_symbol=$bits_per_symbol,
 )</make>
 	<param>
@@ -29,8 +29,8 @@
 		</option>
 	</param>
 	<param>
-		<name>Num Samples</name>
-		<key>num_samples</key>
+		<name>Window Size</name>
+		<key>win_size</key>
 		<value>1000</value>
 		<type>int</type>
 	</param>
@@ -52,4 +52,16 @@
 		<name>out</name>
 		<type>float</type>
 	</source>
+	<doc>
+Calculate the bit error rate (BER) or the symbol error rate (SER) over a number of \
samples given by the window size. \ +The actual window size will start at size one \
and grow to the full window size as new samples arrive. \ +Once the window has \
reached full size, old samples are shifted out of the window and new samples shfited \
in. +
+The error block compares the input byte stream to the reference byte stream. \
+For example, the reference byte stream could be the input to a modulator, \
+and the input byte stream could be the output of a modulator.
+
+Each byte in the incoming stream represents one symbol. \
+The bits per symbol parameter is only useful for calculating the BER.
+	</doc>
 </block>

Added: grc/trunk/src/grc_gnuradio/blocks/misc/gr_repeat.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/misc/gr_repeat.xml	                        (rev \
                0)
+++ grc/trunk/src/grc_gnuradio/blocks/misc/gr_repeat.xml	2008-04-26 16:23:04 UTC (rev \
8281) @@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Repeat
+###################################################
+ -->
+<block>
+	<name>Repeat</name>
+	<key>gr_repeat</key>
+	<import>from gnuradio import gr</import>
+	<make>gr.repeat($type.size*$vlen, $interp)</make>
+	<param>
+		<name>Type</name>
+		<key>type</key>
+		<type>enum</type>
+		<option>
+			<name>Complex</name>
+			<key>complex</key>
+			<opt>size:gr.sizeof_gr_complex</opt>					
+		</option>
+		<option>
+			<name>Float</name>
+			<key>float</key>
+			<opt>size:gr.sizeof_float</opt>			
+		</option>
+		<option>
+			<name>Int</name>
+			<key>int</key>
+			<opt>size:gr.sizeof_int</opt>				
+		</option>
+		<option>
+			<name>Short</name>
+			<key>short</key>
+			<opt>size:gr.sizeof_short</opt>					
+		</option>
+		<option>
+			<name>Byte</name>
+			<key>byte</key>
+			<opt>size:gr.sizeof_char</opt>						
+		</option>
+	</param>
+	<param>
+		<name>Interpolation</name>
+		<key>interp</key>
+		<type>int</type>
+	</param>
+	<param>
+		<name>Vec Length</name>
+		<key>vlen</key>
+		<value>1</value>
+		<type>int</type>		
+	</param>
+	<check>$vlen &gt; 0</check>
+	<sink>
+		<name>in</name>
+		<type>$type</type>
+		<vlen>$vlen</vlen>
+	</sink>
+	<source>
+		<name>out</name>
+		<type>$type</type>
+		<vlen>$vlen</vlen>
+	</source>
+</block>

Added: grc/trunk/src/grc_gnuradio/blocks/modulators/gr_decode_ccsds_27_fb.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/modulators/gr_decode_ccsds_27_fb.xml	           \
                (rev 0)
+++ grc/trunk/src/grc_gnuradio/blocks/modulators/gr_decode_ccsds_27_fb.xml	2008-04-26 \
16:23:04 UTC (rev 8281) @@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Decode CCSDS 27
+###################################################
+ -->
+<block>
+	<name>Decode CCSDS 27</name>
+	<key>gr_decode_ccsds_27_fb</key>
+	<import>from gnuradio import gr</import>
+	<make>gr.decode_ccsds_27_fb()</make>
+	<sink>
+		<name>in</name>
+		<type>float</type>
+	</sink>	
+	<source>
+		<name>out</name>
+		<type>byte</type>
+	</source>
+</block>

Added: grc/trunk/src/grc_gnuradio/blocks/modulators/gr_encode_ccsds_27_bb.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/modulators/gr_encode_ccsds_27_bb.xml	           \
                (rev 0)
+++ grc/trunk/src/grc_gnuradio/blocks/modulators/gr_encode_ccsds_27_bb.xml	2008-04-26 \
16:23:04 UTC (rev 8281) @@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Encode CCSDS 27
+###################################################
+ -->
+<block>
+	<name>Encode CCSDS 27</name>
+	<key>gr_encode_ccsds_27_bb</key>
+	<import>from gnuradio import gr</import>
+	<make>gr.encode_ccsds_27_bb()</make>
+	<sink>
+		<name>in</name>
+		<type>byte</type>
+	</sink>	
+	<source>
+		<name>out</name>
+		<type>byte</type>
+	</source>
+</block>

Added: grc/trunk/src/grc_gnuradio/blocks/operators/gr_integrate_xx.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/blocks/operators/gr_integrate_xx.xml	                  \
                (rev 0)
+++ grc/trunk/src/grc_gnuradio/blocks/operators/gr_integrate_xx.xml	2008-04-26 \
16:23:04 UTC (rev 8281) @@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE block SYSTEM "../block.dtd">
+<!-- 
+###################################################
+##Integrate
+###################################################
+ -->
+<block>
+	<name>Integrate</name>
+	<key>gr_integrate_xx</key>
+	<import>from gnuradio import gr</import>
+	<make>gr.integrate_$(type.fcn)($decim)</make>	
+	<param>
+		<name>IO Type</name>
+		<key>type</key>
+		<type>enum</type>		
+		<option>
+			<name>Complex</name>
+			<key>complex</key>
+			<opt>fcn:cc</opt>						
+		</option>
+		<option>
+			<name>Float</name>
+			<key>float</key>
+			<opt>fcn:ff</opt>						
+		</option>
+		<option>
+			<name>Int</name>
+			<key>int</key>
+			<opt>fcn:ii</opt>						
+		</option>
+		<option>
+			<name>Short</name>
+			<key>short</key>
+			<opt>fcn:ss</opt>						
+		</option>
+	</param>
+	<param>
+		<name>Decimation</name>
+		<key>decim</key>
+		<type>int</type>
+	</param>
+	<sink>
+		<name>in</name>
+		<type>$type</type>
+	</sink>	
+	<source>
+		<name>out</name>
+		<type>$type</type>
+	</source>		
+</block>

Modified: grc/trunk/src/grc_gnuradio/data/block_tree.xml
===================================================================
--- grc/trunk/src/grc_gnuradio/data/block_tree.xml	2008-04-26 04:26:15 UTC (rev 8280)
+++ grc/trunk/src/grc_gnuradio/data/block_tree.xml	2008-04-26 16:23:04 UTC (rev 8281)
@@ -52,6 +52,7 @@
 		<block>gr_max_xx</block>
 		<block>gr_argmax_xx</block>
 		<block>gr_rms_xx</block>
+		<block>gr_integrate_xx</block>
 		
 		<block>gr_conjugate_cc</block>
 	</cat>
@@ -195,6 +196,9 @@
 		
 		<block>blks2_synthesis_filterbank</block>
 		<block>blks2_analysis_filterbank</block>
+		
+		<block>gr_encode_ccsds_27_bb</block>
+		<block>gr_decode_ccsds_27_fb</block>
 	</cat>
 	<cat>		
 		<name>Trellis</name>
@@ -224,6 +228,7 @@
 		<block>import</block>
 		<block>gr_throttle</block>
 		<block>gr_delay</block>
+		<block>gr_repeat</block>
 		
 		<block>blks2_selector</block>
 		<block>blks2_valve</block>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic