How to define a new variable in GRC


#1

I have 2 variable blocks in GRC called “channel” and “N”
that represent an array of channel taps and an integer, respectively.

I want to generate a new variable called “chanel_FT_inv”
which represents
1/scipy.fft(channel,N)
ie, the inverse of the channel N-length Fourier transform

How do I do that in a clean way from within GRC?

For the moment I do that manually:
I generate the .py file from GRC and then edit it to add the
corresponding piece of code…

Thanks
Achilleas


#2

Achilleas A. wrote:

I have 2 variable blocks in GRC called “channel” and “N”
that represent an array of channel taps and an integer, respectively.

I want to generate a new variable called “chanel_FT_inv”
which represents
1/scipy.fft(channel,N)
ie, the inverse of the channel N-length Fourier transform

I guess the only thing your missing that that scipy is not loaded by
default in grc. So add an import block and enter: import scipy

Works?

-Josh


#3

Yes, I did that.

However, GRC seems to be very unhappy with it.
Take a look at the stripped down grc block that I attach.
If you activate/deactivate a couple of times the
variable block you get error messages/red boxes and the graph cannot be
executed…

I don’t know where this is coming from…

Achilleas

Josh B. wrote:

I guess the only thing your missing that that scipy is not loaded by
default in grc. So add an import block and enter: import scipy

Works?

-Josh


#4

Ack! Something very strange is happening when numpy/scipy is imported. I
will let you know when its fixed/figured out. -Josh


#5

svn up and try it now. I commented out the eval caching. I still cant
put my finger on exactly what went wrong. Or why the behavior is
different, newer numpy, python 2.6…

Anyway, I will keep digging.

-Josh