Is that possible combining usrp_fft.py and usrp_spectrum_sense.py to do spectrum analysis and observ

Hi All,

I am new to Gnuradio. I did some test and simple implementation. Now, I
have
a question about combining usrp_fft.py and usrp_spectrum_sense.py.

I know that usrp_fft.py gives a spectrum at certain center frequency I
specified, and shows the result in a GUI window. By changing the
decimation,
I can get the spectrum at interested frequency within different
bandwidth.
Say, if decimation is 16, the bandwidth shown in GUI is 4M, if option -8
is
applied and decimation is 4, a 16M bandwidth can be got. So that means
that
I can do the spectrum analysis and observe it in GUI window just within
16M.

Later on, I found that usrp_spectrum_sense.py can be used to analysis
spectrum within any frequency range, I just need to specify the lower
bound
and upper bound of the frequencies. And I can save the output to a file
and
plot it using Matlab. However, I want to observe the spectrum in a GUI
window, like usrp_fft does, rather than the output file.

Is that possible that by modifying usrp_fft.py and combining it with
usrp_spectrum_sense.py, the spectrum within a wider range of frequencies
can
be observed in a GUI window?

By giving the min_freq and max_freq, the nsteps, min_center_freq, and
max_center_freq can be set. Do I need to call self._build_gui(vbox)
after
each updated center frequency? And all will be plotted in one GUI
window?

Do you have any suggestion on it? I really appreciate!

Thanks in advance,
Brook L.

View this message in context:
http://www.nabble.com/Is-that-possible-combining-usrp_fft.py-and-usrp_spectrum_sense.py-to-do-spectrum-analysis-and-observe-in-GUI-in-a-wider-frequency-range--tf4953044.html#a14183248
Sent from the GnuRadio mailing list archive at Nabble.com.

On Wed, Dec 05, 2007 at 03:54:50PM -0800, Brook L. wrote:

applied and decimation is 4, a 16M bandwidth can be got. So that means that
be observed in a GUI window?
Yes. Note however that at this moment there is a known problem with
usrp_spectrum_sense.py (actually believed to be in gr_feval_dd) that
causes a segmentation fault. See ticket:199
http://gnuradio.org/trac/ticket/199

Eric

Thanks for your reply and kind reminder, Eric. I think
usrp_spectrum_sense.py
works fine on my computer without segmentation fault.

I observe that there is a set_next_freq() function in
usrp_spectrum_sense.py
file, which is used to tune the center freq used in set_freq() function,
isn’t it? The target_freq is used to set the center freq of the USRP to
determine the value of DDC.

Here is the build graph part that I changed and I thought it fit my
project
purpose: observing fft in larger bandwidth.

 # build the graph

self.u = usrp.source_c(which=options.which,decim_rate=options.decim)
if options.rx_subdev_spec is None:
   options.rx_subdev_spec = pick_subdevice(self.u)
self.u.set_mux(usrp.determine_rx_mux_value(self.u,

options.rx_subdev_spec))

if options.width_8:
  width = 8
  shift = 8
  format = self.u.make_format(width, shift)
  print "format =", hex(format)
  r = self.u.set_format(format)
   print "set_format =", r

# determine the daughterboard subdevice we're using
self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)

#input_rate = self.u.adc_freq() / self.u.decim_rate()
input_rate = self.u.adc_freq() / options.decim

#************************************************************
# Set the freq_step to 75% of the actual data throughput.
    # This allows us to discard the bins on both ends of the 

spectrum.

self.min_freq = options.freq_min
self.max_freq = options.freq_max
self.freq_step = 0.75*input_rate
self.min_center_freq = self.min_freq + self.freq_step/2
nsteps = math.ceil((self.max_freq - self.min_freq) / self.freq_step)
print "nsteps is ", nsteps
self.max_center_freq = self.min_center_freq + (nsteps * 

self.freq_step)
for i in range(nsteps):
if i == 0:
self.next_freq = self.min_center_freq
else:
self.next_freq = self.next_freq + self.freq_step

  print self.next_freq, "***", i, "***"

  if not(self.set_freq(self.next_freq)):
    print "Failed to set frequency to", self.next_freq

  self.set_freq(self.next_freq)

#************************************************************
  self.scope = fftsink2.fft_sink_c (panel, title="Signal

Detection",fft_size=1024, sample_rate=input_rate,
baseband_freq=self.next_freq)

  self.connect(self.u, self.scope)

  self._build_gui(vbox)

  # set initial values
                    .........................
                    .........................

==============================================
However, by given the lower bound and the upper bound of the freq range,
next_freq can be get and “Failed to set frequency to”, self.next_freq"
is
also get. and all the plots are the same, seems
self.set_freq(self.next_freq) doesn’t work. Do you know why it failed to
set?

The 2nd question is, I know I call self._build_gui(vbox) within for
loop. So
in GUI window, I will have several fft plots regarding the deferent
center
freq. How can I get one GUI with one plot and show all the spectrum, say
all
FM Stations?

I am new to Gnuradio, so any reply is helpful for me.

Thanks,
Brook

Eric B. wrote:

[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://www.nabble.com/Is-that-possible-combining-usrp_fft.py-and-usrp_spectrum_sense.py-to-do-spectrum-analysis-and-observe-in-GUI-in-a-wider-frequency-range--tp14183248p14260983.html
Sent from the GnuRadio mailing list archive at Nabble.com.

I have figured out why it failed to set freq. Now my question is still
how
can I get one GUI with one plot and show all the spectrum, say all FM
stations.

Thanks

Brook L. wrote:

spectrum, say all FM Stations?

usrp_spectrum_sense.py (actually believed to be in gr_feval_dd) that


View this message in context:
http://www.nabble.com/Is-that-possible-combining-usrp_fft.py-and-usrp_spectrum_sense.py-to-do-spectrum-analysis-and-observe-in-GUI-in-a-wider-frequency-range--tp14183248p14266675.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Mon, Dec 10, 2007 at 12:34:07PM -0800, Brook L. wrote:

However, by given the lower bound and the upper bound of the freq range,
next_freq can be get and “Failed to set frequency to”, self.next_freq" is
also get. and all the plots are the same, seems
self.set_freq(self.next_freq) doesn’t work. Do you know why it failed to
set?

Are you asking the daughterboard to tune outside of its range?
What daughterboard are you using? What frequencies is it failing on?

Eric