Browse Source

renamed strength to SNR

master
Clemens Richter 9 years ago
parent
commit
559aa428b9
  1. 3
      .gitignore
  2. 65
      apps/fft-multi-decoder_fixed_rtlsdr.grc
  3. 61
      apps/ifft-RDS-decoder_hier-block.grc
  4. 2
      grc/CMakeLists.txt
  5. 6
      grc/multirds_pilot_SNR.xml
  6. 2
      python/CMakeLists.txt
  7. 2
      python/__init__.py
  8. 22
      python/pilot_SNR.py
  9. 22
      python/rds_parser_table_qt.py

3
.gitignore vendored

@ -1,4 +1,5 @@
build build
python/cache python/cache
apps/*.py apps/*.py
apps/*.pyc apps/*.pyc
build-manlap

65
apps/fft-multi-decoder_fixed_rtlsdr.grc

@ -189,6 +189,69 @@
<value>2</value> <value>2</value>
</param> </param>
</block> </block>
<block>
<key>variable_qtgui_range</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>value</key>
<value>26</value>
</param>
<param>
<key>_enabled</key>
<value>0</value>
</param>
<param>
<key>_coordinate</key>
<value>(264, 752)</value>
</param>
<param>
<key>gui_hint</key>
<value></value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>bbgain</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>min_len</key>
<value>200</value>
</param>
<param>
<key>orient</key>
<value>Qt.Horizontal</value>
</param>
<param>
<key>start</key>
<value>0</value>
</param>
<param>
<key>step</key>
<value>1</value>
</param>
<param>
<key>stop</key>
<value>62</value>
</param>
<param>
<key>rangeType</key>
<value>float</value>
</param>
<param>
<key>widget</key>
<value>counter_slider</value>
</param>
</block>
<block> <block>
<key>variable</key> <key>variable</key>
<param> <param>
@ -871,7 +934,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(311, 758)</value> <value>(240, 856)</value>
</param> </param>
<param> <param>
<key>gui_hint</key> <key>gui_hint</key>

61
apps/ifft-RDS-decoder_hier-block.grc

@ -615,57 +615,6 @@
<value>1</value> <value>1</value>
</param> </param>
</block> </block>
<block>
<key>blocks_keep_one_in_n</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>2</value>
</param>
<param>
<key>_coordinate</key>
<value>(862, 443)</value>
</param>
<param>
<key>_rotation</key>
<value>180</value>
</param>
<param>
<key>id</key>
<value>blocks_keep_one_in_n_0_0_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>n</key>
<value>2</value>
</param>
<param>
<key>type</key>
<value>byte</value>
</param>
<param>
<key>vlen</key>
<value>1</value>
</param>
</block>
<block> <block>
<key>blocks_null_sink</key> <key>blocks_null_sink</key>
<param> <param>
@ -1081,7 +1030,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(798, 523)</value> <value>(856, 468)</value>
</param> </param>
<param> <param>
<key>_rotation</key> <key>_rotation</key>
@ -3341,12 +3290,6 @@
<source_key>0</source_key> <source_key>0</source_key>
<sink_key>0</sink_key> <sink_key>0</sink_key>
</connection> </connection>
<connection>
<source_block_id>blocks_keep_one_in_n_0_0_0</source_block_id>
<sink_block_id>digital_diff_decoder_bb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection> <connection>
<source_block_id>blocks_null_source_0</source_block_id> <source_block_id>blocks_null_source_0</source_block_id>
<sink_block_id>multirds_rds_decoder_3</sink_block_id> <sink_block_id>multirds_rds_decoder_3</sink_block_id>
@ -3361,7 +3304,7 @@
</connection> </connection>
<connection> <connection>
<source_block_id>digital_binary_slicer_fb_0</source_block_id> <source_block_id>digital_binary_slicer_fb_0</source_block_id>
<sink_block_id>blocks_keep_one_in_n_0_0_0</sink_block_id> <sink_block_id>digital_diff_decoder_bb_0</sink_block_id>
<source_key>0</source_key> <source_key>0</source_key>
<sink_key>0</sink_key> <sink_key>0</sink_key>
</connection> </connection>

2
grc/CMakeLists.txt

@ -30,5 +30,5 @@ install(FILES
multirds_qtgui_range.xml multirds_qtgui_range.xml
multirds_variable_setter.xml multirds_variable_setter.xml
multirds_tmc_parser.xml multirds_tmc_parser.xml
multirds_pilot_quality.xml DESTINATION share/gnuradio/grc/blocks multirds_pilot_SNR.xml DESTINATION share/gnuradio/grc/blocks
) )

6
grc/multirds_pilot_quality.xml → grc/multirds_pilot_SNR.xml

@ -1,10 +1,10 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<block> <block>
<name>pilot_quality</name> <name>pilot_SNR</name>
<key>multirds_pilot_quality</key> <key>multirds_pilot_SNR</key>
<category>[multirds]</category> <category>[multirds]</category>
<import>import multirds</import> <import>import multirds</import>
<make>multirds.pilot_quality($debug, $samp_rate, $fft_len, $carrier_freq,$gap_width, $msg_adr,$update_period)</make> <make>multirds.pilot_SNR($debug, $samp_rate, $fft_len, $carrier_freq,$gap_width, $msg_adr,$update_period)</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI. <!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes: Sub-nodes:
* name * name

2
python/CMakeLists.txt

@ -43,7 +43,7 @@ GR_PYTHON_INSTALL(
variable_setter.py variable_setter.py
tmc_classes.py tmc_classes.py
tmc_parser.py tmc_parser.py
pilot_quality.py DESTINATION ${GR_PYTHON_DIR}/multirds pilot_SNR.py DESTINATION ${GR_PYTHON_DIR}/multirds
) )
######################################################################## ########################################################################

2
python/__init__.py

@ -44,5 +44,5 @@ from decoder_compare import decoder_compare
from qtgui_range import qtgui_range from qtgui_range import qtgui_range
from variable_setter import variable_setter from variable_setter import variable_setter
from tmc_parser import tmc_parser from tmc_parser import tmc_parser
from pilot_quality import pilot_quality from pilot_SNR import pilot_SNR
# #

22
python/pilot_quality.py → python/pilot_SNR.py

@ -24,13 +24,13 @@ from gnuradio import gr
import pmt,time import pmt,time
class pilot_quality(gr.sync_block): class pilot_SNR(gr.sync_block):
""" """
docstring for block pilot_quality docstring for block pilot_SNR
""" """
def __init__(self, debug,samp_rate,fft_len,carrier_freq,gap_width,msg_adr,update_period): def __init__(self, debug,samp_rate,fft_len,carrier_freq,gap_width,msg_adr,update_period):
gr.sync_block.__init__(self, gr.sync_block.__init__(self,
name="pilot_quality", name="pilot_SNR",
in_sig=[(np.float32,fft_len)], in_sig=[(np.float32,fft_len)],
out_sig=None) out_sig=None)
#self.carrier_width=1 #self.carrier_width=1
@ -42,7 +42,7 @@ class pilot_quality(gr.sync_block):
self.lowbound_index=int((carrier_freq-gap_width)*fft_len/float(samp_rate)) self.lowbound_index=int((carrier_freq-gap_width)*fft_len/float(samp_rate))
self.highbound_index=int((carrier_freq+gap_width)*fft_len/float(samp_rate)) self.highbound_index=int((carrier_freq+gap_width)*fft_len/float(samp_rate))
self.send_timer=time.time() self.send_timer=time.time()
self.strength_list=[] self.SNR_list=[]
def work(self, input_items, output_items): def work(self, input_items, output_items):
in0 = input_items[0] in0 = input_items[0]
# <+signal processing here+> # <+signal processing here+>
@ -50,17 +50,17 @@ class pilot_quality(gr.sync_block):
surrounding=np.mean(in_vec[self.lowbound_index:self.highbound_index]) surrounding=np.mean(in_vec[self.lowbound_index:self.highbound_index])
carrier=np.mean(in_vec[self.carrier_index-1:self.carrier_index+1]) carrier=np.mean(in_vec[self.carrier_index-1:self.carrier_index+1])
#code.interact(local=locals()) #code.interact(local=locals())
strength=abs(carrier-surrounding) SNR=abs(carrier-surrounding)
self.strength_list.append(strength) self.SNR_list.append(SNR)
#if self.debug: #if self.debug:
# print("i:%i,strength: %f,carrier: %f, around:%f"%(i,strength,carrier,surrounding)) # print("i:%i,SNR: %f,carrier: %f, around:%f"%(i,SNR,carrier,surrounding))
if time.time()-self.send_timer>self.update_period: if time.time()-self.send_timer>self.update_period:
self.send_timer=time.time() self.send_timer=time.time()
strength_mean=int(np.mean(self.strength_list)) SNR_mean=int(np.mean(self.SNR_list))
self.strength_list=[] self.SNR_list=[]
send_pmt = pmt.cons(pmt.from_long(self.msg_adr),pmt.from_long(strength_mean)) send_pmt = pmt.cons(pmt.from_long(self.msg_adr),pmt.from_long(SNR_mean))
self.message_port_pub(pmt.intern('out'), send_pmt) self.message_port_pub(pmt.intern('out'), send_pmt)
if self.debug: if self.debug:
print("mean:%i"%strength_mean) print("mean:%i"%SNR_mean)
return len(input_items[0]) return len(input_items[0])

22
python/rds_parser_table_qt.py

@ -89,10 +89,10 @@ class rds_parser_table_qt(gr.sync_block):#START
self.decoder_frequencies={} self.decoder_frequencies={}
self.decoders=[] self.decoders=[]
for i in range(nPorts): for i in range(nPorts):
self.decoders.append({'synced':False,'freq':None,'PI':"",'pilot_strength':0}) self.decoders.append({'synced':False,'freq':None,'PI':"",'pilot_SNR':0})
#self.decoder_synced={} #self.decoder_synced={}
#self.colorder=['ID','freq','name','PTY','AF','time','text','quality','buttons'] #self.colorder=['ID','freq','name','PTY','AF','time','text','quality','buttons']
self.colorder=['ID','freq','name','buttons','PTY','AF','time','text','quality','pilot_strength','RT+'] self.colorder=['ID','freq','name','buttons','PTY','AF','time','text','quality','pilot_SNR','RT+']
self.workdir=workdir self.workdir=workdir
self.PI_dict={}#contains PI:numpackets (string:integer) self.PI_dict={}#contains PI:numpackets (string:integer)
self.tmc_messages=tmc_dict() self.tmc_messages=tmc_dict()
@ -183,13 +183,13 @@ class rds_parser_table_qt(gr.sync_block):#START
message_string="decoder frequencies:" message_string="decoder frequencies:"
for num in self.decoder_frequencies: for num in self.decoder_frequencies:
freq=self.decoder_frequencies[num] freq=self.decoder_frequencies[num]
pilot_strength=self.decoders[num]['pilot_strength'] pilot_SNR=self.decoders[num]['pilot_SNR']
if self.decoders[num]['synced']: if self.decoders[num]['synced']:
message_string+="<span style='color:green'>&emsp; %i:%0.1fM (%i dB)</span>"% (num,freq/1e6,pilot_strength) message_string+="<span style='color:green'>&emsp; %i:%0.1fM (%i dB)</span>"% (num,freq/1e6,pilot_SNR)
#print("'color:green'>%i:%0.1fM</span>"% (num,freq/1e6)) #print("'color:green'>%i:%0.1fM</span>"% (num,freq/1e6))
else:#elif self.decoders[num]['synced']==False: else:#elif self.decoders[num]['synced']==False:
#print("'color:red'>%i:%0.1fM</span>"% (num,freq/1e6)) #print("'color:red'>%i:%0.1fM</span>"% (num,freq/1e6))
message_string+="<span style='color:red'>&emsp; %i:%0.1fM (%i dB)</span>"% (num,freq/1e6,pilot_strength) message_string+="<span style='color:red'>&emsp; %i:%0.1fM (%i dB)</span>"% (num,freq/1e6,pilot_SNR)
message_string+="&emsp; tuned frequency:%0.1fM"%(self.tuning_frequency/1e6) message_string+="&emsp; tuned frequency:%0.1fM"%(self.tuning_frequency/1e6)
self.signals.DataUpdateEvent.emit({'decoder_frequencies':message_string}) self.signals.DataUpdateEvent.emit({'decoder_frequencies':message_string})
#print(message_string) #print(message_string)
@ -262,12 +262,12 @@ class rds_parser_table_qt(gr.sync_block):#START
self.RDS_data[PI]["wrong_block_ratio"]=wrong_block_ratio self.RDS_data[PI]["wrong_block_ratio"]=wrong_block_ratio
self.signals.DataUpdateEvent.emit({'PI':PI,'wrong_block_ratio':wrong_block_ratio,'dots':dots}) self.signals.DataUpdateEvent.emit({'PI':PI,'wrong_block_ratio':wrong_block_ratio,'dots':dots})
elif pmt.to_long(pmt.car(msg))==3L: #carrier quality message elif pmt.to_long(pmt.car(msg))==3L: #carrier quality message
pilot_strength=pmt.to_long(pmt.cdr(msg)) pilot_SNR=pmt.to_long(pmt.cdr(msg))
self.decoders[port]['pilot_strength']=pilot_strength self.decoders[port]['pilot_SNR']=pilot_SNR
self.update_freq() self.update_freq()
PI=self.decoders[port]['PI'] PI=self.decoders[port]['PI']
if self.RDS_data.has_key(PI): if self.RDS_data.has_key(PI):
self.signals.DataUpdateEvent.emit({'PI':PI,'pilot_strength':pilot_strength}) self.signals.DataUpdateEvent.emit({'PI':PI,'pilot_SNR':pilot_SNR})
else: #elif pmt.to_long(pmt.car(msg))==0L else: #elif pmt.to_long(pmt.car(msg))==0L
array=pmt.to_python(msg)[1] array=pmt.to_python(msg)[1]
@ -1154,10 +1154,10 @@ class rds_parser_table_qt_Widget(QtGui.QWidget):
row=self.PI_to_row[PI] row=self.PI_to_row[PI]
PIcol=self.colorder.index('ID') PIcol=self.colorder.index('ID')
self.table.cellWidget(row,PIcol).setText(PI) self.table.cellWidget(row,PIcol).setText(PI)
if event.has_key('pilot_strength'): if event.has_key('pilot_SNR'):
col=self.colorder.index('pilot_strength') col=self.colorder.index('pilot_SNR')
item=self.table.cellWidget(row,col) item=self.table.cellWidget(row,col)
item.setText("%i dB"%event['pilot_strength']) item.setText("%i dB"%event['pilot_SNR'])
if event.has_key('freq'): if event.has_key('freq'):
freqcol=self.colorder.index('freq') freqcol=self.colorder.index('freq')
item=self.table.cellWidget(row,freqcol) item=self.table.cellWidget(row,freqcol)

Loading…
Cancel
Save