Beispiel #1
0
 def setUp (self):
     self.tb = gr.top_block ()
     src_file = blocks.file_source(gr.sizeof_gr_complex, "unit_test.tdat")
     di = blocks.deinterleave(gr.sizeof_gr_complex)
     self.tb.connect(src_file, di)
     pd = rmg.pulse_sink_c(4)
     pd.enable(160, 480, 0, 8000, "/tmp/qa_results", str(0), 1.1, 10)
     self.tb.connect((di,0),(pd,0))
     self.tb.connect((di,1),(pd,1))
     self.tb.connect((di,2),(pd,2))
     self.tb.connect((di,3),(pd,3))
Beispiel #2
0
    def __init__(self, channels, be_param, directory = "./det_files"):

        gr.hier_block2.__init__(self, "software_backend",
                                gr.io_signature(4, 4, gr.sizeof_gr_complex), # Input signature
                                gr.io_signature(0, 0, 0))                    # Output signature

        self.band_rate = be_param.bw
        print "Number of Bands: ", be_param.num_bands
        print "Band sampling rate: ",self.band_rate

        self.directory = directory

        if be_param.num_bands > 1:

            # Calculate the polyphase filter.
            taps = gr_filter.firdes.low_pass(1.0, 
                                  self.band_rate*be_param.num_bands, 
                                  0.4*self.band_rate , 
                                  0.1*self.band_rate ,
                                  gr_filter.firdes.WIN_HANN)
            print "Band filter has", len(taps), "taps"

            for j in range(channels):
                self.pp_filter.append(gr_filter.pfb.channelizer_ccf(be_param.num_bands,taps,1))
                self.connect((self,j), self.pp_filter[j])

        for j in range(be_param.num_bands):
            
            # Using default parameters for now. Actual parameters are provided 
            # when the detector bank is enabled. 
            new_det = pulse_sink_c(channels)

            self.det.append(new_det)
  
            # Connect filter outputs to each detector.             
            for k in range(channels):
                if be_param.num_bands > 1:
                    self.connect((self.pp_filter[k],j),(new_det,k))
                else:
                    self.connect((self,k),(new_det,k))

        #: Band set of current tuning. 
        self.current_bands = None

        # Enable the bands in the first tuning set. 
        self.enable(be_param.tunings[0].bands)