Have just looked at your code from my mobile.
You want to check numpy.log10 and numpy.greater (there will be other ways
to do the same thing).

On Tue, Jan 2, 2018, 20:18 Gilad Beeri (ApolloShield) <
[email protected]> wrote:

> This is related to Python, not GNU Radio per se. It seems that you pass
> in1 to math.log10().
> I assume that you define in1 as input_items[1], which is a list of items
> to process (not a single item), while the log function expects to get a
> float, not a list.
>
> Something like:
> for item in in1:
>   c = math.log10(item)
>
> should work for you. I guess there's a numpy function that will run the
> log function on a list more efficiently.
>
>
>
> On Tue, Jan 2, 2018, 20:10 Tellrell White <[email protected]> wrote:
>
>> Hello Guys
>>
>> I'm creating a customized block in the GNU Radio framework using python
>> that takes in a number of input items and once that number of input items
>> surpasses a certain number, 1024 of the input items are taken and stored
>> into an array, and then those items are converted to dB and lastly compared
>> to a threshold value, 5 in this case. If any of the values are greater than
>> the threshold value, a message is printed indicating a signal is present,
>> and if none of the values are greater than 5, this is indicated with a
>> message stating "No signal is present".
>>
>> When I run the flow graph which uses this block I get the following error.
>>
>> handler caught exception: a float is required
>> Traceback (most recent call last):
>>   File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/gateway.py",
>> line 55, in eval
>>     try: self._callback()
>>   File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/gateway.py",
>> line 144, in __gr_block_handle
>>     ) for i in self.__out_indexes],
>>   File "/home/tellrell/Ener_detec.py", line 42, in general_work
>>     c = math.log10(in1)         #converts 1024 values stored in in1 to dB
>> and stores them in c
>> TypeError: a float is required
>> thread[thread-per-block[8]: <block ED_block (22)>]: caught unrecognized
>> exception
>>
>>
>>
>> The .py script for the customized block along with the corresponding .grc
>> file are attached below.
>>
>> Any help would be great.
>>
>> Tellrell
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> [email protected]
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to