Results 1 to 9 of 9

Thread: x-axis for waterfall plot

  1. #1
    Join Date
    Mar 2008
    Posts
    44
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Default x-axis for waterfall plot

    Hi

    I am not an experienced Q(w)t user, but learning. I did write a software defined radio for a simple card, under Linux (Slackware) with Qt > 4, Qwt > 5.
    Until now I used a spectrumdisplay for displaying the spectrum of a range of 48k around the selected frequency (depending on the chosen samplerate).

    Using spectrogram stuff I managed to create a waterfall display, showing the spectrum evolving in time. However, I need some help for setting up the appropriate X axis frequencies for this display.
    a. on a 512 element display (power of two handy for the FFT) it shows a block of 512 wide, but the screen is 600 wide
    b. the x axis labels are 0 .. 512 (or -256 .. 256). I need to be able to map these labels
    onto something like 14010 .. 14070, depending on the samplerate chosen.
    anyone can help me?

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: x-axis for waterfall plot

    a. on a 512 element display (power of two handy for the FFT) it shows a block of 512 wide, but the screen is 600 wide
    Or any other size !

    In QwtRasterData::value() you have to return a value for any requested position (not only those in your value matrix) calculated from your matrix (resampling). There a different ways how to do it maybe the most simplest one is using a next neighbour strategy.
    b. the x axis labels are 0 .. 512 (or -256 .. 256). I need to be able to map these labels
    onto something like 14010 .. 14070, depending on the samplerate chosen.
    anyone can help me?
    Implement your own type of QwtScaleDraw and reimplement QwtScaleDraw::label(). Look into the cpuplot example.

    Uwe

  3. #3
    Join Date
    Mar 2008
    Posts
    44
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Default Re: x-axis for waterfall plot

    ad a:
    That is understood, I need to know the number of pixels and map my array data
    on the pixel raster.
    However - probably the most stupid question of the last year - I cannot find the
    number of pixels. rasterHint gives systematically (-1, -1) and is therefore not helpful.
    googling on "qwt rasterHint" gives 8 hits, none of them helpfulhttp://www.qtcentre.org/forum/images/smilies/confused.png

    so, I am stuck

    any help??

    all the best and thanks in advance
    janK

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: x-axis for waterfall plot

    Quote Originally Posted by janK View Post
    That is understood, I need to know the number of pixels and map my array data on the pixel raster.
    No, you don't need to know the number of pixels.

    Your rasterdata object needs to calculate a value for any coordinate it is requested ( + return a valid bounding rectangle to avoid requests for values, where you can't return something useful ). When the resolution of the plot is higher than your value matrix, next neighbor will return each value several times, if it is lower you will have undisplayed values. ( more advanced resampling strategies can avoid this effect, but slow down the rendering process).

    Sometimes it is helpful to know the pixel raster to resample in advance. ( F.e. when you have a huge amount of values on disk you can't have in memory at once ). That's what QwtRasterData::initRaster()/discardRaster() are good for.

    QwtRasterData::rasterHint() returns the raster of your matrix. It is used to find the best resolution for the image of the spectrogram.

    Uwe

  5. #5
    Join Date
    Mar 2008
    Posts
    44
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Talking Re: x-axis for waterfall plot

    Hi

    I did some experimenting and could not help noticing that the size of the requested
    raster extends the requested x-axis. It seems to extend the x-axis to the next multiple
    of 100. a request for a raster for a matrix with n rows gives a raster of
    (n % 100 == 0)? n : (n / 100 + 1) * 100. Based on this I made a value function
    projecting the n rows on the displayed raster,

    At least it works, so my next job is creating the appropriate X_axis for the waterfall display

    So far, thanks

    jan

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: x-axis for waterfall plot

    I'm not sure what you mean by "requested raster", but from your posting I guess your scales are simply the result of the autoscaler.

    You can adjust the behaviour of your autoscaler by changing the attributes of the scale engines. ( or disable autoscaling and assign the scales you like).

    Uwe

  7. #7
    Join Date
    Mar 2008
    Posts
    44
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Question Re: x-axis for waterfall plot

    sorry to bother again, one step further, still needing help

    first: by adding an x axis of the right size, the raster size is correct. I.e. in my case
    I generate FFT spectra consisting of 512 values, by setting the x axis of the plot
    to 512 I do get the whole plot.

    a linear shift of the values of the x axis is possible, i.e., when I have some spectral
    info from e.g. 15000 KHz, I can set the middle of the x axis of the plot to 15000.
    However, the 512 values in my plot may represent 96 Khz in m1y spectrum. Apparently
    I have to scale the value in the x axis, most likely with qwtscalediv.
    The specification of the mapping (i.e. what is being projected upon what) is not
    clear to me. Either the lowerbound .. upperbound map on the qwtvalue list or vv, furthermore the structure of the qwtvaluelist is unclear.

    all the best
    jan

  8. #8
    Join Date
    Mar 2008
    Posts
    44
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Default Re: x-axis for waterfall plot (lost)

    I am unable to solve the x-axis issue.
    Briefly stated, my problem is as follwos:
    a I create a spectrogram (basically according to the example), with width 512 elements
    b. app 10 times a second I generate an update where the topline in the matrix representing
    the spectrogramdata is replaced, with as result a waterfall plot.

    c. I am unable to create an appropriate X axis. My requirements are
    1. the 512 elements represent 96 kHz, so I need to scale. One thought is to
    instruct the spectrogram that it has a matrix of 96000 x 50 by implementing
    a suitable value function
    2. the middle element of my 512 elements has a known (though in time varying)
    frequency attached to it. I have been experimenting with drawscale etc using
    material from the examples and ( as far as I could understand it) the references
    however, in those cases that I had more or less an x-axis to my taste, the spectrogram
    would display all blanks. This makes sense because I need to be able to create a
    mapping from my frequencyrange (e.g. 14000 +/- 48) to the interval 0 .. 512 (the
    implied x-axis from my raster)
    it is a pity that I could not find an introductory text, but I really need help here

    all the best
    jan

  9. #9
    Join Date
    Mar 2008
    Posts
    44
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Smile Re: x-axis for waterfall plot SOLVED

    stupid me,

    Of course a (may be "the") solution was very simple. I seem to have misunderstood
    the notions of raster and the data for the raster. The bounding block is now labeled
    with the intended data (i.e. frequencies of something), and the "value" function
    now maps the array data onto the pixels (domain -> domain). No complex doing with
    X axis, just straight formward.

    Next stop will be a plotmarker

    anyway it was a useful exercise and my waterfall plot looks very nice (and is useful as well).
    all the best
    jan

Similar Threads

  1. Put plot axis out of the plot
    By KosyakOFF in forum Qwt
    Replies: 7
    Last Post: 21st June 2013, 14:36
  2. Replies: 2
    Last Post: 30th June 2009, 18:08
  3. qwp plot axis scale
    By Cal in forum Qwt
    Replies: 1
    Last Post: 11th May 2009, 18:10
  4. Detecting changes in the qwt plot axis
    By mrcolin in forum Qwt
    Replies: 2
    Last Post: 27th January 2009, 13:53
  5. Replies: 7
    Last Post: 22nd September 2008, 23:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.