Ejemplo n.º 1
0
    def __init__ (self):
        # set up fg
        gr.top_block.__init__(self)

        parser = OptionParser(option_class=eng_option)
        parser.add_option("-I", "--inputfile", type="string", default="cfile",
                          help="Input filename")
        (options, args) = parser.parse_args()

        ifile = options.inputfile

        sample_rate = 400e3
        ampl = 0.1
        file_src = blocks.file_source(8, ifile, False)
        
        #taps = filter.firdes.low_pass(1, sample_rate, 70e3, 10e3)
        taps = filter.firdes.band_pass(1, sample_rate, 67.7033e3-18e3, 67.7033e3+18e3, 10e3)
        detect = fchdetection.detect(taps)
        
        dst = blocks.vector_sink_c()
        self.connect(file_src, detect)
        
        self.connect(detect, dst)
Ejemplo n.º 2
0
    def test_001_t (self):
        # set up fg
        sample_rate = 280e3
        ampl = 0.1
        file_src = blocks.file_source(8, "/home/hzhua/gr_learn/gr-fchdetection/python/943.125_300kHz.cfile", False)
        #src0 = analog.sig_source_c(sample_rate, analog.GR_SIN_WAVE, 60e3, 1.0)
        #src1 = analog.noise_source_c(analog.GR_GAUSSIAN, 0.3)
        add  = blocks.add_cc();
        taps = filter.firdes.low_pass(1, sample_rate, 70e3, 10e3)
 
        detect = fchdetection.detect(taps)
        
        #dst = file.sink(sample_rate, "")fff
        dst = blocks.vector_sink_c()
        #dst= fftsink2.fft_sink_c(panel, title="FFT display", fft_size=512, sample_rate=sample_rate)
        #dst = qtgui.sink_c(512, gr.firdes.WIN_BLACKMAN_hARRIS)

        #self.tb.connect(src0, (add,0));
        #self.tb.connect(src1, (add,1));
        self.tb.connect(file_src, detect)
        #self.tb.connect(add, detect)
        self.tb.connect(detect, dst)
        self.tb.run ()