discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Creating a signal source block using Python


From: Anisha Gorur
Subject: [Discuss-gnuradio] Creating a signal source block using Python
Date: Wed, 18 Jul 2012 14:32:28 -0400

Hello All,

I've been attempting to create my own source block in Python. I have been reading the blocks coding guide here: https://github.com/guruofquality/grextras/wiki/Blocks-Coding-Guide#wiki-work-operation-modes, but so far my source only outputs zeros. 
An outline of my code is as follows:

class constSource(gr.block):
def __init__(self):
                 gr.block.__init__(self, name = "signal source", in_sig = None,out_sig = [numpy.complex64])

def work(self, input_items, output_items):
               num_output_items = len(output_items[0])

         #I put the code to create what I want to stream here, the code creates a numpy.complex64 array with a length of 32. I then return num_output_items
         return num_output_items

I then write my constSource block to a file and I try to see the output of the file using a scope sink, but it is just a constant stream of zeros. Am I missing a key part of creating a source block? Also, the reason I don't use a file source is that the stream I am trying to create is dependent upon the time of day, so pulling it from a file source will mean that it is delayed somewhat. I will eventually want to transmit this data as well, not just put it in a file sink. 

Thanks,
Anisha


reply via email to

[Prev in Thread] Current Thread [Next in Thread]