Monday, July 30, 2018

[Discuss-gnuradio] OOT sourcec block in python error

Hi,

 

I am trying to build a source block in python. Below is my code. After using the block I am getting a syntax error: self.Span_SourceBlock_0 = Template error: Span.SourceBlock($input)

 

My block should take input from user(int/float), and output the same. Though these are available blocks in GnuRadio but I am trying to learn on building it. Can you please check if my way of writing the code is correct?

 

import numpy

from gnuradio import gr

 

class SourceBlock(gr.sync_block):

    """

    docstring for block SourceBlock

    """

    def __init__(self, input):

        self.input = input

        gr.sync_block.__init__(self,

            name="SourceBlock",

            in_sig=None,

            out_sig=[numpy.float32])

 

 

    def work(self, input_items, output_items):

        out = output_items[0]

        out[0][:] = self.input

        return len(output_items[0])

 

Thanks,

Ayaz

No comments:

Post a Comment