Exemple #1
0
def main():
    import sys
    if len(sys.argv) <= 1:
        print "Usage: example1.py file1.fil [file2.fil ...]"
        sys.exit(-1)
    filenames = sys.argv[1:]

    h_filterbank = read_sigproc(filenames, gulp_nframe=16000, core=0)
    h_filterbank = scrunch(h_filterbank, 16, core=0)
    d_filterbank = copy(h_filterbank, space='cuda', gpu=0, core=2)
    blocks.print_header(d_filterbank)
    with bfp.block_scope(core=2, gpu=0):
        d_filterbankT = transpose(d_filterbank,
                                  ['pol', 'freq', 'time'])  #[1,2,0])
        d_dispersionbankT = fdmt(d_filterbankT, max_dm=282.52)
        blocks.print_header(d_dispersionbankT)
        d_dispersionbank = transpose(d_dispersionbankT,
                                     ['time', 'pol', 'dispersion'])  #[2,0,1])
    h_dispersionbank = copy(d_dispersionbank, space='system', core=3)
    write_pgm(h_dispersionbank, core=3)

    pipeline = bfp.get_default_pipeline()
    graph_filename = "example1.dot"
    with open(graph_filename, 'w') as dotfile:
        dotfile.write(str(pipeline.dot_graph()))
        print "Wrote graph definition to", graph_filename
    pipeline.run()
    print "All done"
Exemple #2
0
 def test_null_scrunch(self):
     """Check that scrunching no spans leaves header intact"""
     self.shape_settings = [-1, 1, 2]
     with bfp.Pipeline() as pipeline:
         data = blocks.sigproc.read_sigproc([self.fil_file], self.gulp_nframe)
         call_data = CallbackBlock(
                 data, self.check_sequence_before, self.check_data_before)
         scrunched = blocks.scrunch(data, 1)
         call_data = CallbackBlock(
                 scrunched, self.check_sequence_after, self.check_data_after)
         pipeline.run()
Exemple #3
0
 def test_simple_scrunch(self):
     """Check that scrunching 2 spans changes header correctly"""
     self.shape_settings = [-1, 1, 2 * 2]
     self.gulp_nframe = 101
     with bfp.Pipeline() as pipeline:
         data = blocks.sigproc.read_sigproc([self.fil_file], self.gulp_nframe)
         call_data = CallbackBlock(
                 data, self.check_sequence_before, self.check_data_before)
         scrunched = blocks.scrunch(data, 2)
         call_data = CallbackBlock(
                 scrunched, self.check_sequence_after, self.check_data_after)
         pipeline.run()
Exemple #4
0
def main(args):
    h_filterbank = read_sigproc(args.filename, gulp_nframe=16000, core=0)
    h_filterbank = scrunch(h_filterbank, 16, core=0)
    d_filterbank = copy(h_filterbank, space='cuda', gpu=0, core=2)
    blocks.print_header(d_filterbank)
    with bfp.block_scope(core=2, gpu=0):
        d_filterbankT = transpose(d_filterbank,
                                  ['pol', 'freq', 'time'])  #[1,2,0])
        d_dispersionbankT = fdmt(d_filterbankT, max_dm=282.52)
        blocks.print_header(d_dispersionbankT)
        d_dispersionbank = transpose(d_dispersionbankT,
                                     ['time', 'pol', 'dispersion'])  #[2,0,1])
    h_dispersionbank = copy(d_dispersionbank, space='system', core=3)
    write_pgm(h_dispersionbank, core=3)

    pipeline = bfp.get_default_pipeline()
    graph_filename = "example1.dot"
    with open(graph_filename, 'w') as dotfile:
        dotfile.write(str(pipeline.dot_graph()))
        print("Wrote graph definition to", graph_filename)
    pipeline.run()
    print("All done")