commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r5790 - in grc/branches/jblum_work: examples src/Eleme


From: jblum
Subject: [Commit-gnuradio] r5790 - in grc/branches/jblum_work: examples src/Elements src/Graphics src/SignalBlockDefs
Date: Sun, 17 Jun 2007 02:43:55 -0600 (MDT)

Author: jblum
Date: 2007-06-17 02:43:55 -0600 (Sun, 17 Jun 2007)
New Revision: 5790

Added:
   grc/branches/jblum_work/examples/channel_distortion.grc.xml
Removed:
   grc/branches/jblum_work/examples/channel_noise.grc.xml
Modified:
   grc/branches/jblum_work/src/Elements/GraphicalParam.py
   grc/branches/jblum_work/src/Graphics/Dialogs.py
   grc/branches/jblum_work/src/Graphics/SignalBlockParamsDialog.py
   grc/branches/jblum_work/src/SignalBlockDefs/Filters.py
   grc/branches/jblum_work/src/SignalBlockDefs/Packet.py
   grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockTree.py
Log:
added frac interp block and channel model, changes to params dialog

Added: grc/branches/jblum_work/examples/channel_distortion.grc.xml
===================================================================
--- grc/branches/jblum_work/examples/channel_distortion.grc.xml                 
        (rev 0)
+++ grc/branches/jblum_work/examples/channel_distortion.grc.xml 2007-06-17 
08:43:55 UTC (rev 5790)
@@ -0,0 +1,120 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<flow_graph>
+  <timestamp>1182068680.68</timestamp>
+  <hostname>tiggle</hostname>
+  <version>0.70 alpha</version>
+  <valid>True</valid>
+  <window_width>1200</window_width>
+  <window_height>800</window_height>
+  <vars>
+    <var>
+      <key>samp_rate</key>
+      <value>32e3</value>
+      <min/>
+      <max/>
+      <step/>
+    </var>
+    <var>
+      <key>freq</key>
+      <value>1000</value>
+      <min>0</min>
+      <max>5000</max>
+      <step>50.0</step>
+    </var>
+  </vars>
+  <signal_blocks>
+    <signal_block>
+      <tag>FFT Sink</tag>
+      <id>FFT Sink0</id>
+      <x_coordinate>571</x_coordinate>
+      <y_coordinate>76</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>0</param>
+        <param>FFT - Distorted</param>
+        <param>$samp_rate</param>
+        <param>20</param>
+        <param>20</param>
+        <param>512</param>
+        <param>15</param>
+        <param>0</param>
+      </params>
+    </signal_block>
+    <signal_block>
+      <tag>FFT Sink</tag>
+      <id>FFT Sink1</id>
+      <x_coordinate>573</x_coordinate>
+      <y_coordinate>266</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>0</param>
+        <param>FFT - Input</param>
+        <param>$samp_rate</param>
+        <param>20</param>
+        <param>20</param>
+        <param>512</param>
+        <param>15</param>
+        <param>0</param>
+      </params>
+    </signal_block>
+    <signal_block>
+      <tag>Channel Model</tag>
+      <id>Channel Model0</id>
+      <x_coordinate>317</x_coordinate>
+      <y_coordinate>101</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>.2</param>
+        <param>0.0</param>
+        <param>1.0</param>
+        <param>1.0,0.0</param>
+      </params>
+    </signal_block>
+    <signal_block>
+      <tag>Signal Source</tag>
+      <id>Signal Source0</id>
+      <x_coordinate>66</x_coordinate>
+      <y_coordinate>193</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>0</param>
+        <param>$samp_rate</param>
+        <param>1</param>
+        <param>$freq</param>
+        <param>1</param>
+        <param>0</param>
+      </params>
+    </signal_block>
+    <signal_block>
+      <tag>About</tag>
+      <id>About0</id>
+      <x_coordinate>59</x_coordinate>
+      <y_coordinate>75</y_coordinate>
+      <rotation>0</rotation>
+      <params>
+        <param>Channel Distortion</param>
+        <param>Josh Blum</param>
+      </params>
+    </signal_block>
+  </signal_blocks>
+  <connections>
+    <connection>
+      <input_signal_block_id>Channel Model0</input_signal_block_id>
+      <input_socket_index>0</input_socket_index>
+      <output_signal_block_id>Signal Source0</output_signal_block_id>
+      <output_socket_index>0</output_socket_index>
+    </connection>
+    <connection>
+      <input_signal_block_id>FFT Sink1</input_signal_block_id>
+      <input_socket_index>0</input_socket_index>
+      <output_signal_block_id>Signal Source0</output_signal_block_id>
+      <output_socket_index>0</output_socket_index>
+    </connection>
+    <connection>
+      <input_signal_block_id>FFT Sink0</input_signal_block_id>
+      <input_socket_index>0</input_socket_index>
+      <output_signal_block_id>Channel Model0</output_signal_block_id>
+      <output_socket_index>0</output_socket_index>
+    </connection>
+  </connections>
+</flow_graph>

Deleted: grc/branches/jblum_work/examples/channel_noise.grc.xml

Modified: grc/branches/jblum_work/src/Elements/GraphicalParam.py
===================================================================
--- grc/branches/jblum_work/src/Elements/GraphicalParam.py      2007-06-17 
07:13:36 UTC (rev 5789)
+++ grc/branches/jblum_work/src/Elements/GraphicalParam.py      2007-06-17 
08:43:55 UTC (rev 5790)
@@ -42,7 +42,7 @@
                self.data_type = data_type
                self.handle_changed = handle_changed
                self.label = gtk.Label('')      #no label, markup is added by 
set_markup
-               self.label.set_size_request(140,30)
+               self.label.set_size_request(140,-1)
                self.label.show()
                self.pack_start(self.label, False)
                self.set_markup = lambda m: self.label.set_markup(m)    
@@ -52,7 +52,8 @@
        """ Provide an entry box for strings and numbers.       """
        def __init__(self, *args):
                InputParam.__init__(self, *args)
-               self.entry = input = gtk.Entry()                                
+               self.entry = input = gtk.Entry()                
+               input.set_size_request(250,-1)          
                input.set_text(self.data_type.get_data())
                input.connect("changed", self.handle_changed)
                input.show()

Modified: grc/branches/jblum_work/src/Graphics/Dialogs.py
===================================================================
--- grc/branches/jblum_work/src/Graphics/Dialogs.py     2007-06-17 07:13:36 UTC 
(rev 5789)
+++ grc/branches/jblum_work/src/Graphics/Dialogs.py     2007-06-17 08:43:55 UTC 
(rev 5790)
@@ -182,10 +182,10 @@
                        else:   
                                tag,spec = color_spec                           
                                markup = '%s\n<span 
background="%s">%s</span>'%(markup, spec, tag)
-               label = gtk.Label('')
+               label = gtk.Label()
                label.set_markup(markup[1:]+'\n')       #strip 1st newline, 
append newline
                label.show()
-               self.vbox.pack_start(label)
+               self.vbox.pack_start(label, False)
                self.run()
                self.destroy()                  
                        
@@ -211,16 +211,15 @@
                        ('Modify Data Type', 'Down'),
                        ('Add a Socket', '+'),
                        ('Remove a Socket', '-'),
-                       ('Close GraphicalParams Dialog', 'Esc'),
+                       ('Close Dialog', 'Esc'),
                        ('Flow Graph Run', 'F5'),
                        ('Flow Graph Stop', 'F7'),
                        ('Screen Shot', 'PrintScreen'),
-               ):
-                       markup = '%s\n<b>%s:</b> %s'%(markup, action, hotkey)
-               label = gtk.Label('')
+               ): markup = '%s\n<b>%s:</b> %s'%(markup, action, hotkey)
+               label = gtk.Label()
                label.set_markup(markup+'\n')   #append newline
                label.show()
-               self.vbox.pack_start(label)
+               self.vbox.pack_start(label, False)
                self.run()
                self.destroy()          
                

Modified: grc/branches/jblum_work/src/Graphics/SignalBlockParamsDialog.py
===================================================================
--- grc/branches/jblum_work/src/Graphics/SignalBlockParamsDialog.py     
2007-06-17 07:13:36 UTC (rev 5789)
+++ grc/branches/jblum_work/src/Graphics/SignalBlockParamsDialog.py     
2007-06-17 08:43:55 UTC (rev 5790)
@@ -35,15 +35,15 @@
                """
                gtk.Dialog.__init__(self, buttons=('gtk-close', 
gtk.RESPONSE_CLOSE))
                self.signal_block = signal_block
-               self.set_title(signal_block.get_id()+' properties')
+               self.set_title('Properties: %s'%signal_block.get_id())
                self.set_size_request(MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
                vbox = gtk.VBox()
                vbox.show()             
                #       Create the title label  #
                label = gtk.Label()
-               label.set_markup('<b>'+self.signal_block.get_id()+' 
Parameters:</b>')
+               label.set_markup('\n<b>Parameters: 
%s</b>\n'%self.signal_block.get_id())
                label.show()
-               self.vbox.pack_start(label, False)
+               vbox.pack_start(label, False)
                # Create the scrolled window to hold all the parameters #
                scrolled_window = gtk.ScrolledWindow()
                scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, 
gtk.POLICY_AUTOMATIC)
@@ -56,14 +56,14 @@
                        
self.original_data.append(param.get_data_type().get_data())
                        vbox.pack_start(param.get_input_object(), False)        
                # Done adding parameters        #                               
                                
-               if self.signal_block.get_docs() != None:        
+               if self.signal_block.get_docs():        
                        #       Create the title label  #
                        label = gtk.Label()
-                       label.set_markup('<b>'+self.signal_block.get_cname()+' 
Documentation:</b>')
+                       label.set_markup('\n\n<b>Documentation: 
%s</b>\n'%self.signal_block.get_cname())
                        label.show()
-                       self.vbox.pack_start(label, False)      
+                       vbox.pack_start(label, False)   
                        #       Create the text box to display notes about the 
block    #       
-                       
self.vbox.pack_start(TextDisplay(self.signal_block.get_docs()), False)
+                       
vbox.pack_start(TextDisplay(self.signal_block.get_docs()), False)
                
        def run(self):
                """!

Modified: grc/branches/jblum_work/src/SignalBlockDefs/Filters.py
===================================================================
--- grc/branches/jblum_work/src/SignalBlockDefs/Filters.py      2007-06-17 
07:13:36 UTC (rev 5789)
+++ grc/branches/jblum_work/src/SignalBlockDefs/Filters.py      2007-06-17 
08:43:55 UTC (rev 5790)
@@ -21,7 +21,7 @@
 address@hidden Josh Blum
 
 from DataTypes import *
-from gnuradio import gr
+from gnuradio import gr,gru,blks
 from SignalBlockConstants import default_samp_rate,all_choices
 
 ###########################################################################
@@ -35,7 +35,7 @@
                ('Float->Float (Float Taps)', (gr.fir_filter_fff, 
gr.interp_fir_filter_fff, Float(), Float(), FloatVector())),  
                ('Float->Short (Float Taps)', (gr.fir_filter_fsf, 
gr.interp_fir_filter_fsf, Float(), Short(), FloatVector())),  
                ('Short->Complex (Complex Taps)', (gr.fir_filter_scc, 
gr.interp_fir_filter_scc, Short(), Complex(), ComplexVector())),          
-               ])
+       ])
        sb.add_input_socket('in', Variable(filters, index=2))
        sb.add_output_socket('out', Variable(filters, index=3))
        sb.add_param('Filter Type', filters, False, type=True)
@@ -55,11 +55,11 @@
                ('Complex', (gr.freq_xlating_fir_filter_ccc, 
gr.freq_xlating_fir_filter_ccf, Complex())),       
                ('Float', (gr.freq_xlating_fir_filter_fcc, 
gr.freq_xlating_fir_filter_fcf, Float())),
                ('Short', (gr.freq_xlating_fir_filter_scc, 
gr.freq_xlating_fir_filter_scf, Short())),                   
-               ])
+       ])
        taps = Enum([
                ('Complex', (0, ComplexVector())),
                ('Float', (1, FloatVector())),
-               ])
+       ])
        sb.add_input_socket('in', Variable(filters, index=2))
        sb.add_output_socket('out', Complex())
        sb.add_param('Input Type', filters, False, type=True)
@@ -79,7 +79,7 @@
        filters = Enum([
                ('Complex', (gr.fft_filter_ccc, Complex(), ComplexVector())),   
                ('Float', (gr.fft_filter_fff, Float(), FloatVector())),         
        
-               ])      
+       ])      
        sb.add_input_socket('in', Variable(filters, index=1))
        sb.add_output_socket('out', Variable(filters, index=1))
        sb.add_param('Type', filters, False, type=True)
@@ -100,7 +100,7 @@
                ('Float->Float (Float Taps)', (gr.rational_resampler_base_fff, 
Float(), Float(), FloatVector())),
                ('Float->Short (Float Taps)', (gr.rational_resampler_base_fsf, 
Float(), Short(), FloatVector())),
                ('Short->Complex (Complex Taps)', 
(gr.rational_resampler_base_scc, Short(), Complex(), ComplexVector())),
-               ])      
+       ])      
        sb.add_input_socket('in', Variable(filters, index=1))
        sb.add_output_socket('out', Variable(filters, index=2))
        sb.add_param('Filter Type', filters, False, type=True)
@@ -137,6 +137,19 @@
 The delay in the real path accounts for the group delay introduced by the 
filter in the imaginary path.\
 ''')
        return sb, lambda fg, taps: fcn(taps.parse())
+       
+def ChannelModel(sb):
+       fcn = blks.channel_model
+       sb.add_input_socket('in', Complex())
+       sb.add_output_socket('out', Complex())
+       sb.add_param('Noise Voltage', Float(0.0))
+       sb.add_param('Freq Offset', Float(0.0))
+       sb.add_param('Epsilon', Float(1.0))
+       sb.add_param('Taps', ComplexVector('1.0,0.0'))
+       sb.set_docs('''Simulate channel distortion.''')
+       def make(fg, noise_voltage, frequency_offset, epsilon, taps):
+               return fcn(fg, noise_voltage.parse(), frequency_offset.parse(), 
epsilon.parse(), taps.parse())
+       return sb, make
 
 ###########################################################################
 #      Special filters using taps generators
@@ -286,8 +299,10 @@
        
 def SinglePoleIIRFilter(sb):
        vlen = Int(1, min=1)
-       type = Enum([('Float', (gr.single_pole_iir_filter_ff, Float())),
-                                       ('Complex', 
(gr.single_pole_iir_filter_cc, Complex())),])
+       type = Enum([
+               ('Float', (gr.single_pole_iir_filter_ff, Float())),
+               ('Complex', (gr.single_pole_iir_filter_cc, Complex())),
+       ])
        sb.add_input_socket('in', Variable(type, index=1))
        sb.add_output_socket('out', Variable(type, index=1), vlen=vlen)
        sb.add_param('Type', type, False, type=True)
@@ -335,8 +350,10 @@
        return sb, lambda fg, num_taps, mod, mu: fcn(num_taps.parse(), 
mod.parse(), mu.parse())
        
 def ClockRecovery(sb):
-       type = Enum([('Complex', (gr.clock_recovery_mm_cc, Complex())),
-                                       ('Float', (gr.clock_recovery_mm_ff, 
Float())),])
+       type = Enum([
+               ('Complex', (gr.clock_recovery_mm_cc, Complex())),
+               ('Float', (gr.clock_recovery_mm_ff, Float())),
+       ])
        sb.add_input_socket('in', Variable(type, index=1))
        sb.add_output_socket('out', Variable(type, index=1))
        sb.add_param('Type', type, False, type=True)
@@ -357,8 +374,10 @@
        
 def FFT(sb):
        taps_maker = gr.firdes.window
-       type = Enum([('Complex', (gr.fft_vcc, ComplexVector())),
-                                       ('Float', (gr.fft_vfc, 
FloatVector())),])
+       type = Enum([
+               ('Complex', (gr.fft_vcc, ComplexVector())),
+               ('Float', (gr.fft_vfc, FloatVector())),
+       ])
        sb.add_input_socket('vin', Variable(type, index=1))
        sb.add_output_socket('vout', ComplexVector())
        sb.add_param('Input Type', type, False, type=True)
@@ -382,8 +401,10 @@
                                                                                
                                        
 def Upsample(sb):
        taps_maker = gr.firdes.window
-       type = Enum([('Complex', (gr.rational_resampler_base_ccf, Complex())),
-                                       ('Float', 
(gr.rational_resampler_base_fff, Float())),], 1)
+       type = Enum([
+               ('Complex', (gr.rational_resampler_base_ccf, Complex())),
+               ('Float', (gr.rational_resampler_base_fff, Float())),
+       ], 1)
        sb.add_input_socket('in', Variable(type, index=1))      
        sb.add_output_socket('out', Variable(type, index=1))    
        sb.add_param('Type', type, False, type=True)
@@ -411,11 +432,11 @@
        return sb, make
 
 def FractionalResampler(sb):
-       from gnuradio import gru, blks
+       lcm = gru.lcm 
        filters = Enum([
                ('Complex', (blks.rational_resampler_ccc, Complex())),
                ('Float', (blks.rational_resampler_fff, Float())),
-               ], 1)
+       ], 1)
        sb.add_input_socket('in', Variable(filters, index=1))
        sb.add_output_socket('out', Variable(filters, index=1))
        sb.add_param('Type', filters, False, type=True)
@@ -429,7 +450,22 @@
        def make(fg, filter_type, inrate, outrate, fractional_bw):
                in_rate = inrate.parse()
                out_rate = outrate.parse()
-               interp = int(gru.lcm(in_rate, out_rate)/in_rate)
-               decim = int(gru.lcm(in_rate, out_rate)/out_rate)
+               interp = int(lcm(in_rate, out_rate)/in_rate)
+               decim = int(lcm(in_rate, out_rate)/out_rate)
                return filter_type.parse()[0](fg, interp, decim, taps=None, 
fractional_bw=fractional_bw.parse())
        return sb, make
+       
+def FractionalInterpolator(sb):
+       filters = Enum([
+               ('Complex', (gr.fractional_interpolator_cc, Complex())),
+               ('Float', (gr.fractional_interpolator_ff, Float())),
+       ], 1)
+       sb.add_input_socket('in', Variable(filters, index=1))
+       sb.add_output_socket('out', Variable(filters, index=1))
+       sb.add_param('Type', filters, False, type=True)
+       sb.add_param('Phase Shift', Float())
+       sb.add_param('Interp Ratio', Float())   
+       def make(fg, filter_type, phase_shit, interp_ratio):
+               return filter_type.parse()[0](phase_shift.parse(), 
interp_ratio.parse())
+       return sb, make
+       

Modified: grc/branches/jblum_work/src/SignalBlockDefs/Packet.py
===================================================================
--- grc/branches/jblum_work/src/SignalBlockDefs/Packet.py       2007-06-17 
07:13:36 UTC (rev 5789)
+++ grc/branches/jblum_work/src/SignalBlockDefs/Packet.py       2007-06-17 
08:43:55 UTC (rev 5790)
@@ -139,6 +139,7 @@
 
#######################################################################################
 
 def PacketMod(sb):
+       blks.mod_pkts, gr.throttle, gr.message_sink     #uses
        type = Enum(all_choices, 1)
        sb.add_input_socket('in', Variable(type))               #packet input
        sb.add_output_socket('out', Byte())
@@ -162,6 +163,9 @@
        sb.set_docs('''\
 The packet modulator wraps a data stream into packets.
 ---
+Modulator type: tells the packet modulator how many bits per symbol to use. \
+A modulator block should still be connected to the output of this block.
+
 Packet length: length of a packet, no greater than %d.
 
 Access code/sync vector: string of 1's and 0's between 1 and %d long. Leave 
blank for default.
@@ -192,7 +196,7 @@
        return sb, make
        
 def PacketDemod(sb):
-       fcn = blks.demod_pkts   
+       blks.demod_pkts, gr.throttle, gr.message_source #uses
        type = Enum(all_choices, 1)
        sb.add_output_socket('out', Variable(type))             #packet output
        sb.add_input_socket('in', Byte())       

Modified: grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockTree.py
===================================================================
--- grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockTree.py      
2007-06-17 07:13:36 UTC (rev 5789)
+++ grc/branches/jblum_work/src/SignalBlockDefs/SignalBlockTree.py      
2007-06-17 08:43:55 UTC (rev 5790)
@@ -110,6 +110,7 @@
                                ('Rational Resampler', 
Filters.RationalResampler),      
                                ('IIR Filer', Filters.IIRFiler),        
                                ('Filter Delay', Filters.FilterDelay),
+                               ('Channel Model', Filters.ChannelModel),
                        ]),             
                        ('Filters', [                   
                                ('Low Pass Filter', Filters.LowPassFilter),
@@ -125,6 +126,7 @@
                                ('Downsample', Filters.Downsample),
                                ('Upsample', Filters.Upsample),                 
        
                                ('Fractional Resampler', 
Filters.FractionalResampler),
+                               ('Fractional Interpolator', 
Filters.FractionalInterpolator),
                                ('Automatic Gain Control', 
Filters.AutomaticGainControl),
                                ('Automatic Gain Control2', 
Filters.AutomaticGainControl2),
                                ('CMA Filter', Filters.CMAFilter),





reply via email to

[Prev in Thread] Current Thread [Next in Thread]