RDS decoder module for GNU Radio, that decodes multiple stations simultaneously
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 lines
1.7 KiB

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 <+YOU OR YOUR COMPANY+>.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
import numpy as np
from gnuradio import gr
class smooth_vectors(gr.decim_block):
"""
docstring for block smooth_vectors
"""
def __init__(self, vec_len,decim,moving_avg_len):
gr.decim_block.__init__(self,
name="smooth_vectors",
in_sig=[(np.float32,vec_len)],
out_sig=[(np.float32,vec_len)], decim=decim)
self.vec_len=vec_len
self.decim=decim
self.moving_avg_len=moving_avg_len
self.last_inputs=[]
self.count=0
def work(self, input_items, output_items):
in0 = input_items[0]
out = output_items[0]
self.last_inputs.insert(0,in0)
out[:] =np.mean( np.array(self.last_inputs), axis=0 )
# <+signal processing here+>
if len(self.last_inputs)>self.moving_avg_len:
self.last_inputs.pop(len(self.last_inputs)-1)#remove last
#out[:] = in0
return len(output_items[0])