Real and Imag data

Hi
I’m quite new to the GNU Radio. Recently, I got a problem with how to
pick I and Q parts from the file data_source_1.dat seperately in python.
I have got the signal from the sentence below:

src = gr.file_source(gr.sizeof_gr_complex,“data_source_1.dat”)

I want to store the data(“src”) into data_real[i],data_imag[i] in this
way. Then, calculate the sum and so on …

Any help will be appreciate.

Thanks~

Hi all
Maybe my question is a little bit easy for you. However, I really can’t
get through this.
In all, any help will be appreciated.

Hi, all.
I’ve just written my code like this:

self.src=gr.file_source(gr.sizeof_gr_complex,“data_source_1.dat”)

file data_source_1.dat

rx_subdev = self.src.db[0]+self.src.db[1] # seperate signal,I Q
self.src.set_mux(gru.hexint(0xf1f0f3f2))
deinterleaver = gr.deinterleave(gr.sizeof_gr_complex)

for i in range(len(rx_subdev)): # 10 times gain
rx_subdev[i].set_gain(10)

self.src_real = gr.vector_source_f() # define vector sources
self.src_imag = gr.vector_source_f()
self.connect(self.rx_src,deinterleaver)
self.connect((deinterleaver,0),self.src_real)
self.connect((deinterleaver,1),self.src_imag)

a = src.real() # real parts
b = src.imag() # imag parts

Then, a[i] b[i] to calculate

But, I got these:
Traceback (most recent call last):
File “./pick_signal_complex.py”, line 155, in
tb = wfm_rx_block()
File “./pick_signal_complex.py”, line 88, in init
rx_subdev = self.src.db[0]+self.src.db[1] # seperate signal,I
Q
TypeError: ‘instancemethod’ object is unsubscriptable

Thanks

Hi, all.
I finally figure out myself, as follows:
real = gr.complex_to_real()
imag = gr.complex_to_imag()

  self.connect(self.src,real)
  self.connect(self.src,imag)

  sink1 = gr.vector_sink_f()
  sink2 = gr.vector_sink_f()

  self.connect(real,sink1)
  self.connect(imag,sink2)

  self.start()

  a = sink1.data()
  b = sink2.data()

Then, we can use a[i] or b[i]. Hope these may help someone who caught in
the same trouble with me.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs